2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
288 struct snd_jack *jack;
291 #define MUX_IDX_UNDEF ((unsigned char)-1)
293 struct alc_customize_define {
294 unsigned int sku_cfg;
295 unsigned char port_connectivity;
296 unsigned char check_sum;
297 unsigned char customization;
298 unsigned char external_amp;
299 unsigned int enable_pcbeep:1;
300 unsigned int platform_type:1;
302 unsigned int override:1;
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
309 /* codec parameterization */
310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
311 unsigned int num_mixers;
312 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
313 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
315 const struct hda_verb *init_verbs[10]; /* initialization verbs
319 unsigned int num_init_verbs;
321 char stream_name_analog[32]; /* analog PCM stream */
322 struct hda_pcm_stream *stream_analog_playback;
323 struct hda_pcm_stream *stream_analog_capture;
324 struct hda_pcm_stream *stream_analog_alt_playback;
325 struct hda_pcm_stream *stream_analog_alt_capture;
327 char stream_name_digital[32]; /* digital PCM stream */
328 struct hda_pcm_stream *stream_digital_playback;
329 struct hda_pcm_stream *stream_digital_capture;
332 struct hda_multi_out multiout; /* playback set-up
333 * max_channels, dacs must be set
334 * dig_out_nid and hp_nid are optional
336 hda_nid_t alt_dac_nid;
337 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
341 unsigned int num_adc_nids;
343 hda_nid_t *capsrc_nids;
344 hda_nid_t dig_in_nid; /* digital-in NID; optional */
346 /* capture setup for dynamic dual-adc switch */
347 unsigned int cur_adc_idx;
349 unsigned int cur_adc_stream_tag;
350 unsigned int cur_adc_format;
353 unsigned int num_mux_defs;
354 const struct hda_input_mux *input_mux;
355 unsigned int cur_mux[3];
356 struct alc_mic_route ext_mic;
357 struct alc_mic_route int_mic;
360 const struct hda_channel_mode *channel_mode;
361 int num_channel_mode;
363 int const_channel_count;
364 int ext_channel_count;
366 /* PCM information */
367 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
370 struct snd_array jacks;
372 /* dynamic controls, init_verbs and input_mux */
373 struct auto_pin_cfg autocfg;
374 struct alc_customize_define cdefine;
375 struct snd_array kctls;
376 struct hda_input_mux private_imux[3];
377 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
378 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
379 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
382 void (*init_hook)(struct hda_codec *codec);
383 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
384 #ifdef CONFIG_SND_HDA_POWER_SAVE
385 void (*power_hook)(struct hda_codec *codec);
388 /* for pin sensing */
389 unsigned int sense_updated: 1;
390 unsigned int jack_present: 1;
391 unsigned int master_sw: 1;
392 unsigned int auto_mic:1;
395 unsigned int no_analog :1; /* digital I/O only */
396 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
398 int codec_variant; /* flag for other variants */
400 /* for virtual master */
401 hda_nid_t vmaster_nid;
402 #ifdef CONFIG_SND_HDA_POWER_SAVE
403 struct hda_loopback_check loopback;
408 unsigned int pll_coef_idx, pll_coef_bit;
412 const struct alc_fixup *fixup_list;
413 const char *fixup_name;
417 * configuration template - to be copied to the spec instance
419 struct alc_config_preset {
420 struct snd_kcontrol_new *mixers[5]; /* should be identical size
423 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
424 const struct hda_verb *init_verbs[5];
425 unsigned int num_dacs;
427 hda_nid_t dig_out_nid; /* optional */
428 hda_nid_t hp_nid; /* optional */
429 hda_nid_t *slave_dig_outs;
430 unsigned int num_adc_nids;
432 hda_nid_t *capsrc_nids;
433 hda_nid_t dig_in_nid;
434 unsigned int num_channel_mode;
435 const struct hda_channel_mode *channel_mode;
437 int const_channel_count;
438 unsigned int num_mux_defs;
439 const struct hda_input_mux *input_mux;
440 void (*unsol_event)(struct hda_codec *, unsigned int);
441 void (*setup)(struct hda_codec *);
442 void (*init_hook)(struct hda_codec *);
443 #ifdef CONFIG_SND_HDA_POWER_SAVE
444 struct hda_amp_list *loopbacks;
445 void (*power_hook)(struct hda_codec *codec);
453 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
454 struct snd_ctl_elem_info *uinfo)
456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
457 struct alc_spec *spec = codec->spec;
458 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
459 if (mux_idx >= spec->num_mux_defs)
461 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
463 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
466 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
467 struct snd_ctl_elem_value *ucontrol)
469 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
470 struct alc_spec *spec = codec->spec;
471 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
473 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
477 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 const struct hda_input_mux *imux;
483 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
484 unsigned int mux_idx;
485 hda_nid_t nid = spec->capsrc_nids ?
486 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
489 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
490 imux = &spec->input_mux[mux_idx];
491 if (!imux->num_items && mux_idx > 0)
492 imux = &spec->input_mux[0];
494 type = get_wcaps_type(get_wcaps(codec, nid));
495 if (type == AC_WID_AUD_MIX) {
496 /* Matrix-mixer style (e.g. ALC882) */
497 unsigned int *cur_val = &spec->cur_mux[adc_idx];
500 idx = ucontrol->value.enumerated.item[0];
501 if (idx >= imux->num_items)
502 idx = imux->num_items - 1;
505 for (i = 0; i < imux->num_items; i++) {
506 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
507 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
508 imux->items[i].index,
514 /* MUX style (e.g. ALC880) */
515 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
516 &spec->cur_mux[adc_idx]);
521 * channel mode setting
523 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_info *uinfo)
526 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
527 struct alc_spec *spec = codec->spec;
528 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
529 spec->num_channel_mode);
532 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
533 struct snd_ctl_elem_value *ucontrol)
535 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
536 struct alc_spec *spec = codec->spec;
537 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
538 spec->num_channel_mode,
539 spec->ext_channel_count);
542 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_value *ucontrol)
545 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
546 struct alc_spec *spec = codec->spec;
547 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
548 spec->num_channel_mode,
549 &spec->ext_channel_count);
550 if (err >= 0 && !spec->const_channel_count) {
551 spec->multiout.max_channels = spec->ext_channel_count;
552 if (spec->need_dac_fix)
553 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
559 * Control the mode of pin widget settings via the mixer. "pc" is used
560 * instead of "%" to avoid consequences of accidently treating the % as
561 * being part of a format specifier. Maximum allowed length of a value is
562 * 63 characters plus NULL terminator.
564 * Note: some retasking pin complexes seem to ignore requests for input
565 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
566 * are requested. Therefore order this list so that this behaviour will not
567 * cause problems when mixer clients move through the enum sequentially.
568 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
571 static char *alc_pin_mode_names[] = {
572 "Mic 50pc bias", "Mic 80pc bias",
573 "Line in", "Line out", "Headphone out",
575 static unsigned char alc_pin_mode_values[] = {
576 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
578 /* The control can present all 5 options, or it can limit the options based
579 * in the pin being assumed to be exclusively an input or an output pin. In
580 * addition, "input" pins may or may not process the mic bias option
581 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
582 * accept requests for bias as of chip versions up to March 2006) and/or
583 * wiring in the computer.
585 #define ALC_PIN_DIR_IN 0x00
586 #define ALC_PIN_DIR_OUT 0x01
587 #define ALC_PIN_DIR_INOUT 0x02
588 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
589 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
591 /* Info about the pin modes supported by the different pin direction modes.
592 * For each direction the minimum and maximum values are given.
594 static signed char alc_pin_mode_dir_info[5][2] = {
595 { 0, 2 }, /* ALC_PIN_DIR_IN */
596 { 3, 4 }, /* ALC_PIN_DIR_OUT */
597 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
598 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
599 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
601 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
602 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
603 #define alc_pin_mode_n_items(_dir) \
604 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
606 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
607 struct snd_ctl_elem_info *uinfo)
609 unsigned int item_num = uinfo->value.enumerated.item;
610 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
612 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
614 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
616 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
617 item_num = alc_pin_mode_min(dir);
618 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
622 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
623 struct snd_ctl_elem_value *ucontrol)
626 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
627 hda_nid_t nid = kcontrol->private_value & 0xffff;
628 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
629 long *valp = ucontrol->value.integer.value;
630 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
631 AC_VERB_GET_PIN_WIDGET_CONTROL,
634 /* Find enumerated value for current pinctl setting */
635 i = alc_pin_mode_min(dir);
636 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
638 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
642 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
643 struct snd_ctl_elem_value *ucontrol)
646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
647 hda_nid_t nid = kcontrol->private_value & 0xffff;
648 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
649 long val = *ucontrol->value.integer.value;
650 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
651 AC_VERB_GET_PIN_WIDGET_CONTROL,
654 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
655 val = alc_pin_mode_min(dir);
657 change = pinctl != alc_pin_mode_values[val];
659 /* Set pin mode to that requested */
660 snd_hda_codec_write_cache(codec, nid, 0,
661 AC_VERB_SET_PIN_WIDGET_CONTROL,
662 alc_pin_mode_values[val]);
664 /* Also enable the retasking pin's input/output as required
665 * for the requested pin mode. Enum values of 2 or less are
668 * Dynamically switching the input/output buffers probably
669 * reduces noise slightly (particularly on input) so we'll
670 * do it. However, having both input and output buffers
671 * enabled simultaneously doesn't seem to be problematic if
672 * this turns out to be necessary in the future.
675 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
676 HDA_AMP_MUTE, HDA_AMP_MUTE);
677 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
680 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
681 HDA_AMP_MUTE, HDA_AMP_MUTE);
682 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
689 #define ALC_PIN_MODE(xname, nid, dir) \
690 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
691 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
692 .info = alc_pin_mode_info, \
693 .get = alc_pin_mode_get, \
694 .put = alc_pin_mode_put, \
695 .private_value = nid | (dir<<16) }
697 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
698 * together using a mask with more than one bit set. This control is
699 * currently used only by the ALC260 test model. At this stage they are not
700 * needed for any "production" models.
702 #ifdef CONFIG_SND_DEBUG
703 #define alc_gpio_data_info snd_ctl_boolean_mono_info
705 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long *valp = ucontrol->value.integer.value;
712 unsigned int val = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_GPIO_DATA, 0x00);
715 *valp = (val & mask) != 0;
718 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long val = *ucontrol->value.integer.value;
726 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_GPIO_DATA,
730 /* Set/unset the masked GPIO bit(s) as needed */
731 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
736 snd_hda_codec_write_cache(codec, nid, 0,
737 AC_VERB_SET_GPIO_DATA, gpio_data);
741 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
744 .info = alc_gpio_data_info, \
745 .get = alc_gpio_data_get, \
746 .put = alc_gpio_data_put, \
747 .private_value = nid | (mask<<16) }
748 #endif /* CONFIG_SND_DEBUG */
750 /* A switch control to allow the enabling of the digital IO pins on the
751 * ALC260. This is incredibly simplistic; the intention of this control is
752 * to provide something in the test model allowing digital outputs to be
753 * identified if present. If models are found which can utilise these
754 * outputs a more complete mixer control can be devised for those models if
757 #ifdef CONFIG_SND_DEBUG
758 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
760 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
761 struct snd_ctl_elem_value *ucontrol)
763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
764 hda_nid_t nid = kcontrol->private_value & 0xffff;
765 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
766 long *valp = ucontrol->value.integer.value;
767 unsigned int val = snd_hda_codec_read(codec, nid, 0,
768 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
770 *valp = (val & mask) != 0;
773 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
774 struct snd_ctl_elem_value *ucontrol)
777 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
778 hda_nid_t nid = kcontrol->private_value & 0xffff;
779 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
780 long val = *ucontrol->value.integer.value;
781 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
782 AC_VERB_GET_DIGI_CONVERT_1,
785 /* Set/unset the masked control bit(s) as needed */
786 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
791 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
796 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
797 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
798 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
799 .info = alc_spdif_ctrl_info, \
800 .get = alc_spdif_ctrl_get, \
801 .put = alc_spdif_ctrl_put, \
802 .private_value = nid | (mask<<16) }
803 #endif /* CONFIG_SND_DEBUG */
805 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
806 * Again, this is only used in the ALC26x test models to help identify when
807 * the EAPD line must be asserted for features to work.
809 #ifdef CONFIG_SND_DEBUG
810 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
812 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
813 struct snd_ctl_elem_value *ucontrol)
815 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
816 hda_nid_t nid = kcontrol->private_value & 0xffff;
817 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
818 long *valp = ucontrol->value.integer.value;
819 unsigned int val = snd_hda_codec_read(codec, nid, 0,
820 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
822 *valp = (val & mask) != 0;
826 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
827 struct snd_ctl_elem_value *ucontrol)
830 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
831 hda_nid_t nid = kcontrol->private_value & 0xffff;
832 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
833 long val = *ucontrol->value.integer.value;
834 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
835 AC_VERB_GET_EAPD_BTLENABLE,
838 /* Set/unset the masked control bit(s) as needed */
839 change = (!val ? 0 : mask) != (ctrl_data & mask);
844 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
850 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
851 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
852 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
853 .info = alc_eapd_ctrl_info, \
854 .get = alc_eapd_ctrl_get, \
855 .put = alc_eapd_ctrl_put, \
856 .private_value = nid | (mask<<16) }
857 #endif /* CONFIG_SND_DEBUG */
860 * set up the input pin config (depending on the given auto-pin type)
862 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
865 unsigned int val = PIN_IN;
867 if (auto_pin_type == AUTO_PIN_MIC) {
870 oldval = snd_hda_codec_read(codec, nid, 0,
871 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
872 pincap = snd_hda_query_pin_caps(codec, nid);
873 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
874 /* if the default pin setup is vref50, we give it priority */
875 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
877 else if (pincap & AC_PINCAP_VREF_50)
879 else if (pincap & AC_PINCAP_VREF_100)
881 else if (pincap & AC_PINCAP_VREF_GRD)
884 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
887 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
889 struct alc_spec *spec = codec->spec;
890 struct auto_pin_cfg *cfg = &spec->autocfg;
892 if (!cfg->line_outs) {
893 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
894 cfg->line_out_pins[cfg->line_outs])
897 if (!cfg->speaker_outs) {
898 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
899 cfg->speaker_pins[cfg->speaker_outs])
903 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
904 cfg->hp_pins[cfg->hp_outs])
911 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
913 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
915 spec->mixers[spec->num_mixers++] = mix;
918 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
920 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
922 spec->init_verbs[spec->num_init_verbs++] = verb;
926 * set up from the preset table
928 static void setup_preset(struct hda_codec *codec,
929 const struct alc_config_preset *preset)
931 struct alc_spec *spec = codec->spec;
934 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
935 add_mixer(spec, preset->mixers[i]);
936 spec->cap_mixer = preset->cap_mixer;
937 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
939 add_verb(spec, preset->init_verbs[i]);
941 spec->channel_mode = preset->channel_mode;
942 spec->num_channel_mode = preset->num_channel_mode;
943 spec->need_dac_fix = preset->need_dac_fix;
944 spec->const_channel_count = preset->const_channel_count;
946 if (preset->const_channel_count)
947 spec->multiout.max_channels = preset->const_channel_count;
949 spec->multiout.max_channels = spec->channel_mode[0].channels;
950 spec->ext_channel_count = spec->channel_mode[0].channels;
952 spec->multiout.num_dacs = preset->num_dacs;
953 spec->multiout.dac_nids = preset->dac_nids;
954 spec->multiout.dig_out_nid = preset->dig_out_nid;
955 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
956 spec->multiout.hp_nid = preset->hp_nid;
958 spec->num_mux_defs = preset->num_mux_defs;
959 if (!spec->num_mux_defs)
960 spec->num_mux_defs = 1;
961 spec->input_mux = preset->input_mux;
963 spec->num_adc_nids = preset->num_adc_nids;
964 spec->adc_nids = preset->adc_nids;
965 spec->capsrc_nids = preset->capsrc_nids;
966 spec->dig_in_nid = preset->dig_in_nid;
968 spec->unsol_event = preset->unsol_event;
969 spec->init_hook = preset->init_hook;
970 #ifdef CONFIG_SND_HDA_POWER_SAVE
971 spec->power_hook = preset->power_hook;
972 spec->loopback.amplist = preset->loopbacks;
976 preset->setup(codec);
978 alc_fixup_autocfg_pin_nums(codec);
981 /* Enable GPIO mask and set output */
982 static struct hda_verb alc_gpio1_init_verbs[] = {
983 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
984 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
985 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
989 static struct hda_verb alc_gpio2_init_verbs[] = {
990 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
991 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
992 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
996 static struct hda_verb alc_gpio3_init_verbs[] = {
997 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
998 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
999 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
1004 * Fix hardware PLL issue
1005 * On some codecs, the analog PLL gating control must be off while
1006 * the default value is 1.
1008 static void alc_fix_pll(struct hda_codec *codec)
1010 struct alc_spec *spec = codec->spec;
1015 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1016 spec->pll_coef_idx);
1017 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1018 AC_VERB_GET_PROC_COEF, 0);
1019 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1020 spec->pll_coef_idx);
1021 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1022 val & ~(1 << spec->pll_coef_bit));
1025 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1026 unsigned int coef_idx, unsigned int coef_bit)
1028 struct alc_spec *spec = codec->spec;
1029 spec->pll_nid = nid;
1030 spec->pll_coef_idx = coef_idx;
1031 spec->pll_coef_bit = coef_bit;
1035 #ifdef CONFIG_SND_HDA_INPUT_JACK
1036 static void alc_free_jack_priv(struct snd_jack *jack)
1038 struct alc_jack *jacks = jack->private_data;
1043 static int alc_add_jack(struct hda_codec *codec,
1044 hda_nid_t nid, int type)
1046 struct alc_spec *spec;
1047 struct alc_jack *jack;
1052 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1053 jack = snd_array_new(&spec->jacks);
1059 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1061 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1064 jack->jack->private_data = jack;
1065 jack->jack->private_free = alc_free_jack_priv;
1069 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1071 struct alc_spec *spec = codec->spec;
1072 struct alc_jack *jacks = spec->jacks.list;
1076 for (i = 0; i < spec->jacks.used; i++) {
1077 if (jacks->nid == nid) {
1078 unsigned int present;
1079 present = snd_hda_jack_detect(codec, nid);
1081 present = (present) ? jacks->type : 0;
1083 snd_jack_report(jacks->jack, present);
1090 static int alc_init_jacks(struct hda_codec *codec)
1092 struct alc_spec *spec = codec->spec;
1094 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1095 unsigned int mic_nid = spec->ext_mic.pin;
1098 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1101 alc_report_jack(codec, hp_nid);
1105 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1108 alc_report_jack(codec, mic_nid);
1114 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1118 static inline int alc_init_jacks(struct hda_codec *codec)
1124 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1126 struct alc_spec *spec = codec->spec;
1131 spec->jack_present = 0;
1132 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1133 nid = spec->autocfg.hp_pins[i];
1136 alc_report_jack(codec, nid);
1137 spec->jack_present |= snd_hda_jack_detect(codec, nid);
1140 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1141 /* Toggle internal speakers muting */
1142 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1143 nid = spec->autocfg.speaker_pins[i];
1147 snd_hda_codec_write(codec, nid, 0,
1148 AC_VERB_SET_PIN_WIDGET_CONTROL,
1149 spec->jack_present ? 0 : PIN_OUT);
1151 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1152 HDA_AMP_MUTE, mute);
1157 static void alc_automute_pin(struct hda_codec *codec)
1159 alc_automute_speaker(codec, 1);
1162 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1165 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1168 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1169 for (i = 0; i < nums; i++)
1175 /* switch the current ADC according to the jack state */
1176 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1178 struct alc_spec *spec = codec->spec;
1179 unsigned int present;
1182 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1184 spec->cur_adc_idx = 1;
1186 spec->cur_adc_idx = 0;
1187 new_adc = spec->adc_nids[spec->cur_adc_idx];
1188 if (spec->cur_adc && spec->cur_adc != new_adc) {
1189 /* stream is running, let's swap the current ADC */
1190 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1191 spec->cur_adc = new_adc;
1192 snd_hda_codec_setup_stream(codec, new_adc,
1193 spec->cur_adc_stream_tag, 0,
1194 spec->cur_adc_format);
1198 static void alc_mic_automute(struct hda_codec *codec)
1200 struct alc_spec *spec = codec->spec;
1201 struct alc_mic_route *dead, *alive;
1202 unsigned int present, type;
1205 if (!spec->auto_mic)
1207 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1209 if (snd_BUG_ON(!spec->adc_nids))
1212 if (spec->dual_adc_switch) {
1213 alc_dual_mic_adc_auto_switch(codec);
1217 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1219 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1221 alive = &spec->ext_mic;
1222 dead = &spec->int_mic;
1224 alive = &spec->int_mic;
1225 dead = &spec->ext_mic;
1228 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1229 if (type == AC_WID_AUD_MIX) {
1230 /* Matrix-mixer style (e.g. ALC882) */
1231 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1234 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1236 HDA_AMP_MUTE, HDA_AMP_MUTE);
1238 /* MUX style (e.g. ALC880) */
1239 snd_hda_codec_write_cache(codec, cap_nid, 0,
1240 AC_VERB_SET_CONNECT_SEL,
1243 alc_report_jack(codec, spec->ext_mic.pin);
1245 /* FIXME: analog mixer */
1248 /* unsolicited event for HP jack sensing */
1249 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1251 if (codec->vendor_id == 0x10ec0880)
1256 case ALC880_HP_EVENT:
1257 alc_automute_pin(codec);
1259 case ALC880_MIC_EVENT:
1260 alc_mic_automute(codec);
1265 static void alc_inithook(struct hda_codec *codec)
1267 alc_automute_pin(codec);
1268 alc_mic_automute(codec);
1271 /* additional initialization for ALC888 variants */
1272 static void alc888_coef_init(struct hda_codec *codec)
1276 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1277 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1278 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1279 if ((tmp & 0xf0) == 0x20)
1281 snd_hda_codec_read(codec, 0x20, 0,
1282 AC_VERB_SET_PROC_COEF, 0x830);
1285 snd_hda_codec_read(codec, 0x20, 0,
1286 AC_VERB_SET_PROC_COEF, 0x3030);
1289 static void alc889_coef_init(struct hda_codec *codec)
1293 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1294 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1295 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1296 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1299 /* turn on/off EAPD control (only if available) */
1300 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1302 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1304 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1305 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1309 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1314 case ALC_INIT_GPIO1:
1315 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1317 case ALC_INIT_GPIO2:
1318 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1320 case ALC_INIT_GPIO3:
1321 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1323 case ALC_INIT_DEFAULT:
1324 switch (codec->vendor_id) {
1326 set_eapd(codec, 0x0f, 1);
1327 set_eapd(codec, 0x10, 1);
1340 set_eapd(codec, 0x14, 1);
1341 set_eapd(codec, 0x15, 1);
1344 switch (codec->vendor_id) {
1346 snd_hda_codec_write(codec, 0x1a, 0,
1347 AC_VERB_SET_COEF_INDEX, 7);
1348 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1349 AC_VERB_GET_PROC_COEF, 0);
1350 snd_hda_codec_write(codec, 0x1a, 0,
1351 AC_VERB_SET_COEF_INDEX, 7);
1352 snd_hda_codec_write(codec, 0x1a, 0,
1353 AC_VERB_SET_PROC_COEF,
1363 alc889_coef_init(codec);
1366 alc888_coef_init(codec);
1368 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1371 snd_hda_codec_write(codec, 0x20, 0,
1372 AC_VERB_SET_COEF_INDEX, 7);
1373 tmp = snd_hda_codec_read(codec, 0x20, 0,
1374 AC_VERB_GET_PROC_COEF, 0);
1375 snd_hda_codec_write(codec, 0x20, 0,
1376 AC_VERB_SET_COEF_INDEX, 7);
1377 snd_hda_codec_write(codec, 0x20, 0,
1378 AC_VERB_SET_PROC_COEF,
1387 static void alc_init_auto_hp(struct hda_codec *codec)
1389 struct alc_spec *spec = codec->spec;
1390 struct auto_pin_cfg *cfg = &spec->autocfg;
1393 if (!cfg->hp_pins[0]) {
1394 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1398 if (!cfg->speaker_pins[0]) {
1399 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1401 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1402 sizeof(cfg->speaker_pins));
1403 cfg->speaker_outs = cfg->line_outs;
1406 if (!cfg->hp_pins[0]) {
1407 memcpy(cfg->hp_pins, cfg->line_out_pins,
1408 sizeof(cfg->hp_pins));
1409 cfg->hp_outs = cfg->line_outs;
1412 for (i = 0; i < cfg->hp_outs; i++) {
1413 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1415 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1416 AC_VERB_SET_UNSOLICITED_ENABLE,
1417 AC_USRSP_EN | ALC880_HP_EVENT);
1419 spec->unsol_event = alc_sku_unsol_event;
1422 static void alc_init_auto_mic(struct hda_codec *codec)
1424 struct alc_spec *spec = codec->spec;
1425 struct auto_pin_cfg *cfg = &spec->autocfg;
1426 hda_nid_t fixed, ext;
1429 /* there must be only two mic inputs exclusively */
1430 for (i = 0; i < cfg->num_inputs; i++)
1431 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1435 for (i = 0; i < cfg->num_inputs; i++) {
1436 hda_nid_t nid = cfg->inputs[i].pin;
1437 unsigned int defcfg;
1438 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1439 switch (snd_hda_get_input_pin_attr(defcfg)) {
1440 case INPUT_PIN_ATTR_INT:
1442 return; /* already occupied */
1445 case INPUT_PIN_ATTR_UNUSED:
1446 return; /* invalid entry */
1449 return; /* already occupied */
1456 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1457 return; /* no unsol support */
1458 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1460 spec->ext_mic.pin = ext;
1461 spec->int_mic.pin = fixed;
1462 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1463 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1465 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1466 AC_VERB_SET_UNSOLICITED_ENABLE,
1467 AC_USRSP_EN | ALC880_MIC_EVENT);
1468 spec->unsol_event = alc_sku_unsol_event;
1471 /* Could be any non-zero and even value. When used as fixup, tells
1472 * the driver to ignore any present sku defines.
1474 #define ALC_FIXUP_SKU_IGNORE (2)
1476 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1478 unsigned int ass, tmp, i;
1480 struct alc_spec *spec = codec->spec;
1482 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1484 if (spec->cdefine.fixup) {
1485 ass = spec->cdefine.sku_cfg;
1486 if (ass == ALC_FIXUP_SKU_IGNORE)
1491 ass = codec->subsystem_id & 0xffff;
1492 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1496 if (codec->vendor_id == 0x10ec0260)
1498 ass = snd_hda_codec_get_pincfg(codec, nid);
1501 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1502 codec->chip_name, ass);
1508 for (i = 1; i < 16; i++) {
1512 if (((ass >> 16) & 0xf) != tmp)
1515 spec->cdefine.port_connectivity = ass >> 30;
1516 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1517 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1518 spec->cdefine.customization = ass >> 8;
1520 spec->cdefine.sku_cfg = ass;
1521 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1522 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1523 spec->cdefine.swap = (ass & 0x2) >> 1;
1524 spec->cdefine.override = ass & 0x1;
1526 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1527 nid, spec->cdefine.sku_cfg);
1528 snd_printd("SKU: port_connectivity=0x%x\n",
1529 spec->cdefine.port_connectivity);
1530 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1531 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1532 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1533 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1534 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1535 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1536 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1541 /* check subsystem ID and set up device-specific initialization;
1542 * return 1 if initialized, 0 if invalid SSID
1544 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1545 * 31 ~ 16 : Manufacture ID
1547 * 7 ~ 0 : Assembly ID
1548 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1550 static int alc_subsystem_id(struct hda_codec *codec,
1551 hda_nid_t porta, hda_nid_t porte,
1552 hda_nid_t portd, hda_nid_t porti)
1554 unsigned int ass, tmp, i;
1556 struct alc_spec *spec = codec->spec;
1558 if (spec->cdefine.fixup) {
1559 ass = spec->cdefine.sku_cfg;
1560 if (ass == ALC_FIXUP_SKU_IGNORE)
1565 ass = codec->subsystem_id & 0xffff;
1566 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1569 /* invalid SSID, check the special NID pin defcfg instead */
1571 * 31~30 : port connectivity
1574 * 19~16 : Check sum (15:1)
1579 if (codec->vendor_id == 0x10ec0260)
1581 ass = snd_hda_codec_get_pincfg(codec, nid);
1582 snd_printd("realtek: No valid SSID, "
1583 "checking pincfg 0x%08x for NID 0x%x\n",
1587 if ((ass >> 30) != 1) /* no physical connection */
1592 for (i = 1; i < 16; i++) {
1596 if (((ass >> 16) & 0xf) != tmp)
1599 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1600 ass & 0xffff, codec->vendor_id);
1604 * 2 : 0 --> Desktop, 1 --> Laptop
1605 * 3~5 : External Amplifier control
1608 tmp = (ass & 0x38) >> 3; /* external Amp control */
1611 spec->init_amp = ALC_INIT_GPIO1;
1614 spec->init_amp = ALC_INIT_GPIO2;
1617 spec->init_amp = ALC_INIT_GPIO3;
1621 spec->init_amp = ALC_INIT_DEFAULT;
1625 /* is laptop or Desktop and enable the function "Mute internal speaker
1626 * when the external headphone out jack is plugged"
1628 if (!(ass & 0x8000))
1631 * 10~8 : Jack location
1632 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1634 * 15 : 1 --> enable the function "Mute internal speaker
1635 * when the external headphone out jack is plugged"
1637 if (!spec->autocfg.hp_pins[0]) {
1639 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1650 for (i = 0; i < spec->autocfg.line_outs; i++)
1651 if (spec->autocfg.line_out_pins[i] == nid)
1653 spec->autocfg.hp_pins[0] = nid;
1656 alc_init_auto_hp(codec);
1657 alc_init_auto_mic(codec);
1661 static void alc_ssid_check(struct hda_codec *codec,
1662 hda_nid_t porta, hda_nid_t porte,
1663 hda_nid_t portd, hda_nid_t porti)
1665 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1666 struct alc_spec *spec = codec->spec;
1667 snd_printd("realtek: "
1668 "Enable default setup for auto mode as fallback\n");
1669 spec->init_amp = ALC_INIT_DEFAULT;
1670 alc_init_auto_hp(codec);
1671 alc_init_auto_mic(codec);
1676 * Fix-up pin default configurations and add default verbs
1684 struct alc_model_fixup {
1695 const struct alc_pincfg *pins;
1696 const struct hda_verb *verbs;
1697 void (*func)(struct hda_codec *codec,
1698 const struct alc_fixup *fix,
1712 ALC_FIXUP_ACT_PRE_PROBE,
1713 ALC_FIXUP_ACT_PROBE,
1717 static void alc_apply_fixup(struct hda_codec *codec, int action)
1719 struct alc_spec *spec = codec->spec;
1720 int id = spec->fixup_id;
1721 #ifdef CONFIG_SND_DEBUG_VERBOSE
1722 const char *modelname = spec->fixup_name;
1726 if (!spec->fixup_list)
1730 const struct alc_fixup *fix = spec->fixup_list + id;
1731 const struct alc_pincfg *cfg;
1733 switch (fix->type) {
1735 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1737 snd_printdd(KERN_INFO "hda_codec: %s: "
1738 "Apply sku override for %s\n",
1739 codec->chip_name, modelname);
1740 spec->cdefine.sku_cfg = fix->v.sku;
1741 spec->cdefine.fixup = 1;
1743 case ALC_FIXUP_PINS:
1745 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1747 snd_printdd(KERN_INFO "hda_codec: %s: "
1748 "Apply pincfg for %s\n",
1749 codec->chip_name, modelname);
1750 for (; cfg->nid; cfg++)
1751 snd_hda_codec_set_pincfg(codec, cfg->nid,
1754 case ALC_FIXUP_VERBS:
1755 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1757 snd_printdd(KERN_INFO "hda_codec: %s: "
1758 "Apply fix-verbs for %s\n",
1759 codec->chip_name, modelname);
1760 add_verb(codec->spec, fix->v.verbs);
1762 case ALC_FIXUP_FUNC:
1765 snd_printdd(KERN_INFO "hda_codec: %s: "
1766 "Apply fix-func for %s\n",
1767 codec->chip_name, modelname);
1768 fix->v.func(codec, fix, action);
1771 snd_printk(KERN_ERR "hda_codec: %s: "
1772 "Invalid fixup type %d\n",
1773 codec->chip_name, fix->type);
1776 if (!fix[id].chained)
1780 id = fix[id].chain_id;
1784 static void alc_pick_fixup(struct hda_codec *codec,
1785 const struct alc_model_fixup *models,
1786 const struct snd_pci_quirk *quirk,
1787 const struct alc_fixup *fixlist)
1789 struct alc_spec *spec = codec->spec;
1791 const char *name = NULL;
1793 if (codec->modelname && models) {
1794 while (models->name) {
1795 if (!strcmp(codec->modelname, models->name)) {
1797 name = models->name;
1804 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1807 #ifdef CONFIG_SND_DEBUG_VERBOSE
1813 spec->fixup_id = id;
1815 spec->fixup_list = fixlist;
1816 spec->fixup_name = name;
1820 static int alc_read_coef_idx(struct hda_codec *codec,
1821 unsigned int coef_idx)
1824 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1826 val = snd_hda_codec_read(codec, 0x20, 0,
1827 AC_VERB_GET_PROC_COEF, 0);
1831 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1832 unsigned int coef_val)
1834 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1836 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1840 /* set right pin controls for digital I/O */
1841 static void alc_auto_init_digital(struct hda_codec *codec)
1843 struct alc_spec *spec = codec->spec;
1847 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1848 pin = spec->autocfg.dig_out_pins[i];
1850 snd_hda_codec_write(codec, pin, 0,
1851 AC_VERB_SET_PIN_WIDGET_CONTROL,
1855 pin = spec->autocfg.dig_in_pin;
1857 snd_hda_codec_write(codec, pin, 0,
1858 AC_VERB_SET_PIN_WIDGET_CONTROL,
1862 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1863 static void alc_auto_parse_digital(struct hda_codec *codec)
1865 struct alc_spec *spec = codec->spec;
1869 /* support multiple SPDIFs; the secondary is set up as a slave */
1870 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1871 err = snd_hda_get_connections(codec,
1872 spec->autocfg.dig_out_pins[i],
1877 spec->multiout.dig_out_nid = dig_nid;
1878 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1880 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1881 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1883 spec->slave_dig_outs[i - 1] = dig_nid;
1887 if (spec->autocfg.dig_in_pin) {
1888 dig_nid = codec->start_nid;
1889 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1890 unsigned int wcaps = get_wcaps(codec, dig_nid);
1891 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1893 if (!(wcaps & AC_WCAP_DIGITAL))
1895 if (!(wcaps & AC_WCAP_CONN_LIST))
1897 err = get_connection_index(codec, dig_nid,
1898 spec->autocfg.dig_in_pin);
1900 spec->dig_in_nid = dig_nid;
1914 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1915 /* Mic-in jack as mic in */
1916 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1917 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1918 /* Line-in jack as Line in */
1919 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1920 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1921 /* Line-Out as Front */
1922 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1929 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1930 /* Mic-in jack as mic in */
1931 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1932 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1933 /* Line-in jack as Surround */
1934 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1935 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1936 /* Line-Out as Front */
1937 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1944 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1945 /* Mic-in jack as CLFE */
1946 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1947 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1948 /* Line-in jack as Surround */
1949 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1950 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1951 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1952 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1959 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1960 /* Mic-in jack as CLFE */
1961 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1962 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1963 /* Line-in jack as Surround */
1964 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1965 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1966 /* Line-Out as Side */
1967 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1971 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1972 { 2, alc888_4ST_ch2_intel_init },
1973 { 4, alc888_4ST_ch4_intel_init },
1974 { 6, alc888_4ST_ch6_intel_init },
1975 { 8, alc888_4ST_ch8_intel_init },
1979 * ALC888 Fujitsu Siemens Amillo xa3530
1982 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1983 /* Front Mic: set to PIN_IN (empty by default) */
1984 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1985 /* Connect Internal HP to Front */
1986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1989 /* Connect Bass HP to Front */
1990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1992 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1993 /* Connect Line-Out side jack (SPDIF) to Side */
1994 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1995 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1996 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1997 /* Connect Mic jack to CLFE */
1998 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2000 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2001 /* Connect Line-in jack to Surround */
2002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2004 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2005 /* Connect HP out jack to Front */
2006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2007 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2008 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2009 /* Enable unsolicited event for HP jack and Line-out jack */
2010 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2011 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2015 static void alc_automute_amp(struct hda_codec *codec)
2017 alc_automute_speaker(codec, 0);
2020 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
2023 if (codec->vendor_id == 0x10ec0880)
2027 if (res == ALC880_HP_EVENT)
2028 alc_automute_amp(codec);
2031 static void alc889_automute_setup(struct hda_codec *codec)
2033 struct alc_spec *spec = codec->spec;
2035 spec->autocfg.hp_pins[0] = 0x15;
2036 spec->autocfg.speaker_pins[0] = 0x14;
2037 spec->autocfg.speaker_pins[1] = 0x16;
2038 spec->autocfg.speaker_pins[2] = 0x17;
2039 spec->autocfg.speaker_pins[3] = 0x19;
2040 spec->autocfg.speaker_pins[4] = 0x1a;
2043 static void alc889_intel_init_hook(struct hda_codec *codec)
2045 alc889_coef_init(codec);
2046 alc_automute_amp(codec);
2049 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2051 struct alc_spec *spec = codec->spec;
2053 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2054 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2055 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2056 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2060 * ALC888 Acer Aspire 4930G model
2063 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2064 /* Front Mic: set to PIN_IN (empty by default) */
2065 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2066 /* Unselect Front Mic by default in input mixer 3 */
2067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2068 /* Enable unsolicited event for HP jack */
2069 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2070 /* Connect Internal HP to front */
2071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2072 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2073 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2074 /* Connect HP out to front */
2075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2077 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2078 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2083 * ALC888 Acer Aspire 6530G model
2086 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2087 /* Route to built-in subwoofer as well as speakers */
2088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2092 /* Bias voltage on for external mic port */
2093 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2094 /* Front Mic: set to PIN_IN (empty by default) */
2095 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2096 /* Unselect Front Mic by default in input mixer 3 */
2097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2098 /* Enable unsolicited event for HP jack */
2099 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2100 /* Enable speaker output */
2101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2102 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2103 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2104 /* Enable headphone output */
2105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2107 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2108 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2113 *ALC888 Acer Aspire 7730G model
2116 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2117 /* Bias voltage on for external mic port */
2118 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2119 /* Front Mic: set to PIN_IN (empty by default) */
2120 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2121 /* Unselect Front Mic by default in input mixer 3 */
2122 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2123 /* Enable unsolicited event for HP jack */
2124 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2125 /* Enable speaker output */
2126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2128 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2129 /* Enable headphone output */
2130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2132 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2133 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2134 /*Enable internal subwoofer */
2135 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2136 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2137 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2138 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2143 * ALC889 Acer Aspire 8930G model
2146 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2147 /* Front Mic: set to PIN_IN (empty by default) */
2148 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2149 /* Unselect Front Mic by default in input mixer 3 */
2150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2151 /* Enable unsolicited event for HP jack */
2152 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2153 /* Connect Internal Front to Front */
2154 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2156 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2157 /* Connect Internal Rear to Rear */
2158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2159 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2160 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2161 /* Connect Internal CLFE to CLFE */
2162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2163 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2164 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2165 /* Connect HP out to Front */
2166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2169 /* Enable all DACs */
2170 /* DAC DISABLE/MUTE 1? */
2171 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2172 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2173 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2174 /* DAC DISABLE/MUTE 2? */
2175 /* some bit here disables the other DACs. Init=0x4900 */
2176 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2177 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2179 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2180 * which makes the stereo useless. However, either the mic or the ALC889
2181 * makes the signal become a difference/sum signal instead of standard
2182 * stereo, which is annoying. So instead we flip this bit which makes the
2183 * codec replicate the sum signal to both channels, turning it into a
2186 /* DMIC_CONTROL? Init value = 0x0001 */
2187 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2188 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2192 static struct hda_input_mux alc888_2_capture_sources[2] = {
2193 /* Front mic only available on one ADC */
2200 { "Front Mic", 0xb },
2213 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2214 /* Interal mic only available on one ADC */
2221 { "Input Mix", 0xa },
2222 { "Internal Mic", 0xb },
2231 { "Input Mix", 0xa },
2236 static struct hda_input_mux alc889_capture_sources[3] = {
2237 /* Digital mic only available on first "ADC" */
2244 { "Front Mic", 0xb },
2245 { "Input Mix", 0xa },
2254 { "Input Mix", 0xa },
2263 { "Input Mix", 0xa },
2268 static struct snd_kcontrol_new alc888_base_mixer[] = {
2269 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2271 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2272 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2273 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2277 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2279 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2290 static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2293 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2294 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2295 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0,
2297 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT),
2298 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2299 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2300 HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2301 HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT),
2302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2304 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2305 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2313 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2314 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2315 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2317 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2318 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2320 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2321 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2322 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2323 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2324 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2326 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2332 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2334 struct alc_spec *spec = codec->spec;
2336 spec->autocfg.hp_pins[0] = 0x15;
2337 spec->autocfg.speaker_pins[0] = 0x14;
2338 spec->autocfg.speaker_pins[1] = 0x16;
2339 spec->autocfg.speaker_pins[2] = 0x17;
2342 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2344 struct alc_spec *spec = codec->spec;
2346 spec->autocfg.hp_pins[0] = 0x15;
2347 spec->autocfg.speaker_pins[0] = 0x14;
2348 spec->autocfg.speaker_pins[1] = 0x16;
2349 spec->autocfg.speaker_pins[2] = 0x17;
2352 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2354 struct alc_spec *spec = codec->spec;
2356 spec->autocfg.hp_pins[0] = 0x15;
2357 spec->autocfg.speaker_pins[0] = 0x14;
2358 spec->autocfg.speaker_pins[1] = 0x16;
2359 spec->autocfg.speaker_pins[2] = 0x17;
2362 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2364 struct alc_spec *spec = codec->spec;
2366 spec->autocfg.hp_pins[0] = 0x15;
2367 spec->autocfg.speaker_pins[0] = 0x14;
2368 spec->autocfg.speaker_pins[1] = 0x16;
2369 spec->autocfg.speaker_pins[2] = 0x1b;
2373 * ALC880 3-stack model
2375 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2376 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2377 * F-Mic = 0x1b, HP = 0x19
2380 static hda_nid_t alc880_dac_nids[4] = {
2381 /* front, rear, clfe, rear_surr */
2382 0x02, 0x05, 0x04, 0x03
2385 static hda_nid_t alc880_adc_nids[3] = {
2390 /* The datasheet says the node 0x07 is connected from inputs,
2391 * but it shows zero connection in the real implementation on some devices.
2392 * Note: this is a 915GAV bug, fixed on 915GLV
2394 static hda_nid_t alc880_adc_nids_alt[2] = {
2399 #define ALC880_DIGOUT_NID 0x06
2400 #define ALC880_DIGIN_NID 0x0a
2402 static struct hda_input_mux alc880_capture_source = {
2406 { "Front Mic", 0x3 },
2412 /* channel source setting (2/6 channel selection for 3-stack) */
2414 static struct hda_verb alc880_threestack_ch2_init[] = {
2415 /* set line-in to input, mute it */
2416 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2417 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2418 /* set mic-in to input vref 80%, mute it */
2419 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2420 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2425 static struct hda_verb alc880_threestack_ch6_init[] = {
2426 /* set line-in to output, unmute it */
2427 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2428 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2429 /* set mic-in to output, unmute it */
2430 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2431 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2435 static struct hda_channel_mode alc880_threestack_modes[2] = {
2436 { 2, alc880_threestack_ch2_init },
2437 { 6, alc880_threestack_ch6_init },
2440 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2441 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2442 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2443 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2444 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2445 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2446 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2447 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2448 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2453 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2454 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2455 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2456 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2457 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2459 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2460 .name = "Channel Mode",
2461 .info = alc_ch_mode_info,
2462 .get = alc_ch_mode_get,
2463 .put = alc_ch_mode_put,
2468 /* capture mixer elements */
2469 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2470 struct snd_ctl_elem_info *uinfo)
2472 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2473 struct alc_spec *spec = codec->spec;
2476 mutex_lock(&codec->control_mutex);
2477 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2479 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2480 mutex_unlock(&codec->control_mutex);
2484 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2485 unsigned int size, unsigned int __user *tlv)
2487 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2488 struct alc_spec *spec = codec->spec;
2491 mutex_lock(&codec->control_mutex);
2492 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2494 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2495 mutex_unlock(&codec->control_mutex);
2499 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2500 struct snd_ctl_elem_value *ucontrol);
2502 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2503 struct snd_ctl_elem_value *ucontrol,
2506 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2507 struct alc_spec *spec = codec->spec;
2508 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2511 mutex_lock(&codec->control_mutex);
2512 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2514 err = func(kcontrol, ucontrol);
2515 mutex_unlock(&codec->control_mutex);
2519 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2520 struct snd_ctl_elem_value *ucontrol)
2522 return alc_cap_getput_caller(kcontrol, ucontrol,
2523 snd_hda_mixer_amp_volume_get);
2526 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2527 struct snd_ctl_elem_value *ucontrol)
2529 return alc_cap_getput_caller(kcontrol, ucontrol,
2530 snd_hda_mixer_amp_volume_put);
2533 /* capture mixer elements */
2534 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2536 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2537 struct snd_ctl_elem_value *ucontrol)
2539 return alc_cap_getput_caller(kcontrol, ucontrol,
2540 snd_hda_mixer_amp_switch_get);
2543 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2544 struct snd_ctl_elem_value *ucontrol)
2546 return alc_cap_getput_caller(kcontrol, ucontrol,
2547 snd_hda_mixer_amp_switch_put);
2550 #define _DEFINE_CAPMIX(num) \
2552 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2553 .name = "Capture Switch", \
2554 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2556 .info = alc_cap_sw_info, \
2557 .get = alc_cap_sw_get, \
2558 .put = alc_cap_sw_put, \
2561 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2562 .name = "Capture Volume", \
2563 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2564 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2565 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2567 .info = alc_cap_vol_info, \
2568 .get = alc_cap_vol_get, \
2569 .put = alc_cap_vol_put, \
2570 .tlv = { .c = alc_cap_vol_tlv }, \
2573 #define _DEFINE_CAPSRC(num) \
2575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2576 /* .name = "Capture Source", */ \
2577 .name = "Input Source", \
2579 .info = alc_mux_enum_info, \
2580 .get = alc_mux_enum_get, \
2581 .put = alc_mux_enum_put, \
2584 #define DEFINE_CAPMIX(num) \
2585 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2586 _DEFINE_CAPMIX(num), \
2587 _DEFINE_CAPSRC(num), \
2591 #define DEFINE_CAPMIX_NOSRC(num) \
2592 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2593 _DEFINE_CAPMIX(num), \
2597 /* up to three ADCs */
2601 DEFINE_CAPMIX_NOSRC(1);
2602 DEFINE_CAPMIX_NOSRC(2);
2603 DEFINE_CAPMIX_NOSRC(3);
2606 * ALC880 5-stack model
2608 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2610 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2611 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2614 /* additional mixers to alc880_three_stack_mixer */
2615 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2616 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2617 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2621 /* channel source setting (6/8 channel selection for 5-stack) */
2623 static struct hda_verb alc880_fivestack_ch6_init[] = {
2624 /* set line-in to input, mute it */
2625 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2626 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2631 static struct hda_verb alc880_fivestack_ch8_init[] = {
2632 /* set line-in to output, unmute it */
2633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2638 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2639 { 6, alc880_fivestack_ch6_init },
2640 { 8, alc880_fivestack_ch8_init },
2645 * ALC880 6-stack model
2647 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2648 * Side = 0x05 (0x0f)
2649 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2650 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2653 static hda_nid_t alc880_6st_dac_nids[4] = {
2654 /* front, rear, clfe, rear_surr */
2655 0x02, 0x03, 0x04, 0x05
2658 static struct hda_input_mux alc880_6stack_capture_source = {
2662 { "Front Mic", 0x1 },
2668 /* fixed 8-channels */
2669 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2673 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2674 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2676 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2677 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2678 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2679 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2680 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2681 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2682 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2683 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2686 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2687 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2690 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2691 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2693 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2694 .name = "Channel Mode",
2695 .info = alc_ch_mode_info,
2696 .get = alc_ch_mode_get,
2697 .put = alc_ch_mode_put,
2706 * W810 has rear IO for:
2709 * Center/LFE (DAC 04)
2712 * The system also has a pair of internal speakers, and a headphone jack.
2713 * These are both connected to Line2 on the codec, hence to DAC 02.
2715 * There is a variable resistor to control the speaker or headphone
2716 * volume. This is a hardware-only device without a software API.
2718 * Plugging headphones in will disable the internal speakers. This is
2719 * implemented in hardware, not via the driver using jack sense. In
2720 * a similar fashion, plugging into the rear socket marked "front" will
2721 * disable both the speakers and headphones.
2723 * For input, there's a microphone jack, and an "audio in" jack.
2724 * These may not do anything useful with this driver yet, because I
2725 * haven't setup any initialization verbs for these yet...
2728 static hda_nid_t alc880_w810_dac_nids[3] = {
2729 /* front, rear/surround, clfe */
2733 /* fixed 6 channels */
2734 static struct hda_channel_mode alc880_w810_modes[1] = {
2738 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2739 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2740 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2741 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2742 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2743 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2744 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2745 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2746 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2747 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2748 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2756 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2757 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2761 static hda_nid_t alc880_z71v_dac_nids[1] = {
2764 #define ALC880_Z71V_HP_DAC 0x03
2766 /* fixed 2 channels */
2767 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2771 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2772 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2773 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2774 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2775 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2776 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2777 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2785 * ALC880 F1734 model
2787 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2788 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2791 static hda_nid_t alc880_f1734_dac_nids[1] = {
2794 #define ALC880_F1734_HP_DAC 0x02
2796 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2797 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2798 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2799 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2800 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2801 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2802 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2808 static struct hda_input_mux alc880_f1734_capture_source = {
2820 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2821 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2822 * Mic = 0x18, Line = 0x1a
2825 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2826 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2828 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2829 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2830 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2831 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2832 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2833 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2834 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2835 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2836 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2837 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2838 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2839 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2840 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2844 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2845 .name = "Channel Mode",
2846 .info = alc_ch_mode_info,
2847 .get = alc_ch_mode_get,
2848 .put = alc_ch_mode_put,
2854 * ALC880 ASUS W1V model
2856 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2857 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2858 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2861 /* additional mixers to alc880_asus_mixer */
2862 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2863 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2864 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2869 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2870 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2871 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2873 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2874 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2875 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2876 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2877 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2878 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2883 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2884 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2885 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2886 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2887 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2902 .name = "Channel Mode",
2903 .info = alc_ch_mode_info,
2904 .get = alc_ch_mode_get,
2905 .put = alc_ch_mode_put,
2910 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2911 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2912 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2913 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2914 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2919 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2920 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2924 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2925 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2926 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2927 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2928 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2935 * virtual master controls
2939 * slave controls for virtual master
2941 static const char * const alc_slave_vols[] = {
2942 "Front Playback Volume",
2943 "Surround Playback Volume",
2944 "Center Playback Volume",
2945 "LFE Playback Volume",
2946 "Side Playback Volume",
2947 "Headphone Playback Volume",
2948 "Speaker Playback Volume",
2949 "Mono Playback Volume",
2950 "Line-Out Playback Volume",
2951 "PCM Playback Volume",
2955 static const char * const alc_slave_sws[] = {
2956 "Front Playback Switch",
2957 "Surround Playback Switch",
2958 "Center Playback Switch",
2959 "LFE Playback Switch",
2960 "Side Playback Switch",
2961 "Headphone Playback Switch",
2962 "Speaker Playback Switch",
2963 "Mono Playback Switch",
2964 "IEC958 Playback Switch",
2965 "Line-Out Playback Switch",
2966 "PCM Playback Switch",
2971 * build control elements
2974 #define NID_MAPPING (-1)
2976 #define SUBDEV_SPEAKER_ (0 << 6)
2977 #define SUBDEV_HP_ (1 << 6)
2978 #define SUBDEV_LINE_ (2 << 6)
2979 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2980 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2981 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2983 static void alc_free_kctls(struct hda_codec *codec);
2985 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2986 /* additional beep mixers; the actual parameters are overwritten at build */
2987 static struct snd_kcontrol_new alc_beep_mixer[] = {
2988 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2989 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2994 static int alc_build_controls(struct hda_codec *codec)
2996 struct alc_spec *spec = codec->spec;
2997 struct snd_kcontrol *kctl = NULL;
2998 struct snd_kcontrol_new *knew;
3003 for (i = 0; i < spec->num_mixers; i++) {
3004 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3008 if (spec->cap_mixer) {
3009 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3013 if (spec->multiout.dig_out_nid) {
3014 err = snd_hda_create_spdif_out_ctls(codec,
3015 spec->multiout.dig_out_nid);
3018 if (!spec->no_analog) {
3019 err = snd_hda_create_spdif_share_sw(codec,
3023 spec->multiout.share_spdif = 1;
3026 if (spec->dig_in_nid) {
3027 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3032 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3033 /* create beep controls if needed */
3034 if (spec->beep_amp) {
3035 struct snd_kcontrol_new *knew;
3036 for (knew = alc_beep_mixer; knew->name; knew++) {
3037 struct snd_kcontrol *kctl;
3038 kctl = snd_ctl_new1(knew, codec);
3041 kctl->private_value = spec->beep_amp;
3042 err = snd_hda_ctl_add(codec, 0, kctl);
3049 /* if we have no master control, let's create it */
3050 if (!spec->no_analog &&
3051 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3052 unsigned int vmaster_tlv[4];
3053 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3054 HDA_OUTPUT, vmaster_tlv);
3055 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3056 vmaster_tlv, alc_slave_vols);
3060 if (!spec->no_analog &&
3061 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3062 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3063 NULL, alc_slave_sws);
3068 /* assign Capture Source enums to NID */
3069 if (spec->capsrc_nids || spec->adc_nids) {
3070 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3072 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3073 for (i = 0; kctl && i < kctl->count; i++) {
3074 hda_nid_t *nids = spec->capsrc_nids;
3076 nids = spec->adc_nids;
3077 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3082 if (spec->cap_mixer) {
3083 const char *kname = kctl ? kctl->id.name : NULL;
3084 for (knew = spec->cap_mixer; knew->name; knew++) {
3085 if (kname && strcmp(knew->name, kname) == 0)
3087 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3088 for (i = 0; kctl && i < kctl->count; i++) {
3089 err = snd_hda_add_nid(codec, kctl, i,
3097 /* other nid->control mapping */
3098 for (i = 0; i < spec->num_mixers; i++) {
3099 for (knew = spec->mixers[i]; knew->name; knew++) {
3100 if (knew->iface != NID_MAPPING)
3102 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3105 u = knew->subdevice;
3106 for (j = 0; j < 4; j++, u >>= 8) {
3111 case SUBDEV_SPEAKER_:
3112 nid = spec->autocfg.speaker_pins[nid];
3115 nid = spec->autocfg.line_out_pins[nid];
3118 nid = spec->autocfg.hp_pins[nid];
3123 err = snd_hda_add_nid(codec, kctl, 0, nid);
3127 u = knew->private_value;
3128 for (j = 0; j < 4; j++, u >>= 8) {
3132 err = snd_hda_add_nid(codec, kctl, 0, nid);
3139 alc_free_kctls(codec); /* no longer needed */
3146 * initialize the codec volumes, etc
3150 * generic initialization of ADC, input mixers and output mixers
3152 static struct hda_verb alc880_volume_init_verbs[] = {
3154 * Unmute ADC0-2 and set the default input to mic-in
3156 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3158 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3160 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3163 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3165 * Note: PASD motherboards uses the Line In 2 as the input for front
3168 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3178 * Set up output mixers (0x0c - 0x0f)
3180 /* set vol=0 to output mixers */
3181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3185 /* set up input amps for analog loopback */
3186 /* Amp Indices: DAC = 0, mixer = 1 */
3187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3193 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3194 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3200 * 3-stack pin configuration:
3201 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3203 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3205 * preset connection lists of input pins
3206 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3208 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3209 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3210 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3213 * Set pin mode and muting
3215 /* set front pin widgets 0x14 for output */
3216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3217 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3218 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3219 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3220 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3221 /* Mic2 (as headphone out) for HP output */
3222 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3223 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3224 /* Line In pin widget for input */
3225 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3226 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3227 /* Line2 (as front mic) pin widget for input and vref at 80% */
3228 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3229 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3230 /* CD pin widget for input */
3231 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3237 * 5-stack pin configuration:
3238 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3239 * line-in/side = 0x1a, f-mic = 0x1b
3241 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3243 * preset connection lists of input pins
3244 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3246 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3247 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3250 * Set pin mode and muting
3252 /* set pin widgets 0x14-0x17 for output */
3253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3255 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3256 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3257 /* unmute pins for output (no gain on this amp) */
3258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3263 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3265 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3266 /* Mic2 (as headphone out) for HP output */
3267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 /* Line In pin widget for input */
3270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3272 /* Line2 (as front mic) pin widget for input and vref at 80% */
3273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3274 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3275 /* CD pin widget for input */
3276 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3282 * W810 pin configuration:
3283 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3285 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3286 /* hphone/speaker input selector: front DAC */
3287 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3291 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3292 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3293 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3294 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3297 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3303 * Z71V pin configuration:
3304 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3306 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3307 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3308 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3312 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3314 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3315 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3321 * 6-stack pin configuration:
3322 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3323 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3325 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3326 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3332 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3333 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3334 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3335 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3339 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3340 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3341 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3343 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3344 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3345 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3351 * Uniwill pin configuration:
3352 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3355 static struct hda_verb alc880_uniwill_init_verbs[] = {
3356 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3359 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3363 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3364 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3365 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3368 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3369 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3371 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3373 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3375 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3379 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3380 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3381 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3384 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3391 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3393 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3394 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3396 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3398 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3400 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3401 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3409 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3410 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3411 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3412 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3416 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3417 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3422 static struct hda_verb alc880_beep_init_verbs[] = {
3423 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3427 /* auto-toggle front mic */
3428 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3430 unsigned int present;
3433 present = snd_hda_jack_detect(codec, 0x18);
3434 bits = present ? HDA_AMP_MUTE : 0;
3435 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3438 static void alc880_uniwill_setup(struct hda_codec *codec)
3440 struct alc_spec *spec = codec->spec;
3442 spec->autocfg.hp_pins[0] = 0x14;
3443 spec->autocfg.speaker_pins[0] = 0x15;
3444 spec->autocfg.speaker_pins[0] = 0x16;
3447 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3449 alc_automute_amp(codec);
3450 alc88x_simple_mic_automute(codec);
3453 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3456 /* Looks like the unsol event is incompatible with the standard
3457 * definition. 4bit tag is placed at 28 bit!
3459 switch (res >> 28) {
3460 case ALC880_MIC_EVENT:
3461 alc88x_simple_mic_automute(codec);
3464 alc_automute_amp_unsol_event(codec, res);
3469 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3471 struct alc_spec *spec = codec->spec;
3473 spec->autocfg.hp_pins[0] = 0x14;
3474 spec->autocfg.speaker_pins[0] = 0x15;
3477 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3479 unsigned int present;
3481 present = snd_hda_codec_read(codec, 0x21, 0,
3482 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3483 present &= HDA_AMP_VOLMASK;
3484 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3485 HDA_AMP_VOLMASK, present);
3486 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3487 HDA_AMP_VOLMASK, present);
3490 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3493 /* Looks like the unsol event is incompatible with the standard
3494 * definition. 4bit tag is placed at 28 bit!
3496 if ((res >> 28) == ALC880_DCVOL_EVENT)
3497 alc880_uniwill_p53_dcvol_automute(codec);
3499 alc_automute_amp_unsol_event(codec, res);
3503 * F1734 pin configuration:
3504 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3506 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3507 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3508 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3509 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3510 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3511 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3518 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3520 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3522 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3525 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3528 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3529 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3535 * ASUS pin configuration:
3536 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3538 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3539 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3540 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3541 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3542 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3545 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3548 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3549 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3550 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3551 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3553 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3555 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3559 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3561 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3566 /* Enable GPIO mask and set output */
3567 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3568 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3569 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3571 /* Clevo m520g init */
3572 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3573 /* headphone output */
3574 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3576 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3577 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3579 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3580 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3582 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3583 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3584 /* Mic1 (rear panel) */
3585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3586 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3587 /* Mic2 (front panel) */
3588 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3589 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3591 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3592 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3593 /* change to EAPD mode */
3594 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3595 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3600 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3601 /* change to EAPD mode */
3602 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3603 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3605 /* Headphone output */
3606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3608 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3609 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3611 /* Line In pin widget for input */
3612 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3613 /* CD pin widget for input */
3614 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3615 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3616 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3618 /* change to EAPD mode */
3619 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3620 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3626 * LG m1 express dual
3629 * Rear Line-In/Out (blue): 0x14
3630 * Build-in Mic-In: 0x15
3632 * HP-Out (green): 0x1b
3633 * Mic-In/Out (red): 0x19
3637 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3638 static hda_nid_t alc880_lg_dac_nids[3] = {
3642 /* seems analog CD is not working */
3643 static struct hda_input_mux alc880_lg_capture_source = {
3648 { "Internal Mic", 0x6 },
3652 /* 2,4,6 channel modes */
3653 static struct hda_verb alc880_lg_ch2_init[] = {
3654 /* set line-in and mic-in to input */
3655 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3656 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3660 static struct hda_verb alc880_lg_ch4_init[] = {
3661 /* set line-in to out and mic-in to input */
3662 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3663 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3667 static struct hda_verb alc880_lg_ch6_init[] = {
3668 /* set line-in and mic-in to output */
3669 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3670 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3674 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3675 { 2, alc880_lg_ch2_init },
3676 { 4, alc880_lg_ch4_init },
3677 { 6, alc880_lg_ch6_init },
3680 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3681 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3682 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3683 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3684 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3685 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3691 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3692 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3693 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3694 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3696 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3697 .name = "Channel Mode",
3698 .info = alc_ch_mode_info,
3699 .get = alc_ch_mode_get,
3700 .put = alc_ch_mode_put,
3705 static struct hda_verb alc880_lg_init_verbs[] = {
3706 /* set capture source to mic-in */
3707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3708 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3710 /* mute all amp mixer inputs */
3711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3712 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3714 /* line-in to input */
3715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3721 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3722 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3723 /* mic-in to input */
3724 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3726 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3728 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3732 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3736 /* toggle speaker-output according to the hp-jack state */
3737 static void alc880_lg_setup(struct hda_codec *codec)
3739 struct alc_spec *spec = codec->spec;
3741 spec->autocfg.hp_pins[0] = 0x1b;
3742 spec->autocfg.speaker_pins[0] = 0x17;
3751 * Built-in Mic-In: 0x19
3757 static struct hda_input_mux alc880_lg_lw_capture_source = {
3761 { "Internal Mic", 0x1 },
3766 #define alc880_lg_lw_modes alc880_threestack_modes
3768 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3769 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3770 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3771 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3772 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3773 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3780 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3781 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3782 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3785 .name = "Channel Mode",
3786 .info = alc_ch_mode_info,
3787 .get = alc_ch_mode_get,
3788 .put = alc_ch_mode_put,
3793 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3794 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3795 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3796 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3798 /* set capture source to mic-in */
3799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3800 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3801 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3808 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3809 /* mic-in to input */
3810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3816 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3820 /* toggle speaker-output according to the hp-jack state */
3821 static void alc880_lg_lw_setup(struct hda_codec *codec)
3823 struct alc_spec *spec = codec->spec;
3825 spec->autocfg.hp_pins[0] = 0x1b;
3826 spec->autocfg.speaker_pins[0] = 0x14;
3829 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3830 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3831 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3832 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3833 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3834 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3835 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3839 static struct hda_input_mux alc880_medion_rim_capture_source = {
3843 { "Internal Mic", 0x1 },
3847 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3848 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3853 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3856 /* Mic2 (as headphone out) for HP output */
3857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3859 /* Internal Speaker */
3860 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3861 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3863 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3864 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3866 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3870 /* toggle speaker-output according to the hp-jack state */
3871 static void alc880_medion_rim_automute(struct hda_codec *codec)
3873 struct alc_spec *spec = codec->spec;
3874 alc_automute_amp(codec);
3876 if (spec->jack_present)
3877 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3879 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3882 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3885 /* Looks like the unsol event is incompatible with the standard
3886 * definition. 4bit tag is placed at 28 bit!
3888 if ((res >> 28) == ALC880_HP_EVENT)
3889 alc880_medion_rim_automute(codec);
3892 static void alc880_medion_rim_setup(struct hda_codec *codec)
3894 struct alc_spec *spec = codec->spec;
3896 spec->autocfg.hp_pins[0] = 0x14;
3897 spec->autocfg.speaker_pins[0] = 0x1b;
3900 #ifdef CONFIG_SND_HDA_POWER_SAVE
3901 static struct hda_amp_list alc880_loopbacks[] = {
3902 { 0x0b, HDA_INPUT, 0 },
3903 { 0x0b, HDA_INPUT, 1 },
3904 { 0x0b, HDA_INPUT, 2 },
3905 { 0x0b, HDA_INPUT, 3 },
3906 { 0x0b, HDA_INPUT, 4 },
3910 static struct hda_amp_list alc880_lg_loopbacks[] = {
3911 { 0x0b, HDA_INPUT, 1 },
3912 { 0x0b, HDA_INPUT, 6 },
3913 { 0x0b, HDA_INPUT, 7 },
3922 static int alc_init(struct hda_codec *codec)
3924 struct alc_spec *spec = codec->spec;
3928 alc_auto_init_amp(codec, spec->init_amp);
3930 for (i = 0; i < spec->num_init_verbs; i++)
3931 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3933 if (spec->init_hook)
3934 spec->init_hook(codec);
3936 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3938 hda_call_check_power_status(codec, 0x01);
3942 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3944 struct alc_spec *spec = codec->spec;
3946 if (spec->unsol_event)
3947 spec->unsol_event(codec, res);
3950 #ifdef CONFIG_SND_HDA_POWER_SAVE
3951 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3953 struct alc_spec *spec = codec->spec;
3954 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3959 * Analog playback callbacks
3961 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3962 struct hda_codec *codec,
3963 struct snd_pcm_substream *substream)
3965 struct alc_spec *spec = codec->spec;
3966 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3970 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3971 struct hda_codec *codec,
3972 unsigned int stream_tag,
3973 unsigned int format,
3974 struct snd_pcm_substream *substream)
3976 struct alc_spec *spec = codec->spec;
3977 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3978 stream_tag, format, substream);
3981 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3982 struct hda_codec *codec,
3983 struct snd_pcm_substream *substream)
3985 struct alc_spec *spec = codec->spec;
3986 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3992 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3993 struct hda_codec *codec,
3994 struct snd_pcm_substream *substream)
3996 struct alc_spec *spec = codec->spec;
3997 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
4000 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4001 struct hda_codec *codec,
4002 unsigned int stream_tag,
4003 unsigned int format,
4004 struct snd_pcm_substream *substream)
4006 struct alc_spec *spec = codec->spec;
4007 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4008 stream_tag, format, substream);
4011 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4012 struct hda_codec *codec,
4013 struct snd_pcm_substream *substream)
4015 struct alc_spec *spec = codec->spec;
4016 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4019 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4020 struct hda_codec *codec,
4021 struct snd_pcm_substream *substream)
4023 struct alc_spec *spec = codec->spec;
4024 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4030 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4031 struct hda_codec *codec,
4032 unsigned int stream_tag,
4033 unsigned int format,
4034 struct snd_pcm_substream *substream)
4036 struct alc_spec *spec = codec->spec;
4038 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4039 stream_tag, 0, format);
4043 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4044 struct hda_codec *codec,
4045 struct snd_pcm_substream *substream)
4047 struct alc_spec *spec = codec->spec;
4049 snd_hda_codec_cleanup_stream(codec,
4050 spec->adc_nids[substream->number + 1]);
4054 /* analog capture with dynamic dual-adc changes */
4055 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4056 struct hda_codec *codec,
4057 unsigned int stream_tag,
4058 unsigned int format,
4059 struct snd_pcm_substream *substream)
4061 struct alc_spec *spec = codec->spec;
4062 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4063 spec->cur_adc_stream_tag = stream_tag;
4064 spec->cur_adc_format = format;
4065 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4069 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4070 struct hda_codec *codec,
4071 struct snd_pcm_substream *substream)
4073 struct alc_spec *spec = codec->spec;
4074 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4079 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4083 .nid = 0, /* fill later */
4085 .prepare = dualmic_capture_pcm_prepare,
4086 .cleanup = dualmic_capture_pcm_cleanup
4092 static struct hda_pcm_stream alc880_pcm_analog_playback = {
4096 /* NID is set in alc_build_pcms */
4098 .open = alc880_playback_pcm_open,
4099 .prepare = alc880_playback_pcm_prepare,
4100 .cleanup = alc880_playback_pcm_cleanup
4104 static struct hda_pcm_stream alc880_pcm_analog_capture = {
4108 /* NID is set in alc_build_pcms */
4111 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4115 /* NID is set in alc_build_pcms */
4118 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4119 .substreams = 2, /* can be overridden */
4122 /* NID is set in alc_build_pcms */
4124 .prepare = alc880_alt_capture_pcm_prepare,
4125 .cleanup = alc880_alt_capture_pcm_cleanup
4129 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4133 /* NID is set in alc_build_pcms */
4135 .open = alc880_dig_playback_pcm_open,
4136 .close = alc880_dig_playback_pcm_close,
4137 .prepare = alc880_dig_playback_pcm_prepare,
4138 .cleanup = alc880_dig_playback_pcm_cleanup
4142 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4146 /* NID is set in alc_build_pcms */
4149 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4150 static struct hda_pcm_stream alc_pcm_null_stream = {
4156 static int alc_build_pcms(struct hda_codec *codec)
4158 struct alc_spec *spec = codec->spec;
4159 struct hda_pcm *info = spec->pcm_rec;
4162 codec->num_pcms = 1;
4163 codec->pcm_info = info;
4165 if (spec->no_analog)
4168 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4169 "%s Analog", codec->chip_name);
4170 info->name = spec->stream_name_analog;
4172 if (spec->stream_analog_playback) {
4173 if (snd_BUG_ON(!spec->multiout.dac_nids))
4175 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4176 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4178 if (spec->stream_analog_capture) {
4179 if (snd_BUG_ON(!spec->adc_nids))
4181 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4182 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4185 if (spec->channel_mode) {
4186 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4187 for (i = 0; i < spec->num_channel_mode; i++) {
4188 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4189 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4195 /* SPDIF for stream index #1 */
4196 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4197 snprintf(spec->stream_name_digital,
4198 sizeof(spec->stream_name_digital),
4199 "%s Digital", codec->chip_name);
4200 codec->num_pcms = 2;
4201 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4202 info = spec->pcm_rec + 1;
4203 info->name = spec->stream_name_digital;
4204 if (spec->dig_out_type)
4205 info->pcm_type = spec->dig_out_type;
4207 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4208 if (spec->multiout.dig_out_nid &&
4209 spec->stream_digital_playback) {
4210 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4211 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4213 if (spec->dig_in_nid &&
4214 spec->stream_digital_capture) {
4215 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4216 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4218 /* FIXME: do we need this for all Realtek codec models? */
4219 codec->spdif_status_reset = 1;
4222 if (spec->no_analog)
4225 /* If the use of more than one ADC is requested for the current
4226 * model, configure a second analog capture-only PCM.
4228 /* Additional Analaog capture for index #2 */
4229 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4230 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4231 codec->num_pcms = 3;
4232 info = spec->pcm_rec + 2;
4233 info->name = spec->stream_name_analog;
4234 if (spec->alt_dac_nid) {
4235 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4236 *spec->stream_analog_alt_playback;
4237 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4240 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4241 alc_pcm_null_stream;
4242 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4244 if (spec->num_adc_nids > 1) {
4245 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4246 *spec->stream_analog_alt_capture;
4247 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4249 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4250 spec->num_adc_nids - 1;
4252 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4253 alc_pcm_null_stream;
4254 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4261 static inline void alc_shutup(struct hda_codec *codec)
4263 snd_hda_shutup_pins(codec);
4266 static void alc_free_kctls(struct hda_codec *codec)
4268 struct alc_spec *spec = codec->spec;
4270 if (spec->kctls.list) {
4271 struct snd_kcontrol_new *kctl = spec->kctls.list;
4273 for (i = 0; i < spec->kctls.used; i++)
4274 kfree(kctl[i].name);
4276 snd_array_free(&spec->kctls);
4279 static void alc_free(struct hda_codec *codec)
4281 struct alc_spec *spec = codec->spec;
4287 alc_free_kctls(codec);
4289 snd_hda_detach_beep_device(codec);
4292 #ifdef CONFIG_SND_HDA_POWER_SAVE
4293 static void alc_power_eapd(struct hda_codec *codec)
4295 /* We currently only handle front, HP */
4296 switch (codec->vendor_id) {
4298 set_eapd(codec, 0x0f, 0);
4299 set_eapd(codec, 0x10, 0);
4312 set_eapd(codec, 0x14, 0);
4313 set_eapd(codec, 0x15, 0);
4318 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4320 struct alc_spec *spec = codec->spec;
4322 if (spec && spec->power_hook)
4323 spec->power_hook(codec);
4328 #ifdef SND_HDA_NEEDS_RESUME
4329 static int alc_resume(struct hda_codec *codec)
4331 codec->patch_ops.init(codec);
4332 snd_hda_codec_resume_amp(codec);
4333 snd_hda_codec_resume_cache(codec);
4334 hda_call_check_power_status(codec, 0x01);
4341 static struct hda_codec_ops alc_patch_ops = {
4342 .build_controls = alc_build_controls,
4343 .build_pcms = alc_build_pcms,
4346 .unsol_event = alc_unsol_event,
4347 #ifdef SND_HDA_NEEDS_RESUME
4348 .resume = alc_resume,
4350 #ifdef CONFIG_SND_HDA_POWER_SAVE
4351 .suspend = alc_suspend,
4352 .check_power_status = alc_check_power_status,
4354 .reboot_notify = alc_shutup,
4357 /* replace the codec chip_name with the given string */
4358 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4360 kfree(codec->chip_name);
4361 codec->chip_name = kstrdup(name, GFP_KERNEL);
4362 if (!codec->chip_name) {
4370 * Test configuration for debugging
4372 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4375 #ifdef CONFIG_SND_DEBUG
4376 static hda_nid_t alc880_test_dac_nids[4] = {
4377 0x02, 0x03, 0x04, 0x05
4380 static struct hda_input_mux alc880_test_capture_source = {
4389 { "Surround", 0x6 },
4393 static struct hda_channel_mode alc880_test_modes[4] = {
4400 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4401 struct snd_ctl_elem_info *uinfo)
4403 static char *texts[] = {
4404 "N/A", "Line Out", "HP Out",
4405 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4407 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4409 uinfo->value.enumerated.items = 8;
4410 if (uinfo->value.enumerated.item >= 8)
4411 uinfo->value.enumerated.item = 7;
4412 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4416 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4417 struct snd_ctl_elem_value *ucontrol)
4419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4420 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4421 unsigned int pin_ctl, item = 0;
4423 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4424 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4425 if (pin_ctl & AC_PINCTL_OUT_EN) {
4426 if (pin_ctl & AC_PINCTL_HP_EN)
4430 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4431 switch (pin_ctl & AC_PINCTL_VREFEN) {
4432 case AC_PINCTL_VREF_HIZ: item = 3; break;
4433 case AC_PINCTL_VREF_50: item = 4; break;
4434 case AC_PINCTL_VREF_GRD: item = 5; break;
4435 case AC_PINCTL_VREF_80: item = 6; break;
4436 case AC_PINCTL_VREF_100: item = 7; break;
4439 ucontrol->value.enumerated.item[0] = item;
4443 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4444 struct snd_ctl_elem_value *ucontrol)
4446 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4447 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4448 static unsigned int ctls[] = {
4449 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4450 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4451 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4452 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4453 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4454 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4456 unsigned int old_ctl, new_ctl;
4458 old_ctl = snd_hda_codec_read(codec, nid, 0,
4459 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4460 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4461 if (old_ctl != new_ctl) {
4463 snd_hda_codec_write_cache(codec, nid, 0,
4464 AC_VERB_SET_PIN_WIDGET_CONTROL,
4466 val = ucontrol->value.enumerated.item[0] >= 3 ?
4468 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4475 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4476 struct snd_ctl_elem_info *uinfo)
4478 static char *texts[] = {
4479 "Front", "Surround", "CLFE", "Side"
4481 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4483 uinfo->value.enumerated.items = 4;
4484 if (uinfo->value.enumerated.item >= 4)
4485 uinfo->value.enumerated.item = 3;
4486 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4490 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4491 struct snd_ctl_elem_value *ucontrol)
4493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4494 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4497 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4498 ucontrol->value.enumerated.item[0] = sel & 3;
4502 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4503 struct snd_ctl_elem_value *ucontrol)
4505 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4506 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4509 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4510 if (ucontrol->value.enumerated.item[0] != sel) {
4511 sel = ucontrol->value.enumerated.item[0] & 3;
4512 snd_hda_codec_write_cache(codec, nid, 0,
4513 AC_VERB_SET_CONNECT_SEL, sel);
4519 #define PIN_CTL_TEST(xname,nid) { \
4520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4522 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4523 .info = alc_test_pin_ctl_info, \
4524 .get = alc_test_pin_ctl_get, \
4525 .put = alc_test_pin_ctl_put, \
4526 .private_value = nid \
4529 #define PIN_SRC_TEST(xname,nid) { \
4530 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4532 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4533 .info = alc_test_pin_src_info, \
4534 .get = alc_test_pin_src_get, \
4535 .put = alc_test_pin_src_put, \
4536 .private_value = nid \
4539 static struct snd_kcontrol_new alc880_test_mixer[] = {
4540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4541 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4542 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4543 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4545 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4546 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4547 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4548 PIN_CTL_TEST("Front Pin Mode", 0x14),
4549 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4550 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4551 PIN_CTL_TEST("Side Pin Mode", 0x17),
4552 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4553 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4554 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4555 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4556 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4557 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4558 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4559 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4560 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4561 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4562 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4563 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4564 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4565 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4566 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4567 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4568 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4569 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4572 .name = "Channel Mode",
4573 .info = alc_ch_mode_info,
4574 .get = alc_ch_mode_get,
4575 .put = alc_ch_mode_put,
4580 static struct hda_verb alc880_test_init_verbs[] = {
4581 /* Unmute inputs of 0x0c - 0x0f */
4582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4590 /* Vol output for 0x0c-0x0f */
4591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4592 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4594 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4595 /* Set output pins 0x14-0x17 */
4596 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4598 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4599 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4600 /* Unmute output pins 0x14-0x17 */
4601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4603 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4604 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4605 /* Set input pins 0x18-0x1c */
4606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4608 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4610 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4611 /* Mute input pins 0x18-0x1b */
4612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4613 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4614 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4615 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4618 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4619 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4620 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4621 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4622 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4623 /* Analog input/passthru */
4624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4636 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4637 [ALC880_3ST] = "3stack",
4638 [ALC880_TCL_S700] = "tcl",
4639 [ALC880_3ST_DIG] = "3stack-digout",
4640 [ALC880_CLEVO] = "clevo",
4641 [ALC880_5ST] = "5stack",
4642 [ALC880_5ST_DIG] = "5stack-digout",
4643 [ALC880_W810] = "w810",
4644 [ALC880_Z71V] = "z71v",
4645 [ALC880_6ST] = "6stack",
4646 [ALC880_6ST_DIG] = "6stack-digout",
4647 [ALC880_ASUS] = "asus",
4648 [ALC880_ASUS_W1V] = "asus-w1v",
4649 [ALC880_ASUS_DIG] = "asus-dig",
4650 [ALC880_ASUS_DIG2] = "asus-dig2",
4651 [ALC880_UNIWILL_DIG] = "uniwill",
4652 [ALC880_UNIWILL_P53] = "uniwill-p53",
4653 [ALC880_FUJITSU] = "fujitsu",
4654 [ALC880_F1734] = "F1734",
4656 [ALC880_LG_LW] = "lg-lw",
4657 [ALC880_MEDION_RIM] = "medion",
4658 #ifdef CONFIG_SND_DEBUG
4659 [ALC880_TEST] = "test",
4661 [ALC880_AUTO] = "auto",
4664 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4665 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4666 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4667 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4668 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4669 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4670 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4671 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4672 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4673 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4674 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4675 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4676 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4677 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4678 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4679 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4680 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4681 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4682 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4683 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4684 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4685 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4686 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4687 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4688 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4689 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4690 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4691 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4692 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4693 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4694 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4695 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4696 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4697 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4698 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4699 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4700 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4701 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4702 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4703 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4704 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4705 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4706 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4707 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4708 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4709 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4710 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4711 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4712 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4713 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4714 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4715 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4716 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4717 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4718 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4719 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4720 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4721 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4722 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4723 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4724 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4725 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4726 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4727 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4728 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4729 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4730 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4731 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4732 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4733 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4735 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4736 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4737 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4742 * ALC880 codec presets
4744 static struct alc_config_preset alc880_presets[] = {
4746 .mixers = { alc880_three_stack_mixer },
4747 .init_verbs = { alc880_volume_init_verbs,
4748 alc880_pin_3stack_init_verbs },
4749 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4750 .dac_nids = alc880_dac_nids,
4751 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4752 .channel_mode = alc880_threestack_modes,
4754 .input_mux = &alc880_capture_source,
4756 [ALC880_3ST_DIG] = {
4757 .mixers = { alc880_three_stack_mixer },
4758 .init_verbs = { alc880_volume_init_verbs,
4759 alc880_pin_3stack_init_verbs },
4760 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4761 .dac_nids = alc880_dac_nids,
4762 .dig_out_nid = ALC880_DIGOUT_NID,
4763 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4764 .channel_mode = alc880_threestack_modes,
4766 .input_mux = &alc880_capture_source,
4768 [ALC880_TCL_S700] = {
4769 .mixers = { alc880_tcl_s700_mixer },
4770 .init_verbs = { alc880_volume_init_verbs,
4771 alc880_pin_tcl_S700_init_verbs,
4772 alc880_gpio2_init_verbs },
4773 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4774 .dac_nids = alc880_dac_nids,
4775 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4776 .num_adc_nids = 1, /* single ADC */
4778 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4779 .channel_mode = alc880_2_jack_modes,
4780 .input_mux = &alc880_capture_source,
4783 .mixers = { alc880_three_stack_mixer,
4784 alc880_five_stack_mixer},
4785 .init_verbs = { alc880_volume_init_verbs,
4786 alc880_pin_5stack_init_verbs },
4787 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4788 .dac_nids = alc880_dac_nids,
4789 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4790 .channel_mode = alc880_fivestack_modes,
4791 .input_mux = &alc880_capture_source,
4793 [ALC880_5ST_DIG] = {
4794 .mixers = { alc880_three_stack_mixer,
4795 alc880_five_stack_mixer },
4796 .init_verbs = { alc880_volume_init_verbs,
4797 alc880_pin_5stack_init_verbs },
4798 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4799 .dac_nids = alc880_dac_nids,
4800 .dig_out_nid = ALC880_DIGOUT_NID,
4801 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4802 .channel_mode = alc880_fivestack_modes,
4803 .input_mux = &alc880_capture_source,
4806 .mixers = { alc880_six_stack_mixer },
4807 .init_verbs = { alc880_volume_init_verbs,
4808 alc880_pin_6stack_init_verbs },
4809 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4810 .dac_nids = alc880_6st_dac_nids,
4811 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4812 .channel_mode = alc880_sixstack_modes,
4813 .input_mux = &alc880_6stack_capture_source,
4815 [ALC880_6ST_DIG] = {
4816 .mixers = { alc880_six_stack_mixer },
4817 .init_verbs = { alc880_volume_init_verbs,
4818 alc880_pin_6stack_init_verbs },
4819 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4820 .dac_nids = alc880_6st_dac_nids,
4821 .dig_out_nid = ALC880_DIGOUT_NID,
4822 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4823 .channel_mode = alc880_sixstack_modes,
4824 .input_mux = &alc880_6stack_capture_source,
4827 .mixers = { alc880_w810_base_mixer },
4828 .init_verbs = { alc880_volume_init_verbs,
4829 alc880_pin_w810_init_verbs,
4830 alc880_gpio2_init_verbs },
4831 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4832 .dac_nids = alc880_w810_dac_nids,
4833 .dig_out_nid = ALC880_DIGOUT_NID,
4834 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4835 .channel_mode = alc880_w810_modes,
4836 .input_mux = &alc880_capture_source,
4839 .mixers = { alc880_z71v_mixer },
4840 .init_verbs = { alc880_volume_init_verbs,
4841 alc880_pin_z71v_init_verbs },
4842 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4843 .dac_nids = alc880_z71v_dac_nids,
4844 .dig_out_nid = ALC880_DIGOUT_NID,
4846 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4847 .channel_mode = alc880_2_jack_modes,
4848 .input_mux = &alc880_capture_source,
4851 .mixers = { alc880_f1734_mixer },
4852 .init_verbs = { alc880_volume_init_verbs,
4853 alc880_pin_f1734_init_verbs },
4854 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4855 .dac_nids = alc880_f1734_dac_nids,
4857 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4858 .channel_mode = alc880_2_jack_modes,
4859 .input_mux = &alc880_f1734_capture_source,
4860 .unsol_event = alc880_uniwill_p53_unsol_event,
4861 .setup = alc880_uniwill_p53_setup,
4862 .init_hook = alc_automute_amp,
4865 .mixers = { alc880_asus_mixer },
4866 .init_verbs = { alc880_volume_init_verbs,
4867 alc880_pin_asus_init_verbs,
4868 alc880_gpio1_init_verbs },
4869 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4870 .dac_nids = alc880_asus_dac_nids,
4871 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4872 .channel_mode = alc880_asus_modes,
4874 .input_mux = &alc880_capture_source,
4876 [ALC880_ASUS_DIG] = {
4877 .mixers = { alc880_asus_mixer },
4878 .init_verbs = { alc880_volume_init_verbs,
4879 alc880_pin_asus_init_verbs,
4880 alc880_gpio1_init_verbs },
4881 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4882 .dac_nids = alc880_asus_dac_nids,
4883 .dig_out_nid = ALC880_DIGOUT_NID,
4884 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4885 .channel_mode = alc880_asus_modes,
4887 .input_mux = &alc880_capture_source,
4889 [ALC880_ASUS_DIG2] = {
4890 .mixers = { alc880_asus_mixer },
4891 .init_verbs = { alc880_volume_init_verbs,
4892 alc880_pin_asus_init_verbs,
4893 alc880_gpio2_init_verbs }, /* use GPIO2 */
4894 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4895 .dac_nids = alc880_asus_dac_nids,
4896 .dig_out_nid = ALC880_DIGOUT_NID,
4897 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4898 .channel_mode = alc880_asus_modes,
4900 .input_mux = &alc880_capture_source,
4902 [ALC880_ASUS_W1V] = {
4903 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4904 .init_verbs = { alc880_volume_init_verbs,
4905 alc880_pin_asus_init_verbs,
4906 alc880_gpio1_init_verbs },
4907 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4908 .dac_nids = alc880_asus_dac_nids,
4909 .dig_out_nid = ALC880_DIGOUT_NID,
4910 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4911 .channel_mode = alc880_asus_modes,
4913 .input_mux = &alc880_capture_source,
4915 [ALC880_UNIWILL_DIG] = {
4916 .mixers = { alc880_asus_mixer },
4917 .init_verbs = { alc880_volume_init_verbs,
4918 alc880_pin_asus_init_verbs },
4919 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4920 .dac_nids = alc880_asus_dac_nids,
4921 .dig_out_nid = ALC880_DIGOUT_NID,
4922 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4923 .channel_mode = alc880_asus_modes,
4925 .input_mux = &alc880_capture_source,
4927 [ALC880_UNIWILL] = {
4928 .mixers = { alc880_uniwill_mixer },
4929 .init_verbs = { alc880_volume_init_verbs,
4930 alc880_uniwill_init_verbs },
4931 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4932 .dac_nids = alc880_asus_dac_nids,
4933 .dig_out_nid = ALC880_DIGOUT_NID,
4934 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4935 .channel_mode = alc880_threestack_modes,
4937 .input_mux = &alc880_capture_source,
4938 .unsol_event = alc880_uniwill_unsol_event,
4939 .setup = alc880_uniwill_setup,
4940 .init_hook = alc880_uniwill_init_hook,
4942 [ALC880_UNIWILL_P53] = {
4943 .mixers = { alc880_uniwill_p53_mixer },
4944 .init_verbs = { alc880_volume_init_verbs,
4945 alc880_uniwill_p53_init_verbs },
4946 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4947 .dac_nids = alc880_asus_dac_nids,
4948 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4949 .channel_mode = alc880_threestack_modes,
4950 .input_mux = &alc880_capture_source,
4951 .unsol_event = alc880_uniwill_p53_unsol_event,
4952 .setup = alc880_uniwill_p53_setup,
4953 .init_hook = alc_automute_amp,
4955 [ALC880_FUJITSU] = {
4956 .mixers = { alc880_fujitsu_mixer },
4957 .init_verbs = { alc880_volume_init_verbs,
4958 alc880_uniwill_p53_init_verbs,
4959 alc880_beep_init_verbs },
4960 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4961 .dac_nids = alc880_dac_nids,
4962 .dig_out_nid = ALC880_DIGOUT_NID,
4963 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4964 .channel_mode = alc880_2_jack_modes,
4965 .input_mux = &alc880_capture_source,
4966 .unsol_event = alc880_uniwill_p53_unsol_event,
4967 .setup = alc880_uniwill_p53_setup,
4968 .init_hook = alc_automute_amp,
4971 .mixers = { alc880_three_stack_mixer },
4972 .init_verbs = { alc880_volume_init_verbs,
4973 alc880_pin_clevo_init_verbs },
4974 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4975 .dac_nids = alc880_dac_nids,
4977 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4978 .channel_mode = alc880_threestack_modes,
4980 .input_mux = &alc880_capture_source,
4983 .mixers = { alc880_lg_mixer },
4984 .init_verbs = { alc880_volume_init_verbs,
4985 alc880_lg_init_verbs },
4986 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4987 .dac_nids = alc880_lg_dac_nids,
4988 .dig_out_nid = ALC880_DIGOUT_NID,
4989 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4990 .channel_mode = alc880_lg_ch_modes,
4992 .input_mux = &alc880_lg_capture_source,
4993 .unsol_event = alc_automute_amp_unsol_event,
4994 .setup = alc880_lg_setup,
4995 .init_hook = alc_automute_amp,
4996 #ifdef CONFIG_SND_HDA_POWER_SAVE
4997 .loopbacks = alc880_lg_loopbacks,
5001 .mixers = { alc880_lg_lw_mixer },
5002 .init_verbs = { alc880_volume_init_verbs,
5003 alc880_lg_lw_init_verbs },
5004 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5005 .dac_nids = alc880_dac_nids,
5006 .dig_out_nid = ALC880_DIGOUT_NID,
5007 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5008 .channel_mode = alc880_lg_lw_modes,
5009 .input_mux = &alc880_lg_lw_capture_source,
5010 .unsol_event = alc_automute_amp_unsol_event,
5011 .setup = alc880_lg_lw_setup,
5012 .init_hook = alc_automute_amp,
5014 [ALC880_MEDION_RIM] = {
5015 .mixers = { alc880_medion_rim_mixer },
5016 .init_verbs = { alc880_volume_init_verbs,
5017 alc880_medion_rim_init_verbs,
5018 alc_gpio2_init_verbs },
5019 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5020 .dac_nids = alc880_dac_nids,
5021 .dig_out_nid = ALC880_DIGOUT_NID,
5022 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5023 .channel_mode = alc880_2_jack_modes,
5024 .input_mux = &alc880_medion_rim_capture_source,
5025 .unsol_event = alc880_medion_rim_unsol_event,
5026 .setup = alc880_medion_rim_setup,
5027 .init_hook = alc880_medion_rim_automute,
5029 #ifdef CONFIG_SND_DEBUG
5031 .mixers = { alc880_test_mixer },
5032 .init_verbs = { alc880_test_init_verbs },
5033 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5034 .dac_nids = alc880_test_dac_nids,
5035 .dig_out_nid = ALC880_DIGOUT_NID,
5036 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5037 .channel_mode = alc880_test_modes,
5038 .input_mux = &alc880_test_capture_source,
5044 * Automatic parse of I/O pins from the BIOS configuration
5049 ALC_CTL_WIDGET_MUTE,
5052 static struct snd_kcontrol_new alc880_control_templates[] = {
5053 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5054 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5055 HDA_BIND_MUTE(NULL, 0, 0, 0),
5058 /* add dynamic controls */
5059 static int add_control(struct alc_spec *spec, int type, const char *name,
5060 int cidx, unsigned long val)
5062 struct snd_kcontrol_new *knew;
5064 snd_array_init(&spec->kctls, sizeof(*knew), 32);
5065 knew = snd_array_new(&spec->kctls);
5068 *knew = alc880_control_templates[type];
5069 knew->name = kstrdup(name, GFP_KERNEL);
5073 if (get_amp_nid_(val))
5074 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5075 knew->private_value = val;
5079 static int add_control_with_pfx(struct alc_spec *spec, int type,
5080 const char *pfx, const char *dir,
5081 const char *sfx, int cidx, unsigned long val)
5084 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5085 return add_control(spec, type, name, cidx, val);
5088 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5089 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5090 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5091 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5092 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5093 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5094 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5095 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5097 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5098 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5099 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5100 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5101 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5102 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5103 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5104 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5105 #define ALC880_PIN_CD_NID 0x1c
5107 /* fill in the dac_nids table from the parsed pin configuration */
5108 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5109 const struct auto_pin_cfg *cfg)
5115 memset(assigned, 0, sizeof(assigned));
5116 spec->multiout.dac_nids = spec->private_dac_nids;
5118 /* check the pins hardwired to audio widget */
5119 for (i = 0; i < cfg->line_outs; i++) {
5120 nid = cfg->line_out_pins[i];
5121 if (alc880_is_fixed_pin(nid)) {
5122 int idx = alc880_fixed_pin_idx(nid);
5123 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5127 /* left pins can be connect to any audio widget */
5128 for (i = 0; i < cfg->line_outs; i++) {
5129 nid = cfg->line_out_pins[i];
5130 if (alc880_is_fixed_pin(nid))
5132 /* search for an empty channel */
5133 for (j = 0; j < cfg->line_outs; j++) {
5135 spec->multiout.dac_nids[i] =
5136 alc880_idx_to_dac(j);
5142 spec->multiout.num_dacs = cfg->line_outs;
5146 static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5149 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5152 switch (cfg->line_out_type) {
5153 case AUTO_PIN_SPEAKER_OUT:
5154 if (cfg->line_outs == 1)
5157 case AUTO_PIN_HP_OUT:
5160 if (cfg->line_outs == 1)
5167 /* add playback controls from the parsed DAC table */
5168 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5169 const struct auto_pin_cfg *cfg)
5171 static const char * const chname[4] = {
5172 "Front", "Surround", NULL /*CLFE*/, "Side"
5174 const char *pfx = alc_get_line_out_pfx(cfg, false);
5178 for (i = 0; i < cfg->line_outs; i++) {
5179 if (!spec->multiout.dac_nids[i])
5181 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5182 if (!pfx && i == 2) {
5184 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5186 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5190 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5192 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5196 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5198 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5202 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5204 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5209 const char *name = pfx;
5215 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5217 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5221 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5223 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5232 /* add playback controls for speaker and HP outputs */
5233 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5242 if (alc880_is_fixed_pin(pin)) {
5243 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5244 /* specify the DAC as the extra output */
5245 if (!spec->multiout.hp_nid)
5246 spec->multiout.hp_nid = nid;
5248 spec->multiout.extra_out_nid[0] = nid;
5249 /* control HP volume/switch on the output mixer amp */
5250 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5251 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5252 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5255 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5256 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5259 } else if (alc880_is_multi_pin(pin)) {
5260 /* set manual connection */
5261 /* we have only a switch on HP-out PIN */
5262 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5263 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5270 /* create input playback/capture controls for the given pin */
5271 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5272 const char *ctlname, int ctlidx,
5273 int idx, hda_nid_t mix_nid)
5277 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5278 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5281 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5282 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5288 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5290 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5291 return (pincap & AC_PINCAP_IN) != 0;
5294 /* create playback/capture controls for input pins */
5295 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5296 const struct auto_pin_cfg *cfg,
5298 hda_nid_t cap1, hda_nid_t cap2)
5300 struct alc_spec *spec = codec->spec;
5301 struct hda_input_mux *imux = &spec->private_imux[0];
5302 int i, err, idx, type_idx = 0;
5303 const char *prev_label = NULL;
5305 for (i = 0; i < cfg->num_inputs; i++) {
5309 pin = cfg->inputs[i].pin;
5310 if (!alc_is_input_pin(codec, pin))
5313 label = hda_get_autocfg_input_label(codec, cfg, i);
5314 if (prev_label && !strcmp(label, prev_label))
5321 idx = get_connection_index(codec, mixer, pin);
5323 err = new_analog_input(spec, pin,
5333 idx = get_connection_index(codec, cap1, pin);
5334 if (idx < 0 && cap2)
5335 idx = get_connection_index(codec, cap2, pin);
5337 snd_hda_add_imux_item(imux, label, idx, NULL);
5342 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5343 const struct auto_pin_cfg *cfg)
5345 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5348 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5349 unsigned int pin_type)
5351 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5354 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5358 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5359 hda_nid_t nid, int pin_type,
5362 alc_set_pin_output(codec, nid, pin_type);
5363 /* need the manual connection? */
5364 if (alc880_is_multi_pin(nid)) {
5365 struct alc_spec *spec = codec->spec;
5366 int idx = alc880_multi_pin_idx(nid);
5367 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5368 AC_VERB_SET_CONNECT_SEL,
5369 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5373 static int get_pin_type(int line_out_type)
5375 if (line_out_type == AUTO_PIN_HP_OUT)
5381 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5383 struct alc_spec *spec = codec->spec;
5386 for (i = 0; i < spec->autocfg.line_outs; i++) {
5387 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5388 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5389 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5393 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5395 struct alc_spec *spec = codec->spec;
5398 pin = spec->autocfg.speaker_pins[0];
5399 if (pin) /* connect to front */
5400 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5401 pin = spec->autocfg.hp_pins[0];
5402 if (pin) /* connect to front */
5403 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5406 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5408 struct alc_spec *spec = codec->spec;
5409 struct auto_pin_cfg *cfg = &spec->autocfg;
5412 for (i = 0; i < cfg->num_inputs; i++) {
5413 hda_nid_t nid = cfg->inputs[i].pin;
5414 if (alc_is_input_pin(codec, nid)) {
5415 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5416 if (nid != ALC880_PIN_CD_NID &&
5417 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5418 snd_hda_codec_write(codec, nid, 0,
5419 AC_VERB_SET_AMP_GAIN_MUTE,
5425 static void alc880_auto_init_input_src(struct hda_codec *codec)
5427 struct alc_spec *spec = codec->spec;
5430 for (c = 0; c < spec->num_adc_nids; c++) {
5431 unsigned int mux_idx;
5432 const struct hda_input_mux *imux;
5433 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5434 imux = &spec->input_mux[mux_idx];
5435 if (!imux->num_items && mux_idx > 0)
5436 imux = &spec->input_mux[0];
5438 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5439 AC_VERB_SET_CONNECT_SEL,
5440 imux->items[0].index);
5444 /* parse the BIOS configuration and set up the alc_spec */
5445 /* return 1 if successful, 0 if the proper config is not found,
5446 * or a negative error code
5448 static int alc880_parse_auto_config(struct hda_codec *codec)
5450 struct alc_spec *spec = codec->spec;
5452 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5454 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5458 if (!spec->autocfg.line_outs)
5459 return 0; /* can't find valid BIOS pin config */
5461 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5464 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5467 err = alc880_auto_create_extra_out(spec,
5468 spec->autocfg.speaker_pins[0],
5472 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5476 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5480 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5482 alc_auto_parse_digital(codec);
5484 if (spec->kctls.list)
5485 add_mixer(spec, spec->kctls.list);
5487 add_verb(spec, alc880_volume_init_verbs);
5489 spec->num_mux_defs = 1;
5490 spec->input_mux = &spec->private_imux[0];
5492 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5497 /* additional initialization for auto-configuration model */
5498 static void alc880_auto_init(struct hda_codec *codec)
5500 struct alc_spec *spec = codec->spec;
5501 alc880_auto_init_multi_out(codec);
5502 alc880_auto_init_extra_out(codec);
5503 alc880_auto_init_analog_input(codec);
5504 alc880_auto_init_input_src(codec);
5505 alc_auto_init_digital(codec);
5506 if (spec->unsol_event)
5507 alc_inithook(codec);
5510 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5511 * one of two digital mic pins, e.g. on ALC272
5513 static void fixup_automic_adc(struct hda_codec *codec)
5515 struct alc_spec *spec = codec->spec;
5518 for (i = 0; i < spec->num_adc_nids; i++) {
5519 hda_nid_t cap = spec->capsrc_nids ?
5520 spec->capsrc_nids[i] : spec->adc_nids[i];
5523 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5526 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5529 spec->int_mic.mux_idx = iidx;
5530 spec->ext_mic.mux_idx = eidx;
5531 if (spec->capsrc_nids)
5532 spec->capsrc_nids += i;
5533 spec->adc_nids += i;
5534 spec->num_adc_nids = 1;
5537 snd_printd(KERN_INFO "hda_codec: %s: "
5538 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5539 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5540 spec->auto_mic = 0; /* disable auto-mic to be sure */
5543 /* select or unmute the given capsrc route */
5544 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5547 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5548 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5551 snd_hda_codec_write_cache(codec, cap, 0,
5552 AC_VERB_SET_CONNECT_SEL, idx);
5556 /* set the default connection to that pin */
5557 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5559 struct alc_spec *spec = codec->spec;
5562 for (i = 0; i < spec->num_adc_nids; i++) {
5563 hda_nid_t cap = spec->capsrc_nids ?
5564 spec->capsrc_nids[i] : spec->adc_nids[i];
5567 idx = get_connection_index(codec, cap, pin);
5570 select_or_unmute_capsrc(codec, cap, idx);
5571 return i; /* return the found index */
5573 return -1; /* not found */
5576 /* choose the ADC/MUX containing the input pin and initialize the setup */
5577 static void fixup_single_adc(struct hda_codec *codec)
5579 struct alc_spec *spec = codec->spec;
5580 struct auto_pin_cfg *cfg = &spec->autocfg;
5583 /* search for the input pin; there must be only one */
5584 if (cfg->num_inputs != 1)
5586 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5588 /* use only this ADC */
5589 if (spec->capsrc_nids)
5590 spec->capsrc_nids += i;
5591 spec->adc_nids += i;
5592 spec->num_adc_nids = 1;
5596 /* initialize dual adcs */
5597 static void fixup_dual_adc_switch(struct hda_codec *codec)
5599 struct alc_spec *spec = codec->spec;
5600 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5601 init_capsrc_for_pin(codec, spec->int_mic.pin);
5604 static void set_capture_mixer(struct hda_codec *codec)
5606 struct alc_spec *spec = codec->spec;
5607 static struct snd_kcontrol_new *caps[2][3] = {
5608 { alc_capture_mixer_nosrc1,
5609 alc_capture_mixer_nosrc2,
5610 alc_capture_mixer_nosrc3 },
5611 { alc_capture_mixer1,
5613 alc_capture_mixer3 },
5615 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5617 int num_adcs = spec->num_adc_nids;
5618 if (spec->dual_adc_switch)
5619 fixup_dual_adc_switch(codec);
5620 else if (spec->auto_mic)
5621 fixup_automic_adc(codec);
5622 else if (spec->input_mux) {
5623 if (spec->input_mux->num_items > 1)
5625 else if (spec->input_mux->num_items == 1)
5626 fixup_single_adc(codec);
5628 if (spec->dual_adc_switch)
5630 spec->cap_mixer = caps[mux][num_adcs - 1];
5634 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5635 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5638 struct alc_spec *spec = codec->spec;
5639 struct auto_pin_cfg *cfg = &spec->autocfg;
5641 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5643 for (n = 0; n < num_nids; n++) {
5645 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5649 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5652 nconns = snd_hda_get_connections(codec, cap, conn,
5656 nconns = snd_hda_get_connections(codec, cap, conn,
5661 if (!fallback_adc) {
5665 for (i = 0; i < cfg->num_inputs; i++) {
5666 hda_nid_t nid = cfg->inputs[i].pin;
5667 for (j = 0; j < nconns; j++) {
5674 if (i >= cfg->num_inputs) {
5675 int num_adcs = spec->num_adc_nids;
5676 spec->private_adc_nids[num_adcs] = adc;
5677 spec->private_capsrc_nids[num_adcs] = cap;
5678 spec->num_adc_nids++;
5679 spec->adc_nids = spec->private_adc_nids;
5681 spec->capsrc_nids = spec->private_capsrc_nids;
5684 if (!spec->num_adc_nids) {
5685 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5686 " using fallback 0x%x\n",
5687 codec->chip_name, fallback_adc);
5688 spec->private_adc_nids[0] = fallback_adc;
5689 spec->adc_nids = spec->private_adc_nids;
5690 if (fallback_adc != fallback_cap) {
5691 spec->private_capsrc_nids[0] = fallback_cap;
5692 spec->capsrc_nids = spec->private_adc_nids;
5697 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5698 #define set_beep_amp(spec, nid, idx, dir) \
5699 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5701 static struct snd_pci_quirk beep_white_list[] = {
5702 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5703 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5704 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5708 static inline int has_cdefine_beep(struct hda_codec *codec)
5710 struct alc_spec *spec = codec->spec;
5711 const struct snd_pci_quirk *q;
5712 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5715 return spec->cdefine.enable_pcbeep;
5718 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5719 #define has_cdefine_beep(codec) 0
5723 * OK, here we have finally the patch for ALC880
5726 static int patch_alc880(struct hda_codec *codec)
5728 struct alc_spec *spec;
5732 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5738 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5741 if (board_config < 0) {
5742 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5744 board_config = ALC880_AUTO;
5747 if (board_config == ALC880_AUTO) {
5748 /* automatic parse from the BIOS config */
5749 err = alc880_parse_auto_config(codec);
5755 "hda_codec: Cannot set up configuration "
5756 "from BIOS. Using 3-stack mode...\n");
5757 board_config = ALC880_3ST;
5761 err = snd_hda_attach_beep_device(codec, 0x1);
5767 if (board_config != ALC880_AUTO)
5768 setup_preset(codec, &alc880_presets[board_config]);
5770 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5771 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5772 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5774 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5775 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5777 if (!spec->adc_nids && spec->input_mux) {
5778 /* check whether NID 0x07 is valid */
5779 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5781 wcap = get_wcaps_type(wcap);
5782 if (wcap != AC_WID_AUD_IN) {
5783 spec->adc_nids = alc880_adc_nids_alt;
5784 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5786 spec->adc_nids = alc880_adc_nids;
5787 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5790 set_capture_mixer(codec);
5791 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5793 spec->vmaster_nid = 0x0c;
5795 codec->patch_ops = alc_patch_ops;
5796 if (board_config == ALC880_AUTO)
5797 spec->init_hook = alc880_auto_init;
5798 #ifdef CONFIG_SND_HDA_POWER_SAVE
5799 if (!spec->loopback.amplist)
5800 spec->loopback.amplist = alc880_loopbacks;
5811 static hda_nid_t alc260_dac_nids[1] = {
5816 static hda_nid_t alc260_adc_nids[1] = {
5821 static hda_nid_t alc260_adc_nids_alt[1] = {
5826 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5827 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5829 static hda_nid_t alc260_dual_adc_nids[2] = {
5834 #define ALC260_DIGOUT_NID 0x03
5835 #define ALC260_DIGIN_NID 0x06
5837 static struct hda_input_mux alc260_capture_source = {
5841 { "Front Mic", 0x1 },
5847 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5848 * headphone jack and the internal CD lines since these are the only pins at
5849 * which audio can appear. For flexibility, also allow the option of
5850 * recording the mixer output on the second ADC (ADC0 doesn't have a
5851 * connection to the mixer output).
5853 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5857 { "Mic/Line", 0x0 },
5859 { "Headphone", 0x2 },
5865 { "Mic/Line", 0x0 },
5867 { "Headphone", 0x2 },
5874 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5875 * the Fujitsu S702x, but jacks are marked differently.
5877 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5884 { "Headphone", 0x5 },
5893 { "Headphone", 0x6 },
5899 /* Maxdata Favorit 100XS */
5900 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5904 { "Line/Mic", 0x0 },
5911 { "Line/Mic", 0x0 },
5919 * This is just place-holder, so there's something for alc_build_pcms to look
5920 * at when it calculates the maximum number of channels. ALC260 has no mixer
5921 * element which allows changing the channel mode, so the verb list is
5924 static struct hda_channel_mode alc260_modes[1] = {
5929 /* Mixer combinations
5931 * basic: base_output + input + pc_beep + capture
5932 * HP: base_output + input + capture_alt
5933 * HP_3013: hp_3013 + input + capture
5934 * fujitsu: fujitsu + capture
5935 * acer: acer + capture
5938 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5939 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5940 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5941 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5942 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5943 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5944 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5948 static struct snd_kcontrol_new alc260_input_mixer[] = {
5949 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5950 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5951 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5952 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5954 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5955 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5956 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5960 /* update HP, line and mono out pins according to the master switch */
5961 static void alc260_hp_master_update(struct hda_codec *codec,
5962 hda_nid_t hp, hda_nid_t line,
5965 struct alc_spec *spec = codec->spec;
5966 unsigned int val = spec->master_sw ? PIN_HP : 0;
5967 /* change HP and line-out pins */
5968 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5970 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5972 /* mono (speaker) depending on the HP jack sense */
5973 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5974 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5978 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5979 struct snd_ctl_elem_value *ucontrol)
5981 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5982 struct alc_spec *spec = codec->spec;
5983 *ucontrol->value.integer.value = spec->master_sw;
5987 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5988 struct snd_ctl_elem_value *ucontrol)
5990 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5991 struct alc_spec *spec = codec->spec;
5992 int val = !!*ucontrol->value.integer.value;
5993 hda_nid_t hp, line, mono;
5995 if (val == spec->master_sw)
5997 spec->master_sw = val;
5998 hp = (kcontrol->private_value >> 16) & 0xff;
5999 line = (kcontrol->private_value >> 8) & 0xff;
6000 mono = kcontrol->private_value & 0xff;
6001 alc260_hp_master_update(codec, hp, line, mono);
6005 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6008 .name = "Master Playback Switch",
6009 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6010 .info = snd_ctl_boolean_mono_info,
6011 .get = alc260_hp_master_sw_get,
6012 .put = alc260_hp_master_sw_put,
6013 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
6015 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6016 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6017 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6018 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6019 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6021 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6025 static struct hda_verb alc260_hp_unsol_verbs[] = {
6026 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6030 static void alc260_hp_automute(struct hda_codec *codec)
6032 struct alc_spec *spec = codec->spec;
6034 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
6035 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
6038 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
6040 if ((res >> 26) == ALC880_HP_EVENT)
6041 alc260_hp_automute(codec);
6044 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6047 .name = "Master Playback Switch",
6048 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6049 .info = snd_ctl_boolean_mono_info,
6050 .get = alc260_hp_master_sw_get,
6051 .put = alc260_hp_master_sw_put,
6052 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
6054 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6055 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6056 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6057 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6058 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6060 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6061 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6065 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6066 .ops = &snd_hda_bind_vol,
6068 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6069 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6070 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6075 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6076 .ops = &snd_hda_bind_sw,
6078 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6079 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6084 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6085 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6086 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6087 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6088 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6092 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6093 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6097 static void alc260_hp_3013_automute(struct hda_codec *codec)
6099 struct alc_spec *spec = codec->spec;
6101 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6102 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6105 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6108 if ((res >> 26) == ALC880_HP_EVENT)
6109 alc260_hp_3013_automute(codec);
6112 static void alc260_hp_3012_automute(struct hda_codec *codec)
6114 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6116 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6118 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6120 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6124 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6127 if ((res >> 26) == ALC880_HP_EVENT)
6128 alc260_hp_3012_automute(codec);
6131 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6132 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6134 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6135 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6136 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6137 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6138 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6139 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6140 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6141 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6142 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6143 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6144 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6148 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6149 * versions of the ALC260 don't act on requests to enable mic bias from NID
6150 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6151 * datasheet doesn't mention this restriction. At this stage it's not clear
6152 * whether this behaviour is intentional or is a hardware bug in chip
6153 * revisions available in early 2006. Therefore for now allow the
6154 * "Headphone Jack Mode" control to span all choices, but if it turns out
6155 * that the lack of mic bias for this NID is intentional we could change the
6156 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6158 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6159 * don't appear to make the mic bias available from the "line" jack, even
6160 * though the NID used for this jack (0x14) can supply it. The theory is
6161 * that perhaps Acer have included blocking capacitors between the ALC260
6162 * and the output jack. If this turns out to be the case for all such
6163 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6164 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6166 * The C20x Tablet series have a mono internal speaker which is controlled
6167 * via the chip's Mono sum widget and pin complex, so include the necessary
6168 * controls for such models. On models without a "mono speaker" the control
6169 * won't do anything.
6171 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6172 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6173 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6174 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6175 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6177 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6179 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6180 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6182 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6183 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6184 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6185 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6186 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6190 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6192 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6193 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6194 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6195 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6196 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6197 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6198 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6202 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6203 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6205 static struct snd_kcontrol_new alc260_will_mixer[] = {
6206 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6207 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6209 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6210 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6211 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6212 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6213 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6214 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6215 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6219 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6220 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6222 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6223 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6224 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6226 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6227 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6228 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6229 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6230 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6231 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6232 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6237 * initialization verbs
6239 static struct hda_verb alc260_init_verbs[] = {
6240 /* Line In pin widget for input */
6241 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6242 /* CD pin widget for input */
6243 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6244 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6245 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6246 /* Mic2 (front panel) pin widget for input and vref at 80% */
6247 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6248 /* LINE-2 is used for line-out in rear */
6249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6250 /* select line-out */
6251 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6253 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6255 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6257 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6258 /* mute capture amp left and right */
6259 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6260 /* set connection select to line in (default select for this ADC) */
6261 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6262 /* mute capture amp left and right */
6263 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6264 /* set connection select to line in (default select for this ADC) */
6265 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6266 /* set vol=0 Line-Out mixer amp left and right */
6267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6268 /* unmute pin widget amp left and right (no gain on this amp) */
6269 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6270 /* set vol=0 HP mixer amp left and right */
6271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6272 /* unmute pin widget amp left and right (no gain on this amp) */
6273 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6274 /* set vol=0 Mono mixer amp left and right */
6275 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6276 /* unmute pin widget amp left and right (no gain on this amp) */
6277 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6278 /* unmute LINE-2 out pin */
6279 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6280 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6283 /* mute analog inputs */
6284 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6289 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6290 /* mute Front out path */
6291 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6292 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6293 /* mute Headphone out path */
6294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6295 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6296 /* mute Mono out path */
6297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6298 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6302 #if 0 /* should be identical with alc260_init_verbs? */
6303 static struct hda_verb alc260_hp_init_verbs[] = {
6304 /* Headphone and output */
6305 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6307 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6308 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6309 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6310 /* Mic2 (front panel) pin widget for input and vref at 80% */
6311 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6312 /* Line In pin widget for input */
6313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6314 /* Line-2 pin widget for output */
6315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6316 /* CD pin widget for input */
6317 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6318 /* unmute amp left and right */
6319 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6320 /* set connection select to line in (default select for this ADC) */
6321 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6322 /* unmute Line-Out mixer amp left and right (volume = 0) */
6323 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6324 /* mute pin widget amp left and right (no gain on this amp) */
6325 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6326 /* unmute HP mixer amp left and right (volume = 0) */
6327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6328 /* mute pin widget amp left and right (no gain on this amp) */
6329 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6330 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6333 /* mute analog inputs */
6334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6339 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6340 /* Unmute Front out path */
6341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6342 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6343 /* Unmute Headphone out path */
6344 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6345 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6346 /* Unmute Mono out path */
6347 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6348 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6353 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6354 /* Line out and output */
6355 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6357 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6358 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6359 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6360 /* Mic2 (front panel) pin widget for input and vref at 80% */
6361 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6362 /* Line In pin widget for input */
6363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6364 /* Headphone pin widget for output */
6365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6366 /* CD pin widget for input */
6367 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6368 /* unmute amp left and right */
6369 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6370 /* set connection select to line in (default select for this ADC) */
6371 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6372 /* unmute Line-Out mixer amp left and right (volume = 0) */
6373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6374 /* mute pin widget amp left and right (no gain on this amp) */
6375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6376 /* unmute HP mixer amp left and right (volume = 0) */
6377 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6378 /* mute pin widget amp left and right (no gain on this amp) */
6379 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6380 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6383 /* mute analog inputs */
6384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6389 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6390 /* Unmute Front out path */
6391 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6392 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6393 /* Unmute Headphone out path */
6394 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6395 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6396 /* Unmute Mono out path */
6397 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6398 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6402 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6403 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6404 * audio = 0x16, internal speaker = 0x10.
6406 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6407 /* Disable all GPIOs */
6408 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6409 /* Internal speaker is connected to headphone pin */
6410 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6411 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6413 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6414 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6415 /* Ensure all other unused pins are disabled and muted. */
6416 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6418 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6419 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6420 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6421 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6425 /* Disable digital (SPDIF) pins */
6426 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6427 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6429 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6430 * when acting as an output.
6432 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6434 /* Start with output sum widgets muted and their output gains at min */
6435 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6436 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6437 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6438 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6439 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6440 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6441 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6442 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6443 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6445 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6446 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6447 /* Unmute Line1 pin widget output buffer since it starts as an output.
6448 * If the pin mode is changed by the user the pin mode control will
6449 * take care of enabling the pin's input/output buffers as needed.
6450 * Therefore there's no need to enable the input buffer at this
6453 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6454 /* Unmute input buffer of pin widget used for Line-in (no equiv
6457 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6459 /* Mute capture amp left and right */
6460 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6461 /* Set ADC connection select to match default mixer setting - line
6464 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6466 /* Do the same for the second ADC: mute capture input amp and
6467 * set ADC connection to line in (on mic1 pin)
6469 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6470 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6472 /* Mute all inputs to mixer widget (even unconnected ones) */
6473 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6474 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6475 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6476 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6477 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6478 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6480 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6485 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6486 * similar laptops (adapted from Fujitsu init verbs).
6488 static struct hda_verb alc260_acer_init_verbs[] = {
6489 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6490 * the headphone jack. Turn this on and rely on the standard mute
6491 * methods whenever the user wants to turn these outputs off.
6493 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6494 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6495 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6496 /* Internal speaker/Headphone jack is connected to Line-out pin */
6497 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6498 /* Internal microphone/Mic jack is connected to Mic1 pin */
6499 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6500 /* Line In jack is connected to Line1 pin */
6501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6502 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6503 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6504 /* Ensure all other unused pins are disabled and muted. */
6505 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6506 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6507 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6508 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6510 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6511 /* Disable digital (SPDIF) pins */
6512 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6513 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6515 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6516 * bus when acting as outputs.
6518 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6519 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6521 /* Start with output sum widgets muted and their output gains at min */
6522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6523 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6524 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6526 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6527 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6528 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6529 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6530 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6532 /* Unmute Line-out pin widget amp left and right
6533 * (no equiv mixer ctrl)
6535 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6536 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6537 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6538 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6539 * inputs. If the pin mode is changed by the user the pin mode control
6540 * will take care of enabling the pin's input/output buffers as needed.
6541 * Therefore there's no need to enable the input buffer at this
6544 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6545 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6547 /* Mute capture amp left and right */
6548 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6549 /* Set ADC connection select to match default mixer setting - mic
6552 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6554 /* Do similar with the second ADC: mute capture input amp and
6555 * set ADC connection to mic to match ALSA's default state.
6557 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6558 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6560 /* Mute all inputs to mixer widget (even unconnected ones) */
6561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6573 /* Initialisation sequence for Maxdata Favorit 100XS
6574 * (adapted from Acer init verbs).
6576 static struct hda_verb alc260_favorit100_init_verbs[] = {
6577 /* GPIO 0 enables the output jack.
6578 * Turn this on and rely on the standard mute
6579 * methods whenever the user wants to turn these outputs off.
6581 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6582 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6583 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6584 /* Line/Mic input jack is connected to Mic1 pin */
6585 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6586 /* Ensure all other unused pins are disabled and muted. */
6587 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6588 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6589 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6590 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6591 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6592 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6594 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6596 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6597 /* Disable digital (SPDIF) pins */
6598 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6599 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6601 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6602 * bus when acting as outputs.
6604 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6605 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6607 /* Start with output sum widgets muted and their output gains at min */
6608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6610 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6612 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6613 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6614 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6615 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6616 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6618 /* Unmute Line-out pin widget amp left and right
6619 * (no equiv mixer ctrl)
6621 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6622 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6623 * inputs. If the pin mode is changed by the user the pin mode control
6624 * will take care of enabling the pin's input/output buffers as needed.
6625 * Therefore there's no need to enable the input buffer at this
6628 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6630 /* Mute capture amp left and right */
6631 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6632 /* Set ADC connection select to match default mixer setting - mic
6635 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6637 /* Do similar with the second ADC: mute capture input amp and
6638 * set ADC connection to mic to match ALSA's default state.
6640 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6641 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6643 /* Mute all inputs to mixer widget (even unconnected ones) */
6644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6649 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6656 static struct hda_verb alc260_will_verbs[] = {
6657 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6658 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6659 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6660 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6661 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6662 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6666 static struct hda_verb alc260_replacer_672v_verbs[] = {
6667 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6668 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6669 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6671 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6672 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6673 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6675 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6679 /* toggle speaker-output according to the hp-jack state */
6680 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6682 unsigned int present;
6684 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6685 present = snd_hda_jack_detect(codec, 0x0f);
6687 snd_hda_codec_write_cache(codec, 0x01, 0,
6688 AC_VERB_SET_GPIO_DATA, 1);
6689 snd_hda_codec_write_cache(codec, 0x0f, 0,
6690 AC_VERB_SET_PIN_WIDGET_CONTROL,
6693 snd_hda_codec_write_cache(codec, 0x01, 0,
6694 AC_VERB_SET_GPIO_DATA, 0);
6695 snd_hda_codec_write_cache(codec, 0x0f, 0,
6696 AC_VERB_SET_PIN_WIDGET_CONTROL,
6701 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6704 if ((res >> 26) == ALC880_HP_EVENT)
6705 alc260_replacer_672v_automute(codec);
6708 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6709 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6710 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6711 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6712 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6713 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6715 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6716 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6717 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6718 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6722 /* Test configuration for debugging, modelled after the ALC880 test
6725 #ifdef CONFIG_SND_DEBUG
6726 static hda_nid_t alc260_test_dac_nids[1] = {
6729 static hda_nid_t alc260_test_adc_nids[2] = {
6732 /* For testing the ALC260, each input MUX needs its own definition since
6733 * the signal assignments are different. This assumes that the first ADC
6736 static struct hda_input_mux alc260_test_capture_sources[2] = {
6740 { "MIC1 pin", 0x0 },
6741 { "MIC2 pin", 0x1 },
6742 { "LINE1 pin", 0x2 },
6743 { "LINE2 pin", 0x3 },
6745 { "LINE-OUT pin", 0x5 },
6746 { "HP-OUT pin", 0x6 },
6752 { "MIC1 pin", 0x0 },
6753 { "MIC2 pin", 0x1 },
6754 { "LINE1 pin", 0x2 },
6755 { "LINE2 pin", 0x3 },
6758 { "LINE-OUT pin", 0x6 },
6759 { "HP-OUT pin", 0x7 },
6763 static struct snd_kcontrol_new alc260_test_mixer[] = {
6764 /* Output driver widgets */
6765 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6766 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6767 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6768 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6769 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6770 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6772 /* Modes for retasking pin widgets
6773 * Note: the ALC260 doesn't seem to act on requests to enable mic
6774 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6775 * mention this restriction. At this stage it's not clear whether
6776 * this behaviour is intentional or is a hardware bug in chip
6777 * revisions available at least up until early 2006. Therefore for
6778 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6779 * choices, but if it turns out that the lack of mic bias for these
6780 * NIDs is intentional we could change their modes from
6781 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6783 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6784 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6785 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6786 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6787 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6788 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6790 /* Loopback mixer controls */
6791 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6792 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6793 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6794 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6795 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6796 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6797 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6798 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6799 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6800 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6801 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6802 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6803 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6804 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6806 /* Controls for GPIO pins, assuming they are configured as outputs */
6807 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6808 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6809 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6810 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6812 /* Switches to allow the digital IO pins to be enabled. The datasheet
6813 * is ambigious as to which NID is which; testing on laptops which
6814 * make this output available should provide clarification.
6816 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6817 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6819 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6820 * this output to turn on an external amplifier.
6822 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6823 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6827 static struct hda_verb alc260_test_init_verbs[] = {
6828 /* Enable all GPIOs as outputs with an initial value of 0 */
6829 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6830 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6831 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6833 /* Enable retasking pins as output, initially without power amp */
6834 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6835 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6836 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6838 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6839 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6841 /* Disable digital (SPDIF) pins initially, but users can enable
6842 * them via a mixer switch. In the case of SPDIF-out, this initverb
6843 * payload also sets the generation to 0, output to be in "consumer"
6844 * PCM format, copyright asserted, no pre-emphasis and no validity
6847 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6848 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6850 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6851 * OUT1 sum bus when acting as an output.
6853 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6854 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6855 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6856 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6858 /* Start with output sum widgets muted and their output gains at min */
6859 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6860 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6861 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6862 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6863 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6864 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6865 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6866 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6867 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6869 /* Unmute retasking pin widget output buffers since the default
6870 * state appears to be output. As the pin mode is changed by the
6871 * user the pin mode control will take care of enabling the pin's
6872 * input/output buffers as needed.
6874 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6877 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6878 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6879 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6880 /* Also unmute the mono-out pin widget */
6881 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6883 /* Mute capture amp left and right */
6884 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6885 /* Set ADC connection select to match default mixer setting (mic1
6888 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6890 /* Do the same for the second ADC: mute capture input amp and
6891 * set ADC connection to mic1 pin
6893 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6894 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6896 /* Mute all inputs to mixer widget (even unconnected ones) */
6897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6910 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6911 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6913 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6914 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6917 * for BIOS auto-configuration
6920 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6921 const char *pfx, int *vol_bits)
6924 unsigned long vol_val, sw_val;
6927 if (nid >= 0x0f && nid < 0x11) {
6928 nid_vol = nid - 0x7;
6929 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6930 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6931 } else if (nid == 0x11) {
6932 nid_vol = nid - 0x7;
6933 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6934 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6935 } else if (nid >= 0x12 && nid <= 0x15) {
6937 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6938 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6942 if (!(*vol_bits & (1 << nid_vol))) {
6943 /* first control for the volume widget */
6944 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6947 *vol_bits |= (1 << nid_vol);
6949 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6955 /* add playback controls from the parsed DAC table */
6956 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6957 const struct auto_pin_cfg *cfg)
6963 spec->multiout.num_dacs = 1;
6964 spec->multiout.dac_nids = spec->private_dac_nids;
6965 spec->multiout.dac_nids[0] = 0x02;
6967 nid = cfg->line_out_pins[0];
6970 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6972 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6976 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6981 nid = cfg->speaker_pins[0];
6983 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6988 nid = cfg->hp_pins[0];
6990 err = alc260_add_playback_controls(spec, nid, "Headphone",
6998 /* create playback/capture controls for input pins */
6999 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
7000 const struct auto_pin_cfg *cfg)
7002 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
7005 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7006 hda_nid_t nid, int pin_type,
7009 alc_set_pin_output(codec, nid, pin_type);
7010 /* need the manual connection? */
7012 int idx = nid - 0x12;
7013 snd_hda_codec_write(codec, idx + 0x0b, 0,
7014 AC_VERB_SET_CONNECT_SEL, sel_idx);
7018 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7020 struct alc_spec *spec = codec->spec;
7023 nid = spec->autocfg.line_out_pins[0];
7025 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7026 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7029 nid = spec->autocfg.speaker_pins[0];
7031 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7033 nid = spec->autocfg.hp_pins[0];
7035 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7038 #define ALC260_PIN_CD_NID 0x16
7039 static void alc260_auto_init_analog_input(struct hda_codec *codec)
7041 struct alc_spec *spec = codec->spec;
7042 struct auto_pin_cfg *cfg = &spec->autocfg;
7045 for (i = 0; i < cfg->num_inputs; i++) {
7046 hda_nid_t nid = cfg->inputs[i].pin;
7048 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
7049 if (nid != ALC260_PIN_CD_NID &&
7050 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
7051 snd_hda_codec_write(codec, nid, 0,
7052 AC_VERB_SET_AMP_GAIN_MUTE,
7058 #define alc260_auto_init_input_src alc880_auto_init_input_src
7061 * generic initialization of ADC, input mixers and output mixers
7063 static struct hda_verb alc260_volume_init_verbs[] = {
7065 * Unmute ADC0-1 and set the default input to mic-in
7067 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7068 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7069 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7070 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7072 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7074 * Note: PASD motherboards uses the Line In 2 as the input for
7075 * front panel mic (mic 2)
7077 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7078 /* mute analog inputs */
7079 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7080 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7086 * Set up output mixers (0x08 - 0x0a)
7088 /* set vol=0 to output mixers */
7089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7090 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7091 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7092 /* set up input amps for analog loopback */
7093 /* Amp Indices: DAC = 0, mixer = 1 */
7094 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7095 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7096 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7097 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7098 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7099 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7104 static int alc260_parse_auto_config(struct hda_codec *codec)
7106 struct alc_spec *spec = codec->spec;
7108 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7110 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7114 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7117 if (!spec->kctls.list)
7118 return 0; /* can't find valid BIOS pin config */
7119 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7123 spec->multiout.max_channels = 2;
7125 if (spec->autocfg.dig_outs)
7126 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7127 if (spec->kctls.list)
7128 add_mixer(spec, spec->kctls.list);
7130 add_verb(spec, alc260_volume_init_verbs);
7132 spec->num_mux_defs = 1;
7133 spec->input_mux = &spec->private_imux[0];
7135 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7140 /* additional initialization for auto-configuration model */
7141 static void alc260_auto_init(struct hda_codec *codec)
7143 struct alc_spec *spec = codec->spec;
7144 alc260_auto_init_multi_out(codec);
7145 alc260_auto_init_analog_input(codec);
7146 alc260_auto_init_input_src(codec);
7147 alc_auto_init_digital(codec);
7148 if (spec->unsol_event)
7149 alc_inithook(codec);
7152 #ifdef CONFIG_SND_HDA_POWER_SAVE
7153 static struct hda_amp_list alc260_loopbacks[] = {
7154 { 0x07, HDA_INPUT, 0 },
7155 { 0x07, HDA_INPUT, 1 },
7156 { 0x07, HDA_INPUT, 2 },
7157 { 0x07, HDA_INPUT, 3 },
7158 { 0x07, HDA_INPUT, 4 },
7170 static const struct alc_fixup alc260_fixups[] = {
7171 [PINFIX_HP_DC5750] = {
7172 .type = ALC_FIXUP_PINS,
7173 .v.pins = (const struct alc_pincfg[]) {
7174 { 0x11, 0x90130110 }, /* speaker */
7180 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7181 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7186 * ALC260 configurations
7188 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7189 [ALC260_BASIC] = "basic",
7191 [ALC260_HP_3013] = "hp-3013",
7192 [ALC260_HP_DC7600] = "hp-dc7600",
7193 [ALC260_FUJITSU_S702X] = "fujitsu",
7194 [ALC260_ACER] = "acer",
7195 [ALC260_WILL] = "will",
7196 [ALC260_REPLACER_672V] = "replacer",
7197 [ALC260_FAVORIT100] = "favorit100",
7198 #ifdef CONFIG_SND_DEBUG
7199 [ALC260_TEST] = "test",
7201 [ALC260_AUTO] = "auto",
7204 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7205 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7206 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7207 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7208 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7209 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7210 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7211 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7212 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7213 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7214 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7215 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7216 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7217 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7218 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7219 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7220 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7221 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7222 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7223 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7224 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7228 static struct alc_config_preset alc260_presets[] = {
7230 .mixers = { alc260_base_output_mixer,
7231 alc260_input_mixer },
7232 .init_verbs = { alc260_init_verbs },
7233 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7234 .dac_nids = alc260_dac_nids,
7235 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7236 .adc_nids = alc260_dual_adc_nids,
7237 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7238 .channel_mode = alc260_modes,
7239 .input_mux = &alc260_capture_source,
7242 .mixers = { alc260_hp_output_mixer,
7243 alc260_input_mixer },
7244 .init_verbs = { alc260_init_verbs,
7245 alc260_hp_unsol_verbs },
7246 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7247 .dac_nids = alc260_dac_nids,
7248 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7249 .adc_nids = alc260_adc_nids_alt,
7250 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7251 .channel_mode = alc260_modes,
7252 .input_mux = &alc260_capture_source,
7253 .unsol_event = alc260_hp_unsol_event,
7254 .init_hook = alc260_hp_automute,
7256 [ALC260_HP_DC7600] = {
7257 .mixers = { alc260_hp_dc7600_mixer,
7258 alc260_input_mixer },
7259 .init_verbs = { alc260_init_verbs,
7260 alc260_hp_dc7600_verbs },
7261 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7262 .dac_nids = alc260_dac_nids,
7263 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7264 .adc_nids = alc260_adc_nids_alt,
7265 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7266 .channel_mode = alc260_modes,
7267 .input_mux = &alc260_capture_source,
7268 .unsol_event = alc260_hp_3012_unsol_event,
7269 .init_hook = alc260_hp_3012_automute,
7271 [ALC260_HP_3013] = {
7272 .mixers = { alc260_hp_3013_mixer,
7273 alc260_input_mixer },
7274 .init_verbs = { alc260_hp_3013_init_verbs,
7275 alc260_hp_3013_unsol_verbs },
7276 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7277 .dac_nids = alc260_dac_nids,
7278 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7279 .adc_nids = alc260_adc_nids_alt,
7280 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7281 .channel_mode = alc260_modes,
7282 .input_mux = &alc260_capture_source,
7283 .unsol_event = alc260_hp_3013_unsol_event,
7284 .init_hook = alc260_hp_3013_automute,
7286 [ALC260_FUJITSU_S702X] = {
7287 .mixers = { alc260_fujitsu_mixer },
7288 .init_verbs = { alc260_fujitsu_init_verbs },
7289 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7290 .dac_nids = alc260_dac_nids,
7291 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7292 .adc_nids = alc260_dual_adc_nids,
7293 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7294 .channel_mode = alc260_modes,
7295 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7296 .input_mux = alc260_fujitsu_capture_sources,
7299 .mixers = { alc260_acer_mixer },
7300 .init_verbs = { alc260_acer_init_verbs },
7301 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7302 .dac_nids = alc260_dac_nids,
7303 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7304 .adc_nids = alc260_dual_adc_nids,
7305 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7306 .channel_mode = alc260_modes,
7307 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7308 .input_mux = alc260_acer_capture_sources,
7310 [ALC260_FAVORIT100] = {
7311 .mixers = { alc260_favorit100_mixer },
7312 .init_verbs = { alc260_favorit100_init_verbs },
7313 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7314 .dac_nids = alc260_dac_nids,
7315 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7316 .adc_nids = alc260_dual_adc_nids,
7317 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7318 .channel_mode = alc260_modes,
7319 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7320 .input_mux = alc260_favorit100_capture_sources,
7323 .mixers = { alc260_will_mixer },
7324 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7325 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7326 .dac_nids = alc260_dac_nids,
7327 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7328 .adc_nids = alc260_adc_nids,
7329 .dig_out_nid = ALC260_DIGOUT_NID,
7330 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7331 .channel_mode = alc260_modes,
7332 .input_mux = &alc260_capture_source,
7334 [ALC260_REPLACER_672V] = {
7335 .mixers = { alc260_replacer_672v_mixer },
7336 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7337 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7338 .dac_nids = alc260_dac_nids,
7339 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7340 .adc_nids = alc260_adc_nids,
7341 .dig_out_nid = ALC260_DIGOUT_NID,
7342 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7343 .channel_mode = alc260_modes,
7344 .input_mux = &alc260_capture_source,
7345 .unsol_event = alc260_replacer_672v_unsol_event,
7346 .init_hook = alc260_replacer_672v_automute,
7348 #ifdef CONFIG_SND_DEBUG
7350 .mixers = { alc260_test_mixer },
7351 .init_verbs = { alc260_test_init_verbs },
7352 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7353 .dac_nids = alc260_test_dac_nids,
7354 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7355 .adc_nids = alc260_test_adc_nids,
7356 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7357 .channel_mode = alc260_modes,
7358 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7359 .input_mux = alc260_test_capture_sources,
7364 static int patch_alc260(struct hda_codec *codec)
7366 struct alc_spec *spec;
7367 int err, board_config;
7369 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7375 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7378 if (board_config < 0) {
7379 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7381 board_config = ALC260_AUTO;
7384 if (board_config == ALC260_AUTO) {
7385 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7386 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7389 if (board_config == ALC260_AUTO) {
7390 /* automatic parse from the BIOS config */
7391 err = alc260_parse_auto_config(codec);
7397 "hda_codec: Cannot set up configuration "
7398 "from BIOS. Using base mode...\n");
7399 board_config = ALC260_BASIC;
7403 err = snd_hda_attach_beep_device(codec, 0x1);
7409 if (board_config != ALC260_AUTO)
7410 setup_preset(codec, &alc260_presets[board_config]);
7412 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7413 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7414 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7416 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7417 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7419 if (!spec->adc_nids && spec->input_mux) {
7420 /* check whether NID 0x04 is valid */
7421 unsigned int wcap = get_wcaps(codec, 0x04);
7422 wcap = get_wcaps_type(wcap);
7424 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7425 spec->adc_nids = alc260_adc_nids_alt;
7426 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7428 spec->adc_nids = alc260_adc_nids;
7429 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7432 set_capture_mixer(codec);
7433 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7435 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7437 spec->vmaster_nid = 0x08;
7439 codec->patch_ops = alc_patch_ops;
7440 if (board_config == ALC260_AUTO)
7441 spec->init_hook = alc260_auto_init;
7442 #ifdef CONFIG_SND_HDA_POWER_SAVE
7443 if (!spec->loopback.amplist)
7444 spec->loopback.amplist = alc260_loopbacks;
7452 * ALC882/883/885/888/889 support
7454 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7455 * configuration. Each pin widget can choose any input DACs and a mixer.
7456 * Each ADC is connected from a mixer of all inputs. This makes possible
7457 * 6-channel independent captures.
7459 * In addition, an independent DAC for the multi-playback (not used in this
7462 #define ALC882_DIGOUT_NID 0x06
7463 #define ALC882_DIGIN_NID 0x0a
7464 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7465 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7466 #define ALC1200_DIGOUT_NID 0x10
7469 static struct hda_channel_mode alc882_ch_modes[1] = {
7474 static hda_nid_t alc882_dac_nids[4] = {
7475 /* front, rear, clfe, rear_surr */
7476 0x02, 0x03, 0x04, 0x05
7478 #define alc883_dac_nids alc882_dac_nids
7481 #define alc882_adc_nids alc880_adc_nids
7482 #define alc882_adc_nids_alt alc880_adc_nids_alt
7483 #define alc883_adc_nids alc882_adc_nids_alt
7484 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7485 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7486 #define alc889_adc_nids alc880_adc_nids
7488 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7489 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7490 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7491 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7492 #define alc889_capsrc_nids alc882_capsrc_nids
7495 /* FIXME: should be a matrix-type input source selection */
7497 static struct hda_input_mux alc882_capture_source = {
7501 { "Front Mic", 0x1 },
7507 #define alc883_capture_source alc882_capture_source
7509 static struct hda_input_mux alc889_capture_source = {
7512 { "Front Mic", 0x0 },
7518 static struct hda_input_mux mb5_capture_source = {
7527 static struct hda_input_mux macmini3_capture_source = {
7535 static struct hda_input_mux alc883_3stack_6ch_intel = {
7539 { "Front Mic", 0x0 },
7545 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7553 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7557 { "Internal Mic", 0x1 },
7563 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7567 { "Internal Mic", 0x1 },
7571 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7575 { "Front Mic", 0x1 },
7580 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7588 static struct hda_input_mux alc889A_mb31_capture_source = {
7592 /* Front Mic (0x01) unused */
7594 /* Line 2 (0x03) unused */
7595 /* CD (0x04) unused? */
7599 static struct hda_input_mux alc889A_imac91_capture_source = {
7603 { "Line", 0x2 }, /* Not sure! */
7610 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7617 static struct hda_verb alc882_3ST_ch2_init[] = {
7618 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7619 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7620 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7621 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7628 static struct hda_verb alc882_3ST_ch4_init[] = {
7629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7631 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7632 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7633 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7640 static struct hda_verb alc882_3ST_ch6_init[] = {
7641 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7642 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7643 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7644 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7645 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7646 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7650 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7651 { 2, alc882_3ST_ch2_init },
7652 { 4, alc882_3ST_ch4_init },
7653 { 6, alc882_3ST_ch6_init },
7656 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7661 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7662 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7663 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7664 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7665 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7666 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7673 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7674 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7675 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7676 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7677 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7678 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7679 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7686 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7687 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7688 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7689 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7690 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7691 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7692 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7693 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7697 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7698 { 2, alc883_3ST_ch2_clevo_init },
7699 { 4, alc883_3ST_ch4_clevo_init },
7700 { 6, alc883_3ST_ch6_clevo_init },
7707 static struct hda_verb alc882_sixstack_ch6_init[] = {
7708 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7709 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7710 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7711 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7718 static struct hda_verb alc882_sixstack_ch8_init[] = {
7719 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7720 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7721 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7722 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7726 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7727 { 6, alc882_sixstack_ch6_init },
7728 { 8, alc882_sixstack_ch8_init },
7732 /* Macbook Air 2,1 */
7734 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7739 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7745 static struct hda_verb alc885_mbp_ch2_init[] = {
7746 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7747 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7748 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7755 static struct hda_verb alc885_mbp_ch4_init[] = {
7756 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7757 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7758 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7759 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7760 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7764 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7765 { 2, alc885_mbp_ch2_init },
7766 { 4, alc885_mbp_ch4_init },
7771 * Speakers/Woofer/HP = Front
7774 static struct hda_verb alc885_mb5_ch2_init[] = {
7775 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7776 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7782 * Speakers/HP = Front
7786 static struct hda_verb alc885_mb5_ch6_init[] = {
7787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7788 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7789 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7793 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7794 { 2, alc885_mb5_ch2_init },
7795 { 6, alc885_mb5_ch6_init },
7798 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7803 static struct hda_verb alc883_4ST_ch2_init[] = {
7804 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7805 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7806 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7807 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7808 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7809 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7816 static struct hda_verb alc883_4ST_ch4_init[] = {
7817 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7818 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7819 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7820 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7821 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7822 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7823 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7830 static struct hda_verb alc883_4ST_ch6_init[] = {
7831 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7832 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7833 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7834 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7835 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7838 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7845 static struct hda_verb alc883_4ST_ch8_init[] = {
7846 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7847 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7848 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7849 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7851 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7854 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7858 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7859 { 2, alc883_4ST_ch2_init },
7860 { 4, alc883_4ST_ch4_init },
7861 { 6, alc883_4ST_ch6_init },
7862 { 8, alc883_4ST_ch8_init },
7869 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7870 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7871 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7880 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7881 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7882 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7885 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7892 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7893 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7894 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7895 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7896 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7897 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7898 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7902 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7903 { 2, alc883_3ST_ch2_intel_init },
7904 { 4, alc883_3ST_ch4_intel_init },
7905 { 6, alc883_3ST_ch6_intel_init },
7911 static struct hda_verb alc889_ch2_intel_init[] = {
7912 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7913 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7914 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7915 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7916 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7917 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7924 static struct hda_verb alc889_ch6_intel_init[] = {
7925 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7926 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7927 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7928 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7929 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7930 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7937 static struct hda_verb alc889_ch8_intel_init[] = {
7938 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7939 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7940 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7941 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7942 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7943 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7944 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7948 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7949 { 2, alc889_ch2_intel_init },
7950 { 6, alc889_ch6_intel_init },
7951 { 8, alc889_ch8_intel_init },
7957 static struct hda_verb alc883_sixstack_ch6_init[] = {
7958 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7959 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7960 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7961 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7968 static struct hda_verb alc883_sixstack_ch8_init[] = {
7969 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7970 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7971 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7972 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7976 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7977 { 6, alc883_sixstack_ch6_init },
7978 { 8, alc883_sixstack_ch8_init },
7982 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7983 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7985 static struct snd_kcontrol_new alc882_base_mixer[] = {
7986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7988 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7989 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7990 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7991 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7992 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7993 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7995 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7997 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7998 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7999 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8000 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8002 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8010 /* Macbook Air 2,1 same control for HP and internal Speaker */
8012 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
8013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8014 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8019 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8020 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8021 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8022 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8023 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8025 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8026 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8028 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8030 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8034 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
8035 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8036 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8038 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8039 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8040 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8041 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8042 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8044 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8046 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8052 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8054 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8056 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8057 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8058 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8060 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8062 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8067 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8068 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8069 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8074 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8080 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8087 static struct snd_kcontrol_new alc882_targa_mixer[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8091 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8092 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8093 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8094 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8096 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8104 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8105 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8107 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8108 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8109 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8110 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8111 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8113 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8115 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8116 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8117 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8124 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8126 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8128 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8129 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8133 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8138 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8140 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8141 .name = "Channel Mode",
8142 .info = alc_ch_mode_info,
8143 .get = alc_ch_mode_get,
8144 .put = alc_ch_mode_put,
8149 static struct hda_verb alc882_base_init_verbs[] = {
8150 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8151 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8152 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8155 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8157 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8160 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8161 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8163 /* Front Pin: output 0 (0x0c) */
8164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8165 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8166 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8167 /* Rear Pin: output 1 (0x0d) */
8168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8170 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8171 /* CLFE Pin: output 2 (0x0e) */
8172 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8173 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8174 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8175 /* Side Pin: output 3 (0x0f) */
8176 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8177 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8178 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8179 /* Mic (rear) pin: input vref at 80% */
8180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8182 /* Front Mic pin: input vref at 80% */
8183 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8185 /* Line In pin: input */
8186 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8187 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8188 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8191 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8192 /* CD pin widget for input */
8193 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8195 /* FIXME: use matrix-type input source selection */
8196 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8201 /* ADC2: mute amp left and right */
8202 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8203 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8204 /* ADC3: mute amp left and right */
8205 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8206 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8211 static struct hda_verb alc882_adc1_init_verbs[] = {
8212 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8213 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8214 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8215 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8216 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8217 /* ADC1: mute amp left and right */
8218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8219 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8223 static struct hda_verb alc882_eapd_verbs[] = {
8224 /* change to EAPD mode */
8225 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8226 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8230 static struct hda_verb alc889_eapd_verbs[] = {
8231 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8232 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8236 static struct hda_verb alc_hp15_unsol_verbs[] = {
8237 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8242 static struct hda_verb alc885_init_verbs[] = {
8243 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8248 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8250 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8251 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8253 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8256 /* Front HP Pin: output 0 (0x0c) */
8257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8259 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8260 /* Front Pin: output 0 (0x0c) */
8261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8262 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8263 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8264 /* Rear Pin: output 1 (0x0d) */
8265 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8266 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8267 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8268 /* CLFE Pin: output 2 (0x0e) */
8269 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8270 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8271 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8272 /* Side Pin: output 3 (0x0f) */
8273 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8274 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8275 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8276 /* Mic (rear) pin: input vref at 80% */
8277 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8278 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8279 /* Front Mic pin: input vref at 80% */
8280 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8281 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8282 /* Line In pin: input */
8283 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8286 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8290 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8293 /* ADC2: mute amp left and right */
8294 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8295 /* ADC3: mute amp left and right */
8296 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8301 static struct hda_verb alc885_init_input_verbs[] = {
8302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8304 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8309 /* Unmute Selector 24h and set the default input to front mic */
8310 static struct hda_verb alc889_init_input_verbs[] = {
8311 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8317 #define alc883_init_verbs alc882_base_init_verbs
8320 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8321 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8324 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8325 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8326 /* FIXME: this looks suspicious...
8327 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8328 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8333 static struct hda_verb alc882_macpro_init_verbs[] = {
8334 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8338 /* Front Pin: output 0 (0x0c) */
8339 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8342 /* Front Mic pin: input vref at 80% */
8343 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8344 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8345 /* Speaker: output */
8346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8347 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8348 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8349 /* Headphone output (output 0 - 0x0c) */
8350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8352 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8354 /* FIXME: use matrix-type input source selection */
8355 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8356 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8357 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8358 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8359 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8371 /* ADC1: mute amp left and right */
8372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8373 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8374 /* ADC2: mute amp left and right */
8375 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8376 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8377 /* ADC3: mute amp left and right */
8378 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8379 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8385 static struct hda_verb alc885_mb5_init_verbs[] = {
8387 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8388 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8389 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8390 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8395 /* Surround mixer */
8396 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8404 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8407 /* Front Pin (0x0c) */
8408 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8409 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8410 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8411 /* LFE Pin (0x0e) */
8412 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8413 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8414 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8417 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8418 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8419 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8420 /* Front Mic pin: input vref at 80% */
8421 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8422 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8434 static struct hda_verb alc885_macmini3_init_verbs[] = {
8436 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8437 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8438 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8439 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8443 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8444 /* Surround mixer */
8445 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8447 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8451 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8454 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8455 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8456 /* Front Pin (0x0c) */
8457 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8458 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8459 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8460 /* LFE Pin (0x0e) */
8461 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8463 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8466 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8467 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8468 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8475 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8481 static struct hda_verb alc885_mba21_init_verbs[] = {
8482 /*Internal and HP Speaker Mixer*/
8483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8485 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8486 /*Internal Speaker Pin (0x0c)*/
8487 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8488 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8489 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8490 /* HP Pin: output 0 (0x0e) */
8491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8492 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8493 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8494 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8495 /* Line in (is hp when jack connected)*/
8496 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8497 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8503 /* Macbook Pro rev3 */
8504 static struct hda_verb alc885_mbp3_init_verbs[] = {
8505 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8517 /* Front Pin: output 0 (0x0c) */
8518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8520 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8521 /* HP Pin: output 0 (0x0e) */
8522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8525 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8526 /* Mic (rear) pin: input vref at 80% */
8527 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8528 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8529 /* Front Mic pin: input vref at 80% */
8530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8531 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8532 /* Line In pin: use output 1 when in LineOut mode */
8533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8535 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8537 /* FIXME: use matrix-type input source selection */
8538 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8539 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8554 /* ADC1: mute amp left and right */
8555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8556 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8557 /* ADC2: mute amp left and right */
8558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8559 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8560 /* ADC3: mute amp left and right */
8561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8568 static struct hda_verb alc885_imac91_init_verbs[] = {
8569 /* Internal Speaker Pin (0x0c) */
8570 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8571 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8572 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8573 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8574 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8575 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8579 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8580 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8584 /* Front Mic pin: input vref at 80% */
8585 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8586 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8591 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8595 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8598 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8599 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8600 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8604 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8605 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8610 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8612 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8613 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8615 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8616 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8618 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8622 /* iMac 24 mixer. */
8623 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8624 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8625 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8629 /* iMac 24 init verbs. */
8630 static struct hda_verb alc885_imac24_init_verbs[] = {
8631 /* Internal speakers: output 0 (0x0c) */
8632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8634 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8635 /* Internal speakers: output 0 (0x0c) */
8636 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8637 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8638 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8639 /* Headphone: output 0 (0x0c) */
8640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8641 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8642 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8643 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8644 /* Front Mic: input vref at 80% */
8645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8650 /* Toggle speaker-output according to the hp-jack state */
8651 static void alc885_imac24_setup(struct hda_codec *codec)
8653 struct alc_spec *spec = codec->spec;
8655 spec->autocfg.hp_pins[0] = 0x14;
8656 spec->autocfg.speaker_pins[0] = 0x18;
8657 spec->autocfg.speaker_pins[1] = 0x1a;
8660 #define alc885_mb5_setup alc885_imac24_setup
8661 #define alc885_macmini3_setup alc885_imac24_setup
8663 /* Macbook Air 2,1 */
8664 static void alc885_mba21_setup(struct hda_codec *codec)
8666 struct alc_spec *spec = codec->spec;
8668 spec->autocfg.hp_pins[0] = 0x14;
8669 spec->autocfg.speaker_pins[0] = 0x18;
8674 static void alc885_mbp3_setup(struct hda_codec *codec)
8676 struct alc_spec *spec = codec->spec;
8678 spec->autocfg.hp_pins[0] = 0x15;
8679 spec->autocfg.speaker_pins[0] = 0x14;
8682 static void alc885_imac91_setup(struct hda_codec *codec)
8684 struct alc_spec *spec = codec->spec;
8686 spec->autocfg.hp_pins[0] = 0x14;
8687 spec->autocfg.speaker_pins[0] = 0x18;
8688 spec->autocfg.speaker_pins[1] = 0x1a;
8691 static struct hda_verb alc882_targa_verbs[] = {
8692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8696 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8698 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8699 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8700 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8702 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8706 /* toggle speaker-output according to the hp-jack state */
8707 static void alc882_targa_automute(struct hda_codec *codec)
8709 struct alc_spec *spec = codec->spec;
8710 alc_automute_amp(codec);
8711 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8712 spec->jack_present ? 1 : 3);
8715 static void alc882_targa_setup(struct hda_codec *codec)
8717 struct alc_spec *spec = codec->spec;
8719 spec->autocfg.hp_pins[0] = 0x14;
8720 spec->autocfg.speaker_pins[0] = 0x1b;
8723 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8725 if ((res >> 26) == ALC880_HP_EVENT)
8726 alc882_targa_automute(codec);
8729 static struct hda_verb alc882_asus_a7j_verbs[] = {
8730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8734 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8735 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8737 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8739 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8741 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8742 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8743 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8747 static struct hda_verb alc882_asus_a7m_verbs[] = {
8748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8753 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8755 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8756 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8757 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8759 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8760 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8761 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8765 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8767 unsigned int gpiostate, gpiomask, gpiodir;
8769 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8770 AC_VERB_GET_GPIO_DATA, 0);
8773 gpiostate |= (1 << pin);
8775 gpiostate &= ~(1 << pin);
8777 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8778 AC_VERB_GET_GPIO_MASK, 0);
8779 gpiomask |= (1 << pin);
8781 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8782 AC_VERB_GET_GPIO_DIRECTION, 0);
8783 gpiodir |= (1 << pin);
8786 snd_hda_codec_write(codec, codec->afg, 0,
8787 AC_VERB_SET_GPIO_MASK, gpiomask);
8788 snd_hda_codec_write(codec, codec->afg, 0,
8789 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8793 snd_hda_codec_write(codec, codec->afg, 0,
8794 AC_VERB_SET_GPIO_DATA, gpiostate);
8797 /* set up GPIO at initialization */
8798 static void alc885_macpro_init_hook(struct hda_codec *codec)
8800 alc882_gpio_mute(codec, 0, 0);
8801 alc882_gpio_mute(codec, 1, 0);
8804 /* set up GPIO and update auto-muting at initialization */
8805 static void alc885_imac24_init_hook(struct hda_codec *codec)
8807 alc885_macpro_init_hook(codec);
8808 alc_automute_amp(codec);
8812 * generic initialization of ADC, input mixers and output mixers
8814 static struct hda_verb alc883_auto_init_verbs[] = {
8816 * Unmute ADC0-2 and set the default input to mic-in
8818 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8820 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8821 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8824 * Set up output mixers (0x0c - 0x0f)
8826 /* set vol=0 to output mixers */
8827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8828 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8829 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8830 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8831 /* set up input amps for analog loopback */
8832 /* Amp Indices: DAC = 0, mixer = 1 */
8833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8835 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8836 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8837 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8838 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8839 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8840 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8841 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8842 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8844 /* FIXME: use matrix-type input source selection */
8845 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8847 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8849 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8853 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8854 static struct hda_verb alc889A_mb31_ch2_init[] = {
8855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8856 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8857 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8858 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8862 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8863 static struct hda_verb alc889A_mb31_ch4_init[] = {
8864 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8867 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8871 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8872 static struct hda_verb alc889A_mb31_ch5_init[] = {
8873 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8874 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8875 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8880 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8881 static struct hda_verb alc889A_mb31_ch6_init[] = {
8882 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8884 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8889 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8890 { 2, alc889A_mb31_ch2_init },
8891 { 4, alc889A_mb31_ch4_init },
8892 { 5, alc889A_mb31_ch5_init },
8893 { 6, alc889A_mb31_ch6_init },
8896 static struct hda_verb alc883_medion_eapd_verbs[] = {
8897 /* eanable EAPD on medion laptop */
8898 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8899 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8903 #define alc883_base_mixer alc882_base_mixer
8905 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8906 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8907 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8908 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8909 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8910 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8911 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8912 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8913 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8914 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8915 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8916 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8917 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8922 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8923 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8924 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8925 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8926 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8927 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8928 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8930 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8931 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8932 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8936 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8937 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8938 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8940 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8942 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8944 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8945 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8946 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8950 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8951 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8952 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8953 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8954 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8955 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8956 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8957 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8959 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8961 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8962 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8967 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8968 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8969 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8970 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8971 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8972 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8973 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8974 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8975 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8976 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8977 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8978 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8979 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8980 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8982 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8984 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8985 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8990 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8992 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8993 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8994 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8995 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8997 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8998 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8999 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9001 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9002 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9003 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9004 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9006 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9008 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9009 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9010 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9014 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9015 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9016 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9017 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9018 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9019 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9021 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9022 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9023 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9024 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9025 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9027 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9028 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9029 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9030 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9032 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9033 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9034 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9038 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9039 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9040 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9041 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9042 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9043 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9044 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9045 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9046 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9047 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9048 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9049 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9050 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9051 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9053 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9055 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9056 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9057 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9061 static struct snd_kcontrol_new alc883_targa_mixer[] = {
9062 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9063 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9065 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9066 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9067 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9068 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9069 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9070 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9071 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9072 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9073 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9075 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9077 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9078 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9082 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9083 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9084 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9085 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9086 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9088 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9090 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9091 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9092 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9093 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9094 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9098 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9099 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9100 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9101 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9102 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9103 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9107 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9108 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9109 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9110 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9111 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9114 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9115 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9119 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9120 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9121 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9127 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9128 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9132 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9133 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9134 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9135 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9137 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9138 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9142 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9143 /* Unmute front mixer */
9144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9147 /* Set speaker pin to front mixer */
9148 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9150 /* Init headphone pin */
9151 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9152 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9153 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9154 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9159 /* toggle speaker-output according to the hp-jack state */
9160 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9162 struct alc_spec *spec = codec->spec;
9164 spec->autocfg.hp_pins[0] = 0x1a;
9165 spec->autocfg.speaker_pins[0] = 0x15;
9168 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9169 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9170 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9171 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9172 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9173 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9175 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9180 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9182 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9183 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9184 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9185 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9186 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9188 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9193 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9194 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9195 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9196 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9197 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9198 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9199 0x0d, 1, 0x0, HDA_OUTPUT),
9200 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9201 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9202 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9203 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9204 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9205 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9206 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9207 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9208 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9210 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9213 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9214 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9218 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9220 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9221 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9222 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9223 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9226 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9228 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9229 /* Output switches */
9230 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9231 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9232 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9234 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9235 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9244 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9246 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9249 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9254 static struct hda_bind_ctls alc883_bind_cap_vol = {
9255 .ops = &snd_hda_bind_vol,
9257 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9258 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9263 static struct hda_bind_ctls alc883_bind_cap_switch = {
9264 .ops = &snd_hda_bind_sw,
9266 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9267 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9272 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9276 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9277 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9279 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9284 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9285 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9286 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9289 /* .name = "Capture Source", */
9290 .name = "Input Source",
9292 .info = alc_mux_enum_info,
9293 .get = alc_mux_enum_get,
9294 .put = alc_mux_enum_put,
9299 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9301 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9302 .name = "Channel Mode",
9303 .info = alc_ch_mode_info,
9304 .get = alc_ch_mode_get,
9305 .put = alc_ch_mode_put,
9310 /* toggle speaker-output according to the hp-jack state */
9311 static void alc883_mitac_setup(struct hda_codec *codec)
9313 struct alc_spec *spec = codec->spec;
9315 spec->autocfg.hp_pins[0] = 0x15;
9316 spec->autocfg.speaker_pins[0] = 0x14;
9317 spec->autocfg.speaker_pins[1] = 0x17;
9320 static struct hda_verb alc883_mitac_verbs[] = {
9322 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9325 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9326 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9328 /* enable unsolicited event */
9329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9330 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9335 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9337 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9340 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9342 /* enable unsolicited event */
9344 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9345 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9351 static struct hda_verb alc883_clevo_m720_verbs[] = {
9353 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9356 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9359 /* enable unsolicited event */
9360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9361 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9366 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9368 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9371 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9374 /* enable unsolicited event */
9375 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9380 static struct hda_verb alc883_targa_verbs[] = {
9381 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9387 /* Connect Line-Out side jack (SPDIF) to Side */
9388 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9389 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9390 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9391 /* Connect Mic jack to CLFE */
9392 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9393 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9394 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9395 /* Connect Line-in jack to Surround */
9396 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9398 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9399 /* Connect HP out jack to Front */
9400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9401 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9402 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9404 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9409 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9410 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9411 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9412 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9416 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9417 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9419 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9420 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9424 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9427 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9428 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9429 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9433 static struct hda_verb alc883_haier_w66_verbs[] = {
9434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9439 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9441 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9442 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9446 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9452 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9453 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9454 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9458 static struct hda_verb alc888_6st_dell_verbs[] = {
9459 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9463 static struct hda_verb alc883_vaiott_verbs[] = {
9465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9468 /* enable unsolicited event */
9469 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9474 static void alc888_3st_hp_setup(struct hda_codec *codec)
9476 struct alc_spec *spec = codec->spec;
9478 spec->autocfg.hp_pins[0] = 0x1b;
9479 spec->autocfg.speaker_pins[0] = 0x14;
9480 spec->autocfg.speaker_pins[1] = 0x16;
9481 spec->autocfg.speaker_pins[2] = 0x18;
9484 static struct hda_verb alc888_3st_hp_verbs[] = {
9485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9486 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9487 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9488 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9495 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9496 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9497 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9498 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9499 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9506 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9507 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9508 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9509 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9510 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9511 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9518 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9519 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9520 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9521 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9522 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9523 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9524 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9528 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9529 { 2, alc888_3st_hp_2ch_init },
9530 { 4, alc888_3st_hp_4ch_init },
9531 { 6, alc888_3st_hp_6ch_init },
9534 /* toggle front-jack and RCA according to the hp-jack state */
9535 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9537 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9539 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9540 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9541 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9542 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9545 /* toggle RCA according to the front-jack state */
9546 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9548 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9550 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9551 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9554 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9557 if ((res >> 26) == ALC880_HP_EVENT)
9558 alc888_lenovo_ms7195_front_automute(codec);
9559 if ((res >> 26) == ALC880_FRONT_EVENT)
9560 alc888_lenovo_ms7195_rca_automute(codec);
9563 /* toggle speaker-output according to the hp-jack state */
9564 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9566 struct alc_spec *spec = codec->spec;
9568 spec->autocfg.hp_pins[0] = 0x14;
9569 spec->autocfg.speaker_pins[0] = 0x15;
9572 /* toggle speaker-output according to the hp-jack state */
9573 #define alc883_targa_init_hook alc882_targa_init_hook
9574 #define alc883_targa_unsol_event alc882_targa_unsol_event
9576 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9578 struct alc_spec *spec = codec->spec;
9580 spec->autocfg.hp_pins[0] = 0x15;
9581 spec->autocfg.speaker_pins[0] = 0x14;
9584 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9586 alc_automute_amp(codec);
9587 alc88x_simple_mic_automute(codec);
9590 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9593 switch (res >> 26) {
9594 case ALC880_MIC_EVENT:
9595 alc88x_simple_mic_automute(codec);
9598 alc_automute_amp_unsol_event(codec, res);
9603 /* toggle speaker-output according to the hp-jack state */
9604 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9606 struct alc_spec *spec = codec->spec;
9608 spec->autocfg.hp_pins[0] = 0x14;
9609 spec->autocfg.speaker_pins[0] = 0x15;
9612 static void alc883_haier_w66_setup(struct hda_codec *codec)
9614 struct alc_spec *spec = codec->spec;
9616 spec->autocfg.hp_pins[0] = 0x1b;
9617 spec->autocfg.speaker_pins[0] = 0x14;
9620 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9622 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9624 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9625 HDA_AMP_MUTE, bits);
9628 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9630 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9632 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9633 HDA_AMP_MUTE, bits);
9634 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9635 HDA_AMP_MUTE, bits);
9638 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9641 if ((res >> 26) == ALC880_HP_EVENT)
9642 alc883_lenovo_101e_all_automute(codec);
9643 if ((res >> 26) == ALC880_FRONT_EVENT)
9644 alc883_lenovo_101e_ispeaker_automute(codec);
9647 /* toggle speaker-output according to the hp-jack state */
9648 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9650 struct alc_spec *spec = codec->spec;
9652 spec->autocfg.hp_pins[0] = 0x14;
9653 spec->autocfg.speaker_pins[0] = 0x15;
9654 spec->autocfg.speaker_pins[1] = 0x16;
9657 static struct hda_verb alc883_acer_eapd_verbs[] = {
9658 /* HP Pin: output 0 (0x0c) */
9659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9661 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9662 /* Front Pin: output 0 (0x0c) */
9663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9664 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9665 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9666 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9667 /* eanable EAPD on medion laptop */
9668 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9669 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9670 /* enable unsolicited event */
9671 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9675 static void alc888_6st_dell_setup(struct hda_codec *codec)
9677 struct alc_spec *spec = codec->spec;
9679 spec->autocfg.hp_pins[0] = 0x1b;
9680 spec->autocfg.speaker_pins[0] = 0x14;
9681 spec->autocfg.speaker_pins[1] = 0x15;
9682 spec->autocfg.speaker_pins[2] = 0x16;
9683 spec->autocfg.speaker_pins[3] = 0x17;
9686 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9688 struct alc_spec *spec = codec->spec;
9690 spec->autocfg.hp_pins[0] = 0x1b;
9691 spec->autocfg.speaker_pins[0] = 0x14;
9692 spec->autocfg.speaker_pins[1] = 0x15;
9693 spec->autocfg.speaker_pins[2] = 0x16;
9694 spec->autocfg.speaker_pins[3] = 0x17;
9695 spec->autocfg.speaker_pins[4] = 0x1a;
9698 static void alc883_vaiott_setup(struct hda_codec *codec)
9700 struct alc_spec *spec = codec->spec;
9702 spec->autocfg.hp_pins[0] = 0x15;
9703 spec->autocfg.speaker_pins[0] = 0x14;
9704 spec->autocfg.speaker_pins[1] = 0x17;
9707 static struct hda_verb alc888_asus_m90v_verbs[] = {
9708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9711 /* enable unsolicited event */
9712 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9713 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9717 static void alc883_mode2_setup(struct hda_codec *codec)
9719 struct alc_spec *spec = codec->spec;
9721 spec->autocfg.hp_pins[0] = 0x1b;
9722 spec->autocfg.speaker_pins[0] = 0x14;
9723 spec->autocfg.speaker_pins[1] = 0x15;
9724 spec->autocfg.speaker_pins[2] = 0x16;
9725 spec->ext_mic.pin = 0x18;
9726 spec->int_mic.pin = 0x19;
9727 spec->ext_mic.mux_idx = 0;
9728 spec->int_mic.mux_idx = 1;
9732 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9734 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9736 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9737 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9738 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9739 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9740 /* enable unsolicited event */
9741 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9745 static void alc883_eee1601_inithook(struct hda_codec *codec)
9747 struct alc_spec *spec = codec->spec;
9749 spec->autocfg.hp_pins[0] = 0x14;
9750 spec->autocfg.speaker_pins[0] = 0x1b;
9751 alc_automute_pin(codec);
9754 static struct hda_verb alc889A_mb31_verbs[] = {
9755 /* Init rear pin (used as headphone output) */
9756 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9757 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9758 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9759 /* Init line pin (used as output in 4ch and 6ch mode) */
9760 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9761 /* Init line 2 pin (used as headphone out by default) */
9762 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9763 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9767 /* Mute speakers according to the headphone jack state */
9768 static void alc889A_mb31_automute(struct hda_codec *codec)
9770 unsigned int present;
9772 /* Mute only in 2ch or 4ch mode */
9773 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9775 present = snd_hda_jack_detect(codec, 0x15);
9776 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9777 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9778 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9779 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9783 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9785 if ((res >> 26) == ALC880_HP_EVENT)
9786 alc889A_mb31_automute(codec);
9790 #ifdef CONFIG_SND_HDA_POWER_SAVE
9791 #define alc882_loopbacks alc880_loopbacks
9794 /* pcm configuration: identical with ALC880 */
9795 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9796 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9797 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9798 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9800 static hda_nid_t alc883_slave_dig_outs[] = {
9801 ALC1200_DIGOUT_NID, 0,
9804 static hda_nid_t alc1200_slave_dig_outs[] = {
9805 ALC883_DIGOUT_NID, 0,
9809 * configuration and preset
9811 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9812 [ALC882_3ST_DIG] = "3stack-dig",
9813 [ALC882_6ST_DIG] = "6stack-dig",
9814 [ALC882_ARIMA] = "arima",
9815 [ALC882_W2JC] = "w2jc",
9816 [ALC882_TARGA] = "targa",
9817 [ALC882_ASUS_A7J] = "asus-a7j",
9818 [ALC882_ASUS_A7M] = "asus-a7m",
9819 [ALC885_MACPRO] = "macpro",
9820 [ALC885_MB5] = "mb5",
9821 [ALC885_MACMINI3] = "macmini3",
9822 [ALC885_MBA21] = "mba21",
9823 [ALC885_MBP3] = "mbp3",
9824 [ALC885_IMAC24] = "imac24",
9825 [ALC885_IMAC91] = "imac91",
9826 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9827 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9828 [ALC883_3ST_6ch] = "3stack-6ch",
9829 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9830 [ALC883_TARGA_DIG] = "targa-dig",
9831 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9832 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9833 [ALC883_ACER] = "acer",
9834 [ALC883_ACER_ASPIRE] = "acer-aspire",
9835 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9836 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9837 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9838 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9839 [ALC883_MEDION] = "medion",
9840 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9841 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9842 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9843 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9844 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9845 [ALC888_LENOVO_SKY] = "lenovo-sky",
9846 [ALC883_HAIER_W66] = "haier-w66",
9847 [ALC888_3ST_HP] = "3stack-hp",
9848 [ALC888_6ST_DELL] = "6stack-dell",
9849 [ALC883_MITAC] = "mitac",
9850 [ALC883_CLEVO_M540R] = "clevo-m540r",
9851 [ALC883_CLEVO_M720] = "clevo-m720",
9852 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9853 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9854 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9855 [ALC889A_INTEL] = "intel-alc889a",
9856 [ALC889_INTEL] = "intel-x58",
9857 [ALC1200_ASUS_P5Q] = "asus-p5q",
9858 [ALC889A_MB31] = "mb31",
9859 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9860 [ALC882_AUTO] = "auto",
9863 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9864 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9866 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9867 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9868 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9869 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9870 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9871 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9872 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9873 ALC888_ACER_ASPIRE_4930G),
9874 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9875 ALC888_ACER_ASPIRE_4930G),
9876 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9877 ALC888_ACER_ASPIRE_8930G),
9878 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9879 ALC888_ACER_ASPIRE_8930G),
9880 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9881 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9882 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9883 ALC888_ACER_ASPIRE_6530G),
9884 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9885 ALC888_ACER_ASPIRE_6530G),
9886 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9887 ALC888_ACER_ASPIRE_7730G),
9888 /* default Acer -- disabled as it causes more problems.
9889 * model=auto should work fine now
9891 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9893 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9895 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9896 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9897 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9898 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9899 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9900 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9902 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9903 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9904 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9905 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9906 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9907 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9908 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9909 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9910 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9911 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9912 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9914 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9915 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9916 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9917 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9918 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9919 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9920 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9921 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9922 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9924 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9925 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9926 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9927 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9928 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9929 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9930 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9931 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9932 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9933 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9934 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9935 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9936 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9937 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9938 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9939 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9940 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9941 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9942 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9943 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9944 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9945 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9946 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9947 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9948 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9949 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9950 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9951 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9952 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9953 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9954 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9956 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9957 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9958 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9959 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9960 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9961 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9962 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9963 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9964 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9965 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9966 ALC883_FUJITSU_PI2515),
9967 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9968 ALC888_FUJITSU_XA3530),
9969 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9970 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9971 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9972 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9973 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9974 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9975 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9976 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9978 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9979 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9980 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9981 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9982 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9983 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9984 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9989 /* codec SSID table for Intel Mac */
9990 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9991 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9992 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9993 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9994 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9995 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9996 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9997 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9998 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9999 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
10000 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
10001 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
10002 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10003 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10004 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10005 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10006 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10007 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10008 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10009 * so apparently no perfect solution yet
10011 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10012 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10013 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10014 {} /* terminator */
10017 static struct alc_config_preset alc882_presets[] = {
10018 [ALC882_3ST_DIG] = {
10019 .mixers = { alc882_base_mixer },
10020 .init_verbs = { alc882_base_init_verbs,
10021 alc882_adc1_init_verbs },
10022 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10023 .dac_nids = alc882_dac_nids,
10024 .dig_out_nid = ALC882_DIGOUT_NID,
10025 .dig_in_nid = ALC882_DIGIN_NID,
10026 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10027 .channel_mode = alc882_ch_modes,
10029 .input_mux = &alc882_capture_source,
10031 [ALC882_6ST_DIG] = {
10032 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10033 .init_verbs = { alc882_base_init_verbs,
10034 alc882_adc1_init_verbs },
10035 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10036 .dac_nids = alc882_dac_nids,
10037 .dig_out_nid = ALC882_DIGOUT_NID,
10038 .dig_in_nid = ALC882_DIGIN_NID,
10039 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10040 .channel_mode = alc882_sixstack_modes,
10041 .input_mux = &alc882_capture_source,
10044 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10045 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10046 alc882_eapd_verbs },
10047 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10048 .dac_nids = alc882_dac_nids,
10049 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10050 .channel_mode = alc882_sixstack_modes,
10051 .input_mux = &alc882_capture_source,
10054 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10055 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10056 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10057 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10058 .dac_nids = alc882_dac_nids,
10059 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10060 .channel_mode = alc880_threestack_modes,
10062 .input_mux = &alc882_capture_source,
10063 .dig_out_nid = ALC882_DIGOUT_NID,
10066 .mixers = { alc885_mba21_mixer },
10067 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10069 .dac_nids = alc882_dac_nids,
10070 .channel_mode = alc885_mba21_ch_modes,
10071 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10072 .input_mux = &alc882_capture_source,
10073 .unsol_event = alc_automute_amp_unsol_event,
10074 .setup = alc885_mba21_setup,
10075 .init_hook = alc_automute_amp,
10078 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10079 .init_verbs = { alc885_mbp3_init_verbs,
10080 alc880_gpio1_init_verbs },
10082 .dac_nids = alc882_dac_nids,
10084 .channel_mode = alc885_mbp_4ch_modes,
10085 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10086 .input_mux = &alc882_capture_source,
10087 .dig_out_nid = ALC882_DIGOUT_NID,
10088 .dig_in_nid = ALC882_DIGIN_NID,
10089 .unsol_event = alc_automute_amp_unsol_event,
10090 .setup = alc885_mbp3_setup,
10091 .init_hook = alc_automute_amp,
10094 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10095 .init_verbs = { alc885_mb5_init_verbs,
10096 alc880_gpio1_init_verbs },
10097 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10098 .dac_nids = alc882_dac_nids,
10099 .channel_mode = alc885_mb5_6ch_modes,
10100 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10101 .input_mux = &mb5_capture_source,
10102 .dig_out_nid = ALC882_DIGOUT_NID,
10103 .dig_in_nid = ALC882_DIGIN_NID,
10104 .unsol_event = alc_automute_amp_unsol_event,
10105 .setup = alc885_mb5_setup,
10106 .init_hook = alc_automute_amp,
10108 [ALC885_MACMINI3] = {
10109 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10110 .init_verbs = { alc885_macmini3_init_verbs,
10111 alc880_gpio1_init_verbs },
10112 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10113 .dac_nids = alc882_dac_nids,
10114 .channel_mode = alc885_macmini3_6ch_modes,
10115 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10116 .input_mux = &macmini3_capture_source,
10117 .dig_out_nid = ALC882_DIGOUT_NID,
10118 .dig_in_nid = ALC882_DIGIN_NID,
10119 .unsol_event = alc_automute_amp_unsol_event,
10120 .setup = alc885_macmini3_setup,
10121 .init_hook = alc_automute_amp,
10123 [ALC885_MACPRO] = {
10124 .mixers = { alc882_macpro_mixer },
10125 .init_verbs = { alc882_macpro_init_verbs },
10126 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10127 .dac_nids = alc882_dac_nids,
10128 .dig_out_nid = ALC882_DIGOUT_NID,
10129 .dig_in_nid = ALC882_DIGIN_NID,
10130 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10131 .channel_mode = alc882_ch_modes,
10132 .input_mux = &alc882_capture_source,
10133 .init_hook = alc885_macpro_init_hook,
10135 [ALC885_IMAC24] = {
10136 .mixers = { alc885_imac24_mixer },
10137 .init_verbs = { alc885_imac24_init_verbs },
10138 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10139 .dac_nids = alc882_dac_nids,
10140 .dig_out_nid = ALC882_DIGOUT_NID,
10141 .dig_in_nid = ALC882_DIGIN_NID,
10142 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10143 .channel_mode = alc882_ch_modes,
10144 .input_mux = &alc882_capture_source,
10145 .unsol_event = alc_automute_amp_unsol_event,
10146 .setup = alc885_imac24_setup,
10147 .init_hook = alc885_imac24_init_hook,
10149 [ALC885_IMAC91] = {
10150 .mixers = {alc885_imac91_mixer},
10151 .init_verbs = { alc885_imac91_init_verbs,
10152 alc880_gpio1_init_verbs },
10153 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10154 .dac_nids = alc882_dac_nids,
10155 .channel_mode = alc885_mba21_ch_modes,
10156 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10157 .input_mux = &alc889A_imac91_capture_source,
10158 .dig_out_nid = ALC882_DIGOUT_NID,
10159 .dig_in_nid = ALC882_DIGIN_NID,
10160 .unsol_event = alc_automute_amp_unsol_event,
10161 .setup = alc885_imac91_setup,
10162 .init_hook = alc_automute_amp,
10165 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10166 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10167 alc880_gpio3_init_verbs, alc882_targa_verbs},
10168 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10169 .dac_nids = alc882_dac_nids,
10170 .dig_out_nid = ALC882_DIGOUT_NID,
10171 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10172 .adc_nids = alc882_adc_nids,
10173 .capsrc_nids = alc882_capsrc_nids,
10174 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10175 .channel_mode = alc882_3ST_6ch_modes,
10177 .input_mux = &alc882_capture_source,
10178 .unsol_event = alc882_targa_unsol_event,
10179 .setup = alc882_targa_setup,
10180 .init_hook = alc882_targa_automute,
10182 [ALC882_ASUS_A7J] = {
10183 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10184 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10185 alc882_asus_a7j_verbs},
10186 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10187 .dac_nids = alc882_dac_nids,
10188 .dig_out_nid = ALC882_DIGOUT_NID,
10189 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10190 .adc_nids = alc882_adc_nids,
10191 .capsrc_nids = alc882_capsrc_nids,
10192 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10193 .channel_mode = alc882_3ST_6ch_modes,
10195 .input_mux = &alc882_capture_source,
10197 [ALC882_ASUS_A7M] = {
10198 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10199 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10200 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10201 alc882_asus_a7m_verbs },
10202 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10203 .dac_nids = alc882_dac_nids,
10204 .dig_out_nid = ALC882_DIGOUT_NID,
10205 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10206 .channel_mode = alc880_threestack_modes,
10208 .input_mux = &alc882_capture_source,
10210 [ALC883_3ST_2ch_DIG] = {
10211 .mixers = { alc883_3ST_2ch_mixer },
10212 .init_verbs = { alc883_init_verbs },
10213 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10214 .dac_nids = alc883_dac_nids,
10215 .dig_out_nid = ALC883_DIGOUT_NID,
10216 .dig_in_nid = ALC883_DIGIN_NID,
10217 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10218 .channel_mode = alc883_3ST_2ch_modes,
10219 .input_mux = &alc883_capture_source,
10221 [ALC883_3ST_6ch_DIG] = {
10222 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10223 .init_verbs = { alc883_init_verbs },
10224 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10225 .dac_nids = alc883_dac_nids,
10226 .dig_out_nid = ALC883_DIGOUT_NID,
10227 .dig_in_nid = ALC883_DIGIN_NID,
10228 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10229 .channel_mode = alc883_3ST_6ch_modes,
10231 .input_mux = &alc883_capture_source,
10233 [ALC883_3ST_6ch] = {
10234 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10235 .init_verbs = { alc883_init_verbs },
10236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10237 .dac_nids = alc883_dac_nids,
10238 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10239 .channel_mode = alc883_3ST_6ch_modes,
10241 .input_mux = &alc883_capture_source,
10243 [ALC883_3ST_6ch_INTEL] = {
10244 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10245 .init_verbs = { alc883_init_verbs },
10246 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10247 .dac_nids = alc883_dac_nids,
10248 .dig_out_nid = ALC883_DIGOUT_NID,
10249 .dig_in_nid = ALC883_DIGIN_NID,
10250 .slave_dig_outs = alc883_slave_dig_outs,
10251 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10252 .channel_mode = alc883_3ST_6ch_intel_modes,
10254 .input_mux = &alc883_3stack_6ch_intel,
10256 [ALC889A_INTEL] = {
10257 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10258 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10259 alc_hp15_unsol_verbs },
10260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10261 .dac_nids = alc883_dac_nids,
10262 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10263 .adc_nids = alc889_adc_nids,
10264 .dig_out_nid = ALC883_DIGOUT_NID,
10265 .dig_in_nid = ALC883_DIGIN_NID,
10266 .slave_dig_outs = alc883_slave_dig_outs,
10267 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10268 .channel_mode = alc889_8ch_intel_modes,
10269 .capsrc_nids = alc889_capsrc_nids,
10270 .input_mux = &alc889_capture_source,
10271 .setup = alc889_automute_setup,
10272 .init_hook = alc_automute_amp,
10273 .unsol_event = alc_automute_amp_unsol_event,
10277 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10278 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10279 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10280 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10281 .dac_nids = alc883_dac_nids,
10282 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10283 .adc_nids = alc889_adc_nids,
10284 .dig_out_nid = ALC883_DIGOUT_NID,
10285 .dig_in_nid = ALC883_DIGIN_NID,
10286 .slave_dig_outs = alc883_slave_dig_outs,
10287 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10288 .channel_mode = alc889_8ch_intel_modes,
10289 .capsrc_nids = alc889_capsrc_nids,
10290 .input_mux = &alc889_capture_source,
10291 .setup = alc889_automute_setup,
10292 .init_hook = alc889_intel_init_hook,
10293 .unsol_event = alc_automute_amp_unsol_event,
10296 [ALC883_6ST_DIG] = {
10297 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10298 .init_verbs = { alc883_init_verbs },
10299 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10300 .dac_nids = alc883_dac_nids,
10301 .dig_out_nid = ALC883_DIGOUT_NID,
10302 .dig_in_nid = ALC883_DIGIN_NID,
10303 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10304 .channel_mode = alc883_sixstack_modes,
10305 .input_mux = &alc883_capture_source,
10307 [ALC883_TARGA_DIG] = {
10308 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10309 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10310 alc883_targa_verbs},
10311 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10312 .dac_nids = alc883_dac_nids,
10313 .dig_out_nid = ALC883_DIGOUT_NID,
10314 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10315 .channel_mode = alc883_3ST_6ch_modes,
10317 .input_mux = &alc883_capture_source,
10318 .unsol_event = alc883_targa_unsol_event,
10319 .setup = alc882_targa_setup,
10320 .init_hook = alc882_targa_automute,
10322 [ALC883_TARGA_2ch_DIG] = {
10323 .mixers = { alc883_targa_2ch_mixer},
10324 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10325 alc883_targa_verbs},
10326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10327 .dac_nids = alc883_dac_nids,
10328 .adc_nids = alc883_adc_nids_alt,
10329 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10330 .capsrc_nids = alc883_capsrc_nids,
10331 .dig_out_nid = ALC883_DIGOUT_NID,
10332 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10333 .channel_mode = alc883_3ST_2ch_modes,
10334 .input_mux = &alc883_capture_source,
10335 .unsol_event = alc883_targa_unsol_event,
10336 .setup = alc882_targa_setup,
10337 .init_hook = alc882_targa_automute,
10339 [ALC883_TARGA_8ch_DIG] = {
10340 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10341 alc883_chmode_mixer },
10342 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10343 alc883_targa_verbs },
10344 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10345 .dac_nids = alc883_dac_nids,
10346 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10347 .adc_nids = alc883_adc_nids_rev,
10348 .capsrc_nids = alc883_capsrc_nids_rev,
10349 .dig_out_nid = ALC883_DIGOUT_NID,
10350 .dig_in_nid = ALC883_DIGIN_NID,
10351 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10352 .channel_mode = alc883_4ST_8ch_modes,
10354 .input_mux = &alc883_capture_source,
10355 .unsol_event = alc883_targa_unsol_event,
10356 .setup = alc882_targa_setup,
10357 .init_hook = alc882_targa_automute,
10360 .mixers = { alc883_base_mixer },
10361 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10362 * and the headphone jack. Turn this on and rely on the
10363 * standard mute methods whenever the user wants to turn
10364 * these outputs off.
10366 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10367 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10368 .dac_nids = alc883_dac_nids,
10369 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10370 .channel_mode = alc883_3ST_2ch_modes,
10371 .input_mux = &alc883_capture_source,
10373 [ALC883_ACER_ASPIRE] = {
10374 .mixers = { alc883_acer_aspire_mixer },
10375 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10377 .dac_nids = alc883_dac_nids,
10378 .dig_out_nid = ALC883_DIGOUT_NID,
10379 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10380 .channel_mode = alc883_3ST_2ch_modes,
10381 .input_mux = &alc883_capture_source,
10382 .unsol_event = alc_automute_amp_unsol_event,
10383 .setup = alc883_acer_aspire_setup,
10384 .init_hook = alc_automute_amp,
10386 [ALC888_ACER_ASPIRE_4930G] = {
10387 .mixers = { alc888_acer_aspire_4930g_mixer,
10388 alc883_chmode_mixer },
10389 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10390 alc888_acer_aspire_4930g_verbs },
10391 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10392 .dac_nids = alc883_dac_nids,
10393 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10394 .adc_nids = alc883_adc_nids_rev,
10395 .capsrc_nids = alc883_capsrc_nids_rev,
10396 .dig_out_nid = ALC883_DIGOUT_NID,
10397 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10398 .channel_mode = alc883_3ST_6ch_modes,
10400 .const_channel_count = 6,
10402 ARRAY_SIZE(alc888_2_capture_sources),
10403 .input_mux = alc888_2_capture_sources,
10404 .unsol_event = alc_automute_amp_unsol_event,
10405 .setup = alc888_acer_aspire_4930g_setup,
10406 .init_hook = alc_automute_amp,
10408 [ALC888_ACER_ASPIRE_6530G] = {
10409 .mixers = { alc888_acer_aspire_6530_mixer },
10410 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10411 alc888_acer_aspire_6530g_verbs },
10412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10413 .dac_nids = alc883_dac_nids,
10414 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10415 .adc_nids = alc883_adc_nids_rev,
10416 .capsrc_nids = alc883_capsrc_nids_rev,
10417 .dig_out_nid = ALC883_DIGOUT_NID,
10418 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10419 .channel_mode = alc883_3ST_2ch_modes,
10421 ARRAY_SIZE(alc888_2_capture_sources),
10422 .input_mux = alc888_acer_aspire_6530_sources,
10423 .unsol_event = alc_automute_amp_unsol_event,
10424 .setup = alc888_acer_aspire_6530g_setup,
10425 .init_hook = alc_automute_amp,
10427 [ALC888_ACER_ASPIRE_8930G] = {
10428 .mixers = { alc889_acer_aspire_8930g_mixer,
10429 alc883_chmode_mixer },
10430 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10431 alc889_acer_aspire_8930g_verbs,
10432 alc889_eapd_verbs},
10433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10434 .dac_nids = alc883_dac_nids,
10435 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10436 .adc_nids = alc889_adc_nids,
10437 .capsrc_nids = alc889_capsrc_nids,
10438 .dig_out_nid = ALC883_DIGOUT_NID,
10439 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10440 .channel_mode = alc883_3ST_6ch_modes,
10442 .const_channel_count = 6,
10444 ARRAY_SIZE(alc889_capture_sources),
10445 .input_mux = alc889_capture_sources,
10446 .unsol_event = alc_automute_amp_unsol_event,
10447 .setup = alc889_acer_aspire_8930g_setup,
10448 .init_hook = alc_automute_amp,
10449 #ifdef CONFIG_SND_HDA_POWER_SAVE
10450 .power_hook = alc_power_eapd,
10453 [ALC888_ACER_ASPIRE_7730G] = {
10454 .mixers = { alc883_3ST_6ch_mixer,
10455 alc883_chmode_mixer },
10456 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10457 alc888_acer_aspire_7730G_verbs },
10458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10459 .dac_nids = alc883_dac_nids,
10460 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10461 .adc_nids = alc883_adc_nids_rev,
10462 .capsrc_nids = alc883_capsrc_nids_rev,
10463 .dig_out_nid = ALC883_DIGOUT_NID,
10464 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10465 .channel_mode = alc883_3ST_6ch_modes,
10467 .const_channel_count = 6,
10468 .input_mux = &alc883_capture_source,
10469 .unsol_event = alc_automute_amp_unsol_event,
10470 .setup = alc888_acer_aspire_7730g_setup,
10471 .init_hook = alc_automute_amp,
10473 [ALC883_MEDION] = {
10474 .mixers = { alc883_fivestack_mixer,
10475 alc883_chmode_mixer },
10476 .init_verbs = { alc883_init_verbs,
10477 alc883_medion_eapd_verbs },
10478 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10479 .dac_nids = alc883_dac_nids,
10480 .adc_nids = alc883_adc_nids_alt,
10481 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10482 .capsrc_nids = alc883_capsrc_nids,
10483 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10484 .channel_mode = alc883_sixstack_modes,
10485 .input_mux = &alc883_capture_source,
10487 [ALC883_MEDION_WIM2160] = {
10488 .mixers = { alc883_medion_wim2160_mixer },
10489 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10490 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10491 .dac_nids = alc883_dac_nids,
10492 .dig_out_nid = ALC883_DIGOUT_NID,
10493 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10494 .adc_nids = alc883_adc_nids,
10495 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10496 .channel_mode = alc883_3ST_2ch_modes,
10497 .input_mux = &alc883_capture_source,
10498 .unsol_event = alc_automute_amp_unsol_event,
10499 .setup = alc883_medion_wim2160_setup,
10500 .init_hook = alc_automute_amp,
10502 [ALC883_LAPTOP_EAPD] = {
10503 .mixers = { alc883_base_mixer },
10504 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10505 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10506 .dac_nids = alc883_dac_nids,
10507 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10508 .channel_mode = alc883_3ST_2ch_modes,
10509 .input_mux = &alc883_capture_source,
10511 [ALC883_CLEVO_M540R] = {
10512 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10513 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10514 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10515 .dac_nids = alc883_dac_nids,
10516 .dig_out_nid = ALC883_DIGOUT_NID,
10517 .dig_in_nid = ALC883_DIGIN_NID,
10518 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10519 .channel_mode = alc883_3ST_6ch_clevo_modes,
10521 .input_mux = &alc883_capture_source,
10522 /* This machine has the hardware HP auto-muting, thus
10523 * we need no software mute via unsol event
10526 [ALC883_CLEVO_M720] = {
10527 .mixers = { alc883_clevo_m720_mixer },
10528 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10529 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10530 .dac_nids = alc883_dac_nids,
10531 .dig_out_nid = ALC883_DIGOUT_NID,
10532 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10533 .channel_mode = alc883_3ST_2ch_modes,
10534 .input_mux = &alc883_capture_source,
10535 .unsol_event = alc883_clevo_m720_unsol_event,
10536 .setup = alc883_clevo_m720_setup,
10537 .init_hook = alc883_clevo_m720_init_hook,
10539 [ALC883_LENOVO_101E_2ch] = {
10540 .mixers = { alc883_lenovo_101e_2ch_mixer},
10541 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10542 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10543 .dac_nids = alc883_dac_nids,
10544 .adc_nids = alc883_adc_nids_alt,
10545 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10546 .capsrc_nids = alc883_capsrc_nids,
10547 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10548 .channel_mode = alc883_3ST_2ch_modes,
10549 .input_mux = &alc883_lenovo_101e_capture_source,
10550 .unsol_event = alc883_lenovo_101e_unsol_event,
10551 .init_hook = alc883_lenovo_101e_all_automute,
10553 [ALC883_LENOVO_NB0763] = {
10554 .mixers = { alc883_lenovo_nb0763_mixer },
10555 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10556 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10557 .dac_nids = alc883_dac_nids,
10558 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10559 .channel_mode = alc883_3ST_2ch_modes,
10561 .input_mux = &alc883_lenovo_nb0763_capture_source,
10562 .unsol_event = alc_automute_amp_unsol_event,
10563 .setup = alc883_lenovo_nb0763_setup,
10564 .init_hook = alc_automute_amp,
10566 [ALC888_LENOVO_MS7195_DIG] = {
10567 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10568 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10570 .dac_nids = alc883_dac_nids,
10571 .dig_out_nid = ALC883_DIGOUT_NID,
10572 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10573 .channel_mode = alc883_3ST_6ch_modes,
10575 .input_mux = &alc883_capture_source,
10576 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10577 .init_hook = alc888_lenovo_ms7195_front_automute,
10579 [ALC883_HAIER_W66] = {
10580 .mixers = { alc883_targa_2ch_mixer},
10581 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10582 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10583 .dac_nids = alc883_dac_nids,
10584 .dig_out_nid = ALC883_DIGOUT_NID,
10585 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10586 .channel_mode = alc883_3ST_2ch_modes,
10587 .input_mux = &alc883_capture_source,
10588 .unsol_event = alc_automute_amp_unsol_event,
10589 .setup = alc883_haier_w66_setup,
10590 .init_hook = alc_automute_amp,
10592 [ALC888_3ST_HP] = {
10593 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10594 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10595 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10596 .dac_nids = alc883_dac_nids,
10597 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10598 .channel_mode = alc888_3st_hp_modes,
10600 .input_mux = &alc883_capture_source,
10601 .unsol_event = alc_automute_amp_unsol_event,
10602 .setup = alc888_3st_hp_setup,
10603 .init_hook = alc_automute_amp,
10605 [ALC888_6ST_DELL] = {
10606 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10607 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10608 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10609 .dac_nids = alc883_dac_nids,
10610 .dig_out_nid = ALC883_DIGOUT_NID,
10611 .dig_in_nid = ALC883_DIGIN_NID,
10612 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10613 .channel_mode = alc883_sixstack_modes,
10614 .input_mux = &alc883_capture_source,
10615 .unsol_event = alc_automute_amp_unsol_event,
10616 .setup = alc888_6st_dell_setup,
10617 .init_hook = alc_automute_amp,
10620 .mixers = { alc883_mitac_mixer },
10621 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10622 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10623 .dac_nids = alc883_dac_nids,
10624 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10625 .channel_mode = alc883_3ST_2ch_modes,
10626 .input_mux = &alc883_capture_source,
10627 .unsol_event = alc_automute_amp_unsol_event,
10628 .setup = alc883_mitac_setup,
10629 .init_hook = alc_automute_amp,
10631 [ALC883_FUJITSU_PI2515] = {
10632 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10633 .init_verbs = { alc883_init_verbs,
10634 alc883_2ch_fujitsu_pi2515_verbs},
10635 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10636 .dac_nids = alc883_dac_nids,
10637 .dig_out_nid = ALC883_DIGOUT_NID,
10638 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10639 .channel_mode = alc883_3ST_2ch_modes,
10640 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10641 .unsol_event = alc_automute_amp_unsol_event,
10642 .setup = alc883_2ch_fujitsu_pi2515_setup,
10643 .init_hook = alc_automute_amp,
10645 [ALC888_FUJITSU_XA3530] = {
10646 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10647 .init_verbs = { alc883_init_verbs,
10648 alc888_fujitsu_xa3530_verbs },
10649 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10650 .dac_nids = alc883_dac_nids,
10651 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10652 .adc_nids = alc883_adc_nids_rev,
10653 .capsrc_nids = alc883_capsrc_nids_rev,
10654 .dig_out_nid = ALC883_DIGOUT_NID,
10655 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10656 .channel_mode = alc888_4ST_8ch_intel_modes,
10658 ARRAY_SIZE(alc888_2_capture_sources),
10659 .input_mux = alc888_2_capture_sources,
10660 .unsol_event = alc_automute_amp_unsol_event,
10661 .setup = alc888_fujitsu_xa3530_setup,
10662 .init_hook = alc_automute_amp,
10664 [ALC888_LENOVO_SKY] = {
10665 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10666 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10667 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10668 .dac_nids = alc883_dac_nids,
10669 .dig_out_nid = ALC883_DIGOUT_NID,
10670 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10671 .channel_mode = alc883_sixstack_modes,
10673 .input_mux = &alc883_lenovo_sky_capture_source,
10674 .unsol_event = alc_automute_amp_unsol_event,
10675 .setup = alc888_lenovo_sky_setup,
10676 .init_hook = alc_automute_amp,
10678 [ALC888_ASUS_M90V] = {
10679 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10680 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10681 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10682 .dac_nids = alc883_dac_nids,
10683 .dig_out_nid = ALC883_DIGOUT_NID,
10684 .dig_in_nid = ALC883_DIGIN_NID,
10685 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10686 .channel_mode = alc883_3ST_6ch_modes,
10688 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10689 .unsol_event = alc_sku_unsol_event,
10690 .setup = alc883_mode2_setup,
10691 .init_hook = alc_inithook,
10693 [ALC888_ASUS_EEE1601] = {
10694 .mixers = { alc883_asus_eee1601_mixer },
10695 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10696 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10697 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10698 .dac_nids = alc883_dac_nids,
10699 .dig_out_nid = ALC883_DIGOUT_NID,
10700 .dig_in_nid = ALC883_DIGIN_NID,
10701 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10702 .channel_mode = alc883_3ST_2ch_modes,
10704 .input_mux = &alc883_asus_eee1601_capture_source,
10705 .unsol_event = alc_sku_unsol_event,
10706 .init_hook = alc883_eee1601_inithook,
10708 [ALC1200_ASUS_P5Q] = {
10709 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10710 .init_verbs = { alc883_init_verbs },
10711 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10712 .dac_nids = alc883_dac_nids,
10713 .dig_out_nid = ALC1200_DIGOUT_NID,
10714 .dig_in_nid = ALC883_DIGIN_NID,
10715 .slave_dig_outs = alc1200_slave_dig_outs,
10716 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10717 .channel_mode = alc883_sixstack_modes,
10718 .input_mux = &alc883_capture_source,
10721 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10722 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10723 alc880_gpio1_init_verbs },
10724 .adc_nids = alc883_adc_nids,
10725 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10726 .capsrc_nids = alc883_capsrc_nids,
10727 .dac_nids = alc883_dac_nids,
10728 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10729 .channel_mode = alc889A_mb31_6ch_modes,
10730 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10731 .input_mux = &alc889A_mb31_capture_source,
10732 .dig_out_nid = ALC883_DIGOUT_NID,
10733 .unsol_event = alc889A_mb31_unsol_event,
10734 .init_hook = alc889A_mb31_automute,
10736 [ALC883_SONY_VAIO_TT] = {
10737 .mixers = { alc883_vaiott_mixer },
10738 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10739 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10740 .dac_nids = alc883_dac_nids,
10741 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10742 .channel_mode = alc883_3ST_2ch_modes,
10743 .input_mux = &alc883_capture_source,
10744 .unsol_event = alc_automute_amp_unsol_event,
10745 .setup = alc883_vaiott_setup,
10746 .init_hook = alc_automute_amp,
10755 PINFIX_ABIT_AW9D_MAX,
10756 PINFIX_LENOVO_Y530,
10758 PINFIX_ACER_ASPIRE_7736,
10761 static const struct alc_fixup alc882_fixups[] = {
10762 [PINFIX_ABIT_AW9D_MAX] = {
10763 .type = ALC_FIXUP_PINS,
10764 .v.pins = (const struct alc_pincfg[]) {
10765 { 0x15, 0x01080104 }, /* side */
10766 { 0x16, 0x01011012 }, /* rear */
10767 { 0x17, 0x01016011 }, /* clfe */
10771 [PINFIX_LENOVO_Y530] = {
10772 .type = ALC_FIXUP_PINS,
10773 .v.pins = (const struct alc_pincfg[]) {
10774 { 0x15, 0x99130112 }, /* rear int speakers */
10775 { 0x16, 0x99130111 }, /* subwoofer */
10779 [PINFIX_PB_M5210] = {
10780 .type = ALC_FIXUP_VERBS,
10781 .v.verbs = (const struct hda_verb[]) {
10782 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10786 [PINFIX_ACER_ASPIRE_7736] = {
10787 .type = ALC_FIXUP_SKU,
10788 .v.sku = ALC_FIXUP_SKU_IGNORE,
10792 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10793 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10794 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10795 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10796 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10801 * BIOS auto configuration
10803 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10804 const struct auto_pin_cfg *cfg)
10806 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10809 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10810 hda_nid_t nid, int pin_type,
10815 /* set as output */
10816 alc_set_pin_output(codec, nid, pin_type);
10820 else if (dac >= 0x02 && dac <= 0x05)
10824 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10827 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10829 struct alc_spec *spec = codec->spec;
10832 for (i = 0; i <= HDA_SIDE; i++) {
10833 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10834 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10836 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10837 spec->multiout.dac_nids[i]);
10841 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10843 struct alc_spec *spec = codec->spec;
10844 hda_nid_t pin, dac;
10847 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
10848 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10849 pin = spec->autocfg.hp_pins[i];
10852 dac = spec->multiout.hp_nid;
10854 dac = spec->multiout.dac_nids[0]; /* to front */
10855 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10859 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
10860 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10861 pin = spec->autocfg.speaker_pins[i];
10864 dac = spec->multiout.extra_out_nid[0];
10866 dac = spec->multiout.dac_nids[0]; /* to front */
10867 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10872 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10874 struct alc_spec *spec = codec->spec;
10875 struct auto_pin_cfg *cfg = &spec->autocfg;
10878 for (i = 0; i < cfg->num_inputs; i++) {
10879 hda_nid_t nid = cfg->inputs[i].pin;
10880 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10881 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10882 snd_hda_codec_write(codec, nid, 0,
10883 AC_VERB_SET_AMP_GAIN_MUTE,
10888 static void alc882_auto_init_input_src(struct hda_codec *codec)
10890 struct alc_spec *spec = codec->spec;
10893 for (c = 0; c < spec->num_adc_nids; c++) {
10894 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10895 hda_nid_t nid = spec->capsrc_nids[c];
10896 unsigned int mux_idx;
10897 const struct hda_input_mux *imux;
10898 int conns, mute, idx, item;
10900 conns = snd_hda_get_connections(codec, nid, conn_list,
10901 ARRAY_SIZE(conn_list));
10904 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10905 imux = &spec->input_mux[mux_idx];
10906 if (!imux->num_items && mux_idx > 0)
10907 imux = &spec->input_mux[0];
10908 for (idx = 0; idx < conns; idx++) {
10909 /* if the current connection is the selected one,
10910 * unmute it as default - otherwise mute it
10912 mute = AMP_IN_MUTE(idx);
10913 for (item = 0; item < imux->num_items; item++) {
10914 if (imux->items[item].index == idx) {
10915 if (spec->cur_mux[c] == item)
10916 mute = AMP_IN_UNMUTE(idx);
10920 /* check if we have a selector or mixer
10921 * we could check for the widget type instead, but
10922 * just check for Amp-In presence (in case of mixer
10923 * without amp-in there is something wrong, this
10924 * function shouldn't be used or capsrc nid is wrong)
10926 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10927 snd_hda_codec_write(codec, nid, 0,
10928 AC_VERB_SET_AMP_GAIN_MUTE,
10930 else if (mute != AMP_IN_MUTE(idx))
10931 snd_hda_codec_write(codec, nid, 0,
10932 AC_VERB_SET_CONNECT_SEL,
10938 /* add mic boosts if needed */
10939 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10941 struct alc_spec *spec = codec->spec;
10942 struct auto_pin_cfg *cfg = &spec->autocfg;
10946 const char *prev_label = NULL;
10948 for (i = 0; i < cfg->num_inputs; i++) {
10949 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10951 nid = cfg->inputs[i].pin;
10952 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10954 char boost_label[32];
10956 label = hda_get_autocfg_input_label(codec, cfg, i);
10957 if (prev_label && !strcmp(label, prev_label))
10961 prev_label = label;
10963 snprintf(boost_label, sizeof(boost_label),
10964 "%s Boost Volume", label);
10965 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10966 boost_label, type_idx,
10967 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10975 /* almost identical with ALC880 parser... */
10976 static int alc882_parse_auto_config(struct hda_codec *codec)
10978 struct alc_spec *spec = codec->spec;
10979 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10982 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10986 if (!spec->autocfg.line_outs)
10987 return 0; /* can't find valid BIOS pin config */
10989 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10992 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10995 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10999 err = alc880_auto_create_extra_out(spec,
11000 spec->autocfg.speaker_pins[0],
11004 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11008 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11010 alc_auto_parse_digital(codec);
11012 if (spec->kctls.list)
11013 add_mixer(spec, spec->kctls.list);
11015 add_verb(spec, alc883_auto_init_verbs);
11016 /* if ADC 0x07 is available, initialize it, too */
11017 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11018 add_verb(spec, alc882_adc1_init_verbs);
11020 spec->num_mux_defs = 1;
11021 spec->input_mux = &spec->private_imux[0];
11023 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11025 err = alc_auto_add_mic_boost(codec);
11029 return 1; /* config found */
11032 /* additional initialization for auto-configuration model */
11033 static void alc882_auto_init(struct hda_codec *codec)
11035 struct alc_spec *spec = codec->spec;
11036 alc882_auto_init_multi_out(codec);
11037 alc882_auto_init_hp_out(codec);
11038 alc882_auto_init_analog_input(codec);
11039 alc882_auto_init_input_src(codec);
11040 alc_auto_init_digital(codec);
11041 if (spec->unsol_event)
11042 alc_inithook(codec);
11045 static int patch_alc882(struct hda_codec *codec)
11047 struct alc_spec *spec;
11048 int err, board_config;
11050 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11054 codec->spec = spec;
11056 switch (codec->vendor_id) {
11061 /* ALC883 and variants */
11062 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11066 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11070 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11071 board_config = snd_hda_check_board_codec_sid_config(codec,
11072 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11074 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11075 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11077 board_config = ALC882_AUTO;
11080 if (board_config == ALC882_AUTO) {
11081 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11082 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11085 alc_auto_parse_customize_define(codec);
11087 if (board_config == ALC882_AUTO) {
11088 /* automatic parse from the BIOS config */
11089 err = alc882_parse_auto_config(codec);
11095 "hda_codec: Cannot set up configuration "
11096 "from BIOS. Using base mode...\n");
11097 board_config = ALC882_3ST_DIG;
11101 if (has_cdefine_beep(codec)) {
11102 err = snd_hda_attach_beep_device(codec, 0x1);
11109 if (board_config != ALC882_AUTO)
11110 setup_preset(codec, &alc882_presets[board_config]);
11112 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11113 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11114 /* FIXME: setup DAC5 */
11115 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11116 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11118 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11119 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11121 if (!spec->adc_nids && spec->input_mux) {
11123 spec->num_adc_nids = 0;
11124 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11125 const struct hda_input_mux *imux = spec->input_mux;
11127 hda_nid_t items[16];
11128 hda_nid_t nid = alc882_adc_nids[i];
11129 unsigned int wcap = get_wcaps(codec, nid);
11131 wcap = get_wcaps_type(wcap);
11132 if (wcap != AC_WID_AUD_IN)
11134 spec->private_adc_nids[spec->num_adc_nids] = nid;
11135 err = snd_hda_get_connections(codec, nid, &cap, 1);
11138 err = snd_hda_get_connections(codec, cap, items,
11139 ARRAY_SIZE(items));
11142 for (j = 0; j < imux->num_items; j++)
11143 if (imux->items[j].index >= err)
11145 if (j < imux->num_items)
11147 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11148 spec->num_adc_nids++;
11150 spec->adc_nids = spec->private_adc_nids;
11151 spec->capsrc_nids = spec->private_capsrc_nids;
11154 set_capture_mixer(codec);
11156 if (has_cdefine_beep(codec))
11157 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11159 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11161 spec->vmaster_nid = 0x0c;
11163 codec->patch_ops = alc_patch_ops;
11164 if (board_config == ALC882_AUTO)
11165 spec->init_hook = alc882_auto_init;
11167 alc_init_jacks(codec);
11168 #ifdef CONFIG_SND_HDA_POWER_SAVE
11169 if (!spec->loopback.amplist)
11170 spec->loopback.amplist = alc882_loopbacks;
11181 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11182 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11184 #define alc262_dac_nids alc260_dac_nids
11185 #define alc262_adc_nids alc882_adc_nids
11186 #define alc262_adc_nids_alt alc882_adc_nids_alt
11187 #define alc262_capsrc_nids alc882_capsrc_nids
11188 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11190 #define alc262_modes alc260_modes
11191 #define alc262_capture_source alc882_capture_source
11193 static hda_nid_t alc262_dmic_adc_nids[1] = {
11198 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11200 static struct snd_kcontrol_new alc262_base_mixer[] = {
11201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11202 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11203 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11204 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11205 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11206 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11208 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11209 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11210 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11211 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11212 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11215 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11216 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11220 /* update HP, line and mono-out pins according to the master switch */
11221 static void alc262_hp_master_update(struct hda_codec *codec)
11223 struct alc_spec *spec = codec->spec;
11224 int val = spec->master_sw;
11226 /* HP & line-out */
11227 snd_hda_codec_write_cache(codec, 0x1b, 0,
11228 AC_VERB_SET_PIN_WIDGET_CONTROL,
11230 snd_hda_codec_write_cache(codec, 0x15, 0,
11231 AC_VERB_SET_PIN_WIDGET_CONTROL,
11233 /* mono (speaker) depending on the HP jack sense */
11234 val = val && !spec->jack_present;
11235 snd_hda_codec_write_cache(codec, 0x16, 0,
11236 AC_VERB_SET_PIN_WIDGET_CONTROL,
11237 val ? PIN_OUT : 0);
11240 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11242 struct alc_spec *spec = codec->spec;
11244 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11245 alc262_hp_master_update(codec);
11248 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11250 if ((res >> 26) != ALC880_HP_EVENT)
11252 alc262_hp_bpc_automute(codec);
11255 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11257 struct alc_spec *spec = codec->spec;
11259 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11260 alc262_hp_master_update(codec);
11263 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11266 if ((res >> 26) != ALC880_HP_EVENT)
11268 alc262_hp_wildwest_automute(codec);
11271 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11273 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11274 struct snd_ctl_elem_value *ucontrol)
11276 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11277 struct alc_spec *spec = codec->spec;
11278 int val = !!*ucontrol->value.integer.value;
11280 if (val == spec->master_sw)
11282 spec->master_sw = val;
11283 alc262_hp_master_update(codec);
11287 #define ALC262_HP_MASTER_SWITCH \
11289 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11290 .name = "Master Playback Switch", \
11291 .info = snd_ctl_boolean_mono_info, \
11292 .get = alc262_hp_master_sw_get, \
11293 .put = alc262_hp_master_sw_put, \
11296 .iface = NID_MAPPING, \
11297 .name = "Master Playback Switch", \
11298 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11302 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11303 ALC262_HP_MASTER_SWITCH,
11304 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11305 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11306 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11307 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11309 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11311 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11312 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11313 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11314 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11315 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11316 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11317 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11318 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11321 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11322 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11326 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11327 ALC262_HP_MASTER_SWITCH,
11328 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11329 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11330 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11332 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11334 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11336 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11337 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11338 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11341 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11342 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11346 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11347 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11348 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11349 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11353 /* mute/unmute internal speaker according to the hp jack and mute state */
11354 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11356 struct alc_spec *spec = codec->spec;
11358 spec->autocfg.hp_pins[0] = 0x15;
11359 spec->autocfg.speaker_pins[0] = 0x14;
11362 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11363 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11364 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11366 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11369 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11373 static struct hda_verb alc262_hp_t5735_verbs[] = {
11374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11381 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11382 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11384 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11385 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11386 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11387 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11391 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11392 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11393 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11394 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11395 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11396 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11397 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11405 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11412 /* bind hp and internal speaker mute (with plug check) as master switch */
11413 static void alc262_hippo_master_update(struct hda_codec *codec)
11415 struct alc_spec *spec = codec->spec;
11416 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11417 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11418 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11422 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11423 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11424 HDA_AMP_MUTE, mute);
11425 /* mute internal speaker per jack sense */
11426 if (spec->jack_present)
11427 mute = HDA_AMP_MUTE;
11429 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11430 HDA_AMP_MUTE, mute);
11431 if (speaker_nid && speaker_nid != line_nid)
11432 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11433 HDA_AMP_MUTE, mute);
11436 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11438 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11439 struct snd_ctl_elem_value *ucontrol)
11441 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11442 struct alc_spec *spec = codec->spec;
11443 int val = !!*ucontrol->value.integer.value;
11445 if (val == spec->master_sw)
11447 spec->master_sw = val;
11448 alc262_hippo_master_update(codec);
11452 #define ALC262_HIPPO_MASTER_SWITCH \
11454 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11455 .name = "Master Playback Switch", \
11456 .info = snd_ctl_boolean_mono_info, \
11457 .get = alc262_hippo_master_sw_get, \
11458 .put = alc262_hippo_master_sw_put, \
11461 .iface = NID_MAPPING, \
11462 .name = "Master Playback Switch", \
11463 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11464 (SUBDEV_SPEAKER(0) << 16), \
11467 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11468 ALC262_HIPPO_MASTER_SWITCH,
11469 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11473 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11476 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11477 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11478 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11479 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11480 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11484 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11485 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11486 ALC262_HIPPO_MASTER_SWITCH,
11487 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11488 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11489 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11490 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11493 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11494 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11495 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11496 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11500 /* mute/unmute internal speaker according to the hp jack and mute state */
11501 static void alc262_hippo_automute(struct hda_codec *codec)
11503 struct alc_spec *spec = codec->spec;
11504 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11506 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11507 alc262_hippo_master_update(codec);
11510 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11512 if ((res >> 26) != ALC880_HP_EVENT)
11514 alc262_hippo_automute(codec);
11517 static void alc262_hippo_setup(struct hda_codec *codec)
11519 struct alc_spec *spec = codec->spec;
11521 spec->autocfg.hp_pins[0] = 0x15;
11522 spec->autocfg.speaker_pins[0] = 0x14;
11525 static void alc262_hippo1_setup(struct hda_codec *codec)
11527 struct alc_spec *spec = codec->spec;
11529 spec->autocfg.hp_pins[0] = 0x1b;
11530 spec->autocfg.speaker_pins[0] = 0x14;
11534 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11535 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11536 ALC262_HIPPO_MASTER_SWITCH,
11537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11539 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11540 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11544 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11545 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11546 ALC262_HIPPO_MASTER_SWITCH,
11547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11549 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11550 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11551 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11555 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11556 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11557 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11558 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11559 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11560 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11561 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11564 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11565 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11566 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11567 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11571 static struct hda_verb alc262_tyan_verbs[] = {
11572 /* Headphone automute */
11573 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11575 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11577 /* P11 AUX_IN, white 4-pin connector */
11578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11579 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11580 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11581 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11586 /* unsolicited event for HP jack sensing */
11587 static void alc262_tyan_setup(struct hda_codec *codec)
11589 struct alc_spec *spec = codec->spec;
11591 spec->autocfg.hp_pins[0] = 0x1b;
11592 spec->autocfg.speaker_pins[0] = 0x15;
11596 #define alc262_capture_mixer alc882_capture_mixer
11597 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11600 * generic initialization of ADC, input mixers and output mixers
11602 static struct hda_verb alc262_init_verbs[] = {
11604 * Unmute ADC0-2 and set the default input to mic-in
11606 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11608 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11609 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11610 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11613 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11615 * Note: PASD motherboards uses the Line In 2 as the input for
11616 * front panel mic (mic 2)
11618 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11619 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11620 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11621 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11626 * Set up output mixers (0x0c - 0x0e)
11628 /* set vol=0 to output mixers */
11629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11630 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11632 /* set up input amps for analog loopback */
11633 /* Amp Indices: DAC = 0, mixer = 1 */
11634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11637 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11639 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11643 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11645 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11646 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11648 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11650 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11651 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11652 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11654 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11655 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11657 /* FIXME: use matrix-type input source selection */
11658 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11659 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11662 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11678 static struct hda_verb alc262_eapd_verbs[] = {
11679 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11680 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11684 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11685 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11686 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11687 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11689 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11694 static struct hda_verb alc262_sony_unsol_verbs[] = {
11695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11699 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11704 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11705 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11706 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11707 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11713 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11714 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11718 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11719 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11720 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11721 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11725 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11727 struct alc_spec *spec = codec->spec;
11729 spec->autocfg.hp_pins[0] = 0x15;
11730 spec->autocfg.speaker_pins[0] = 0x14;
11731 spec->ext_mic.pin = 0x18;
11732 spec->ext_mic.mux_idx = 0;
11733 spec->int_mic.pin = 0x12;
11734 spec->int_mic.mux_idx = 9;
11735 spec->auto_mic = 1;
11741 * 0x16 = internal speaker
11742 * 0x18 = external mic
11745 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11746 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11747 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11749 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11750 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11751 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11753 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11758 static struct hda_verb alc262_nec_verbs[] = {
11759 /* Unmute Speaker */
11760 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11763 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11766 /* External mic to headphone */
11767 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11768 /* External mic to speaker */
11769 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11775 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11776 * 0x1b = port replicator headphone out
11779 #define ALC_HP_EVENT 0x37
11781 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11782 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11784 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11785 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11789 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11790 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11791 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11795 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11796 /* Front Mic pin: input vref at 50% */
11797 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11798 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11802 static struct hda_input_mux alc262_fujitsu_capture_source = {
11806 { "Internal Mic", 0x1 },
11811 static struct hda_input_mux alc262_HP_capture_source = {
11815 { "Front Mic", 0x1 },
11822 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11826 { "Front Mic", 0x2 },
11832 /* mute/unmute internal speaker according to the hp jacks and mute state */
11833 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11835 struct alc_spec *spec = codec->spec;
11838 if (force || !spec->sense_updated) {
11839 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11840 snd_hda_jack_detect(codec, 0x1b);
11841 spec->sense_updated = 1;
11843 /* unmute internal speaker only if both HPs are unplugged and
11844 * master switch is on
11846 if (spec->jack_present)
11847 mute = HDA_AMP_MUTE;
11849 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11850 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11851 HDA_AMP_MUTE, mute);
11854 /* unsolicited event for HP jack sensing */
11855 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11858 if ((res >> 26) != ALC_HP_EVENT)
11860 alc262_fujitsu_automute(codec, 1);
11863 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11865 alc262_fujitsu_automute(codec, 1);
11868 /* bind volumes of both NID 0x0c and 0x0d */
11869 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11870 .ops = &snd_hda_bind_vol,
11872 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11873 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11878 /* mute/unmute internal speaker according to the hp jack and mute state */
11879 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11881 struct alc_spec *spec = codec->spec;
11884 if (force || !spec->sense_updated) {
11885 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11886 spec->sense_updated = 1;
11888 if (spec->jack_present) {
11889 /* mute internal speaker */
11890 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11891 HDA_AMP_MUTE, HDA_AMP_MUTE);
11892 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11893 HDA_AMP_MUTE, HDA_AMP_MUTE);
11895 /* unmute internal speaker if necessary */
11896 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11897 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11898 HDA_AMP_MUTE, mute);
11899 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11900 HDA_AMP_MUTE, mute);
11904 /* unsolicited event for HP jack sensing */
11905 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11908 if ((res >> 26) != ALC_HP_EVENT)
11910 alc262_lenovo_3000_automute(codec, 1);
11913 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11914 int dir, int idx, long *valp)
11918 for (i = 0; i < 2; i++, valp++)
11919 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11921 *valp ? 0 : HDA_AMP_MUTE);
11925 /* bind hp and internal speaker mute (with plug check) */
11926 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11927 struct snd_ctl_elem_value *ucontrol)
11929 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11930 long *valp = ucontrol->value.integer.value;
11933 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11934 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11936 alc262_fujitsu_automute(codec, 0);
11940 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11941 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11944 .name = "Master Playback Switch",
11945 .subdevice = HDA_SUBDEV_AMP_FLAG,
11946 .info = snd_hda_mixer_amp_switch_info,
11947 .get = snd_hda_mixer_amp_switch_get,
11948 .put = alc262_fujitsu_master_sw_put,
11949 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11952 .iface = NID_MAPPING,
11953 .name = "Master Playback Switch",
11954 .private_value = 0x1b,
11956 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11957 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11958 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11961 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11962 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11963 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11967 /* bind hp and internal speaker mute (with plug check) */
11968 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11969 struct snd_ctl_elem_value *ucontrol)
11971 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11972 long *valp = ucontrol->value.integer.value;
11975 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11977 alc262_lenovo_3000_automute(codec, 0);
11981 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11982 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11985 .name = "Master Playback Switch",
11986 .subdevice = HDA_SUBDEV_AMP_FLAG,
11987 .info = snd_hda_mixer_amp_switch_info,
11988 .get = snd_hda_mixer_amp_switch_get,
11989 .put = alc262_lenovo_3000_master_sw_put,
11990 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11994 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11997 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11998 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11999 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12003 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12004 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12005 ALC262_HIPPO_MASTER_SWITCH,
12006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12007 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12008 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12009 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12010 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12011 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12015 /* additional init verbs for Benq laptops */
12016 static struct hda_verb alc262_EAPD_verbs[] = {
12017 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12018 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12022 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12023 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12026 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12027 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12031 /* Samsung Q1 Ultra Vista model setup */
12032 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
12033 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12034 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12037 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12038 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12042 static struct hda_verb alc262_ultra_verbs[] = {
12044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12051 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12056 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12057 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12059 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12061 /* ADC, choose mic */
12062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12075 /* mute/unmute internal speaker according to the hp jack and mute state */
12076 static void alc262_ultra_automute(struct hda_codec *codec)
12078 struct alc_spec *spec = codec->spec;
12082 /* auto-mute only when HP is used as HP */
12083 if (!spec->cur_mux[0]) {
12084 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12085 if (spec->jack_present)
12086 mute = HDA_AMP_MUTE;
12088 /* mute/unmute internal speaker */
12089 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12090 HDA_AMP_MUTE, mute);
12091 /* mute/unmute HP */
12092 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12093 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12096 /* unsolicited event for HP jack sensing */
12097 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12100 if ((res >> 26) != ALC880_HP_EVENT)
12102 alc262_ultra_automute(codec);
12105 static struct hda_input_mux alc262_ultra_capture_source = {
12109 { "Headphone", 0x7 },
12113 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12114 struct snd_ctl_elem_value *ucontrol)
12116 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12117 struct alc_spec *spec = codec->spec;
12120 ret = alc_mux_enum_put(kcontrol, ucontrol);
12123 /* reprogram the HP pin as mic or HP according to the input source */
12124 snd_hda_codec_write_cache(codec, 0x15, 0,
12125 AC_VERB_SET_PIN_WIDGET_CONTROL,
12126 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12127 alc262_ultra_automute(codec); /* mute/unmute HP */
12131 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12132 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12133 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12135 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12136 .name = "Capture Source",
12137 .info = alc_mux_enum_info,
12138 .get = alc_mux_enum_get,
12139 .put = alc262_ultra_mux_enum_put,
12142 .iface = NID_MAPPING,
12143 .name = "Capture Source",
12144 .private_value = 0x15,
12149 /* We use two mixers depending on the output pin; 0x16 is a mono output
12150 * and thus it's bound with a different mixer.
12151 * This function returns which mixer amp should be used.
12153 static int alc262_check_volbit(hda_nid_t nid)
12157 else if (nid == 0x16)
12163 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12164 const char *pfx, int *vbits, int idx)
12169 vbit = alc262_check_volbit(nid);
12172 if (*vbits & vbit) /* a volume control for this mixer already there */
12176 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12178 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12179 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12182 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12183 const char *pfx, int idx)
12190 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12192 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12193 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12196 /* add playback controls from the parsed DAC table */
12197 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12198 const struct auto_pin_cfg *cfg)
12204 spec->multiout.num_dacs = 1; /* only use one dac */
12205 spec->multiout.dac_nids = spec->private_dac_nids;
12206 spec->multiout.dac_nids[0] = 2;
12208 pfx = alc_get_line_out_pfx(cfg, true);
12211 for (i = 0; i < 2; i++) {
12212 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12215 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12216 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12221 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12222 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12229 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12230 alc262_check_volbit(cfg->speaker_pins[0]) |
12231 alc262_check_volbit(cfg->hp_pins[0]);
12232 if (vbits == 1 || vbits == 2)
12233 pfx = "Master"; /* only one mixer is used */
12235 for (i = 0; i < 2; i++) {
12236 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12240 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12241 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12242 "Speaker", &vbits, i);
12246 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12247 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12248 "Headphone", &vbits, i);
12256 #define alc262_auto_create_input_ctls \
12257 alc882_auto_create_input_ctls
12260 * generic initialization of ADC, input mixers and output mixers
12262 static struct hda_verb alc262_volume_init_verbs[] = {
12264 * Unmute ADC0-2 and set the default input to mic-in
12266 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12268 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12270 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12273 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12275 * Note: PASD motherboards uses the Line In 2 as the input for
12276 * front panel mic (mic 2)
12278 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12286 * Set up output mixers (0x0c - 0x0f)
12288 /* set vol=0 to output mixers */
12289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12293 /* set up input amps for analog loopback */
12294 /* Amp Indices: DAC = 0, mixer = 1 */
12295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12302 /* FIXME: use matrix-type input source selection */
12303 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12304 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12305 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12306 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12307 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12308 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12312 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12313 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12317 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12318 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12323 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12325 * Unmute ADC0-2 and set the default input to mic-in
12327 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12329 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12330 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12331 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12334 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12336 * Note: PASD motherboards uses the Line In 2 as the input for
12337 * front panel mic (mic 2)
12339 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12342 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12343 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12344 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12349 * Set up output mixers (0x0c - 0x0e)
12351 /* set vol=0 to output mixers */
12352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12356 /* set up input amps for analog loopback */
12357 /* Amp Indices: DAC = 0, mixer = 1 */
12358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12362 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12367 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12369 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12370 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12372 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12373 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12377 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12378 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12379 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12381 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12383 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12384 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12385 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12386 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12389 /* FIXME: use matrix-type input source selection */
12390 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12391 /* Input mixer1: only unmute Mic */
12392 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12393 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12394 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12395 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12403 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12404 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12422 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12427 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12429 * Unmute ADC0-2 and set the default input to mic-in
12431 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12433 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12434 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12435 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12436 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12438 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12440 * Note: PASD motherboards uses the Line In 2 as the input for front
12441 * panel mic (mic 2)
12443 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12445 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12446 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12453 * Set up output mixers (0x0c - 0x0e)
12455 /* set vol=0 to output mixers */
12456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12457 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12460 /* set up input amps for analog loopback */
12461 /* Amp Indices: DAC = 0, mixer = 1 */
12462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12471 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12472 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12473 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12476 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12478 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12479 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12481 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12484 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12487 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12488 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12489 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12491 /* FIXME: use matrix-type input source selection */
12492 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12493 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12495 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12497 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12499 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12500 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12502 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12505 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12506 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12507 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12508 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12515 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12518 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12523 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12526 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12527 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12531 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12532 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12535 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12536 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12547 static const struct alc_fixup alc262_fixups[] = {
12548 [PINFIX_FSC_H270] = {
12549 .type = ALC_FIXUP_PINS,
12550 .v.pins = (const struct alc_pincfg[]) {
12551 { 0x14, 0x99130110 }, /* speaker */
12552 { 0x15, 0x0221142f }, /* front HP */
12553 { 0x1b, 0x0121141f }, /* rear HP */
12559 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12560 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12565 #ifdef CONFIG_SND_HDA_POWER_SAVE
12566 #define alc262_loopbacks alc880_loopbacks
12569 /* pcm configuration: identical with ALC880 */
12570 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12571 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12572 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12573 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12576 * BIOS auto configuration
12578 static int alc262_parse_auto_config(struct hda_codec *codec)
12580 struct alc_spec *spec = codec->spec;
12582 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12584 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12588 if (!spec->autocfg.line_outs) {
12589 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12590 spec->multiout.max_channels = 2;
12591 spec->no_analog = 1;
12594 return 0; /* can't find valid BIOS pin config */
12596 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12599 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12603 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12606 alc_auto_parse_digital(codec);
12608 if (spec->kctls.list)
12609 add_mixer(spec, spec->kctls.list);
12611 add_verb(spec, alc262_volume_init_verbs);
12612 spec->num_mux_defs = 1;
12613 spec->input_mux = &spec->private_imux[0];
12615 err = alc_auto_add_mic_boost(codec);
12619 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12624 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12625 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12626 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12627 #define alc262_auto_init_input_src alc882_auto_init_input_src
12630 /* init callback for auto-configuration model -- overriding the default init */
12631 static void alc262_auto_init(struct hda_codec *codec)
12633 struct alc_spec *spec = codec->spec;
12634 alc262_auto_init_multi_out(codec);
12635 alc262_auto_init_hp_out(codec);
12636 alc262_auto_init_analog_input(codec);
12637 alc262_auto_init_input_src(codec);
12638 alc_auto_init_digital(codec);
12639 if (spec->unsol_event)
12640 alc_inithook(codec);
12644 * configuration and preset
12646 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12647 [ALC262_BASIC] = "basic",
12648 [ALC262_HIPPO] = "hippo",
12649 [ALC262_HIPPO_1] = "hippo_1",
12650 [ALC262_FUJITSU] = "fujitsu",
12651 [ALC262_HP_BPC] = "hp-bpc",
12652 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12653 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12654 [ALC262_HP_RP5700] = "hp-rp5700",
12655 [ALC262_BENQ_ED8] = "benq",
12656 [ALC262_BENQ_T31] = "benq-t31",
12657 [ALC262_SONY_ASSAMD] = "sony-assamd",
12658 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12659 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12660 [ALC262_ULTRA] = "ultra",
12661 [ALC262_LENOVO_3000] = "lenovo-3000",
12662 [ALC262_NEC] = "nec",
12663 [ALC262_TYAN] = "tyan",
12664 [ALC262_AUTO] = "auto",
12667 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12668 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12669 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12670 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12672 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12674 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12676 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12678 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12679 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12680 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12681 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12682 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12683 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12684 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12685 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12686 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12687 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12688 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12689 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12690 ALC262_HP_TC_T5735),
12691 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12692 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12693 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12694 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12695 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12696 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12697 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12698 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12699 #if 0 /* disable the quirk since model=auto works better in recent versions */
12700 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12701 ALC262_SONY_ASSAMD),
12703 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12704 ALC262_TOSHIBA_RX1),
12705 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12706 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12707 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12708 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12709 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12711 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12712 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12713 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12714 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12715 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12719 static struct alc_config_preset alc262_presets[] = {
12721 .mixers = { alc262_base_mixer },
12722 .init_verbs = { alc262_init_verbs },
12723 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12724 .dac_nids = alc262_dac_nids,
12726 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12727 .channel_mode = alc262_modes,
12728 .input_mux = &alc262_capture_source,
12731 .mixers = { alc262_hippo_mixer },
12732 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12733 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12734 .dac_nids = alc262_dac_nids,
12736 .dig_out_nid = ALC262_DIGOUT_NID,
12737 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12738 .channel_mode = alc262_modes,
12739 .input_mux = &alc262_capture_source,
12740 .unsol_event = alc262_hippo_unsol_event,
12741 .setup = alc262_hippo_setup,
12742 .init_hook = alc262_hippo_automute,
12744 [ALC262_HIPPO_1] = {
12745 .mixers = { alc262_hippo1_mixer },
12746 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12747 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12748 .dac_nids = alc262_dac_nids,
12750 .dig_out_nid = ALC262_DIGOUT_NID,
12751 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12752 .channel_mode = alc262_modes,
12753 .input_mux = &alc262_capture_source,
12754 .unsol_event = alc262_hippo_unsol_event,
12755 .setup = alc262_hippo1_setup,
12756 .init_hook = alc262_hippo_automute,
12758 [ALC262_FUJITSU] = {
12759 .mixers = { alc262_fujitsu_mixer },
12760 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12761 alc262_fujitsu_unsol_verbs },
12762 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12763 .dac_nids = alc262_dac_nids,
12765 .dig_out_nid = ALC262_DIGOUT_NID,
12766 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12767 .channel_mode = alc262_modes,
12768 .input_mux = &alc262_fujitsu_capture_source,
12769 .unsol_event = alc262_fujitsu_unsol_event,
12770 .init_hook = alc262_fujitsu_init_hook,
12772 [ALC262_HP_BPC] = {
12773 .mixers = { alc262_HP_BPC_mixer },
12774 .init_verbs = { alc262_HP_BPC_init_verbs },
12775 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12776 .dac_nids = alc262_dac_nids,
12778 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12779 .channel_mode = alc262_modes,
12780 .input_mux = &alc262_HP_capture_source,
12781 .unsol_event = alc262_hp_bpc_unsol_event,
12782 .init_hook = alc262_hp_bpc_automute,
12784 [ALC262_HP_BPC_D7000_WF] = {
12785 .mixers = { alc262_HP_BPC_WildWest_mixer },
12786 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12787 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12788 .dac_nids = alc262_dac_nids,
12790 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12791 .channel_mode = alc262_modes,
12792 .input_mux = &alc262_HP_D7000_capture_source,
12793 .unsol_event = alc262_hp_wildwest_unsol_event,
12794 .init_hook = alc262_hp_wildwest_automute,
12796 [ALC262_HP_BPC_D7000_WL] = {
12797 .mixers = { alc262_HP_BPC_WildWest_mixer,
12798 alc262_HP_BPC_WildWest_option_mixer },
12799 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12800 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12801 .dac_nids = alc262_dac_nids,
12803 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12804 .channel_mode = alc262_modes,
12805 .input_mux = &alc262_HP_D7000_capture_source,
12806 .unsol_event = alc262_hp_wildwest_unsol_event,
12807 .init_hook = alc262_hp_wildwest_automute,
12809 [ALC262_HP_TC_T5735] = {
12810 .mixers = { alc262_hp_t5735_mixer },
12811 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12812 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12813 .dac_nids = alc262_dac_nids,
12815 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12816 .channel_mode = alc262_modes,
12817 .input_mux = &alc262_capture_source,
12818 .unsol_event = alc_sku_unsol_event,
12819 .setup = alc262_hp_t5735_setup,
12820 .init_hook = alc_inithook,
12822 [ALC262_HP_RP5700] = {
12823 .mixers = { alc262_hp_rp5700_mixer },
12824 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12825 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12826 .dac_nids = alc262_dac_nids,
12827 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12828 .channel_mode = alc262_modes,
12829 .input_mux = &alc262_hp_rp5700_capture_source,
12831 [ALC262_BENQ_ED8] = {
12832 .mixers = { alc262_base_mixer },
12833 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12834 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12835 .dac_nids = alc262_dac_nids,
12837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12838 .channel_mode = alc262_modes,
12839 .input_mux = &alc262_capture_source,
12841 [ALC262_SONY_ASSAMD] = {
12842 .mixers = { alc262_sony_mixer },
12843 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12844 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12845 .dac_nids = alc262_dac_nids,
12847 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12848 .channel_mode = alc262_modes,
12849 .input_mux = &alc262_capture_source,
12850 .unsol_event = alc262_hippo_unsol_event,
12851 .setup = alc262_hippo_setup,
12852 .init_hook = alc262_hippo_automute,
12854 [ALC262_BENQ_T31] = {
12855 .mixers = { alc262_benq_t31_mixer },
12856 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12857 alc_hp15_unsol_verbs },
12858 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12859 .dac_nids = alc262_dac_nids,
12861 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12862 .channel_mode = alc262_modes,
12863 .input_mux = &alc262_capture_source,
12864 .unsol_event = alc262_hippo_unsol_event,
12865 .setup = alc262_hippo_setup,
12866 .init_hook = alc262_hippo_automute,
12869 .mixers = { alc262_ultra_mixer },
12870 .cap_mixer = alc262_ultra_capture_mixer,
12871 .init_verbs = { alc262_ultra_verbs },
12872 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12873 .dac_nids = alc262_dac_nids,
12874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12875 .channel_mode = alc262_modes,
12876 .input_mux = &alc262_ultra_capture_source,
12877 .adc_nids = alc262_adc_nids, /* ADC0 */
12878 .capsrc_nids = alc262_capsrc_nids,
12879 .num_adc_nids = 1, /* single ADC */
12880 .unsol_event = alc262_ultra_unsol_event,
12881 .init_hook = alc262_ultra_automute,
12883 [ALC262_LENOVO_3000] = {
12884 .mixers = { alc262_lenovo_3000_mixer },
12885 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12886 alc262_lenovo_3000_unsol_verbs,
12887 alc262_lenovo_3000_init_verbs },
12888 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12889 .dac_nids = alc262_dac_nids,
12891 .dig_out_nid = ALC262_DIGOUT_NID,
12892 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12893 .channel_mode = alc262_modes,
12894 .input_mux = &alc262_fujitsu_capture_source,
12895 .unsol_event = alc262_lenovo_3000_unsol_event,
12898 .mixers = { alc262_nec_mixer },
12899 .init_verbs = { alc262_nec_verbs },
12900 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12901 .dac_nids = alc262_dac_nids,
12903 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12904 .channel_mode = alc262_modes,
12905 .input_mux = &alc262_capture_source,
12907 [ALC262_TOSHIBA_S06] = {
12908 .mixers = { alc262_toshiba_s06_mixer },
12909 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12910 alc262_eapd_verbs },
12911 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12912 .capsrc_nids = alc262_dmic_capsrc_nids,
12913 .dac_nids = alc262_dac_nids,
12914 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12915 .num_adc_nids = 1, /* single ADC */
12916 .dig_out_nid = ALC262_DIGOUT_NID,
12917 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12918 .channel_mode = alc262_modes,
12919 .unsol_event = alc_sku_unsol_event,
12920 .setup = alc262_toshiba_s06_setup,
12921 .init_hook = alc_inithook,
12923 [ALC262_TOSHIBA_RX1] = {
12924 .mixers = { alc262_toshiba_rx1_mixer },
12925 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12926 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12927 .dac_nids = alc262_dac_nids,
12929 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12930 .channel_mode = alc262_modes,
12931 .input_mux = &alc262_capture_source,
12932 .unsol_event = alc262_hippo_unsol_event,
12933 .setup = alc262_hippo_setup,
12934 .init_hook = alc262_hippo_automute,
12937 .mixers = { alc262_tyan_mixer },
12938 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12939 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12940 .dac_nids = alc262_dac_nids,
12942 .dig_out_nid = ALC262_DIGOUT_NID,
12943 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12944 .channel_mode = alc262_modes,
12945 .input_mux = &alc262_capture_source,
12946 .unsol_event = alc_automute_amp_unsol_event,
12947 .setup = alc262_tyan_setup,
12948 .init_hook = alc_automute_amp,
12952 static int patch_alc262(struct hda_codec *codec)
12954 struct alc_spec *spec;
12958 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12962 codec->spec = spec;
12964 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12969 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12970 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12971 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12972 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12975 alc_auto_parse_customize_define(codec);
12977 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12979 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12983 if (board_config < 0) {
12984 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12986 board_config = ALC262_AUTO;
12989 if (board_config == ALC262_AUTO) {
12990 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12991 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12994 if (board_config == ALC262_AUTO) {
12995 /* automatic parse from the BIOS config */
12996 err = alc262_parse_auto_config(codec);
13002 "hda_codec: Cannot set up configuration "
13003 "from BIOS. Using base mode...\n");
13004 board_config = ALC262_BASIC;
13008 if (!spec->no_analog && has_cdefine_beep(codec)) {
13009 err = snd_hda_attach_beep_device(codec, 0x1);
13016 if (board_config != ALC262_AUTO)
13017 setup_preset(codec, &alc262_presets[board_config]);
13019 spec->stream_analog_playback = &alc262_pcm_analog_playback;
13020 spec->stream_analog_capture = &alc262_pcm_analog_capture;
13022 spec->stream_digital_playback = &alc262_pcm_digital_playback;
13023 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13025 if (!spec->adc_nids && spec->input_mux) {
13027 /* check whether the digital-mic has to be supported */
13028 for (i = 0; i < spec->input_mux->num_items; i++) {
13029 if (spec->input_mux->items[i].index >= 9)
13032 if (i < spec->input_mux->num_items) {
13033 /* use only ADC0 */
13034 spec->adc_nids = alc262_dmic_adc_nids;
13035 spec->num_adc_nids = 1;
13036 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13038 /* all analog inputs */
13039 /* check whether NID 0x07 is valid */
13040 unsigned int wcap = get_wcaps(codec, 0x07);
13043 wcap = get_wcaps_type(wcap);
13044 if (wcap != AC_WID_AUD_IN) {
13045 spec->adc_nids = alc262_adc_nids_alt;
13046 spec->num_adc_nids =
13047 ARRAY_SIZE(alc262_adc_nids_alt);
13048 spec->capsrc_nids = alc262_capsrc_nids_alt;
13050 spec->adc_nids = alc262_adc_nids;
13051 spec->num_adc_nids =
13052 ARRAY_SIZE(alc262_adc_nids);
13053 spec->capsrc_nids = alc262_capsrc_nids;
13057 if (!spec->cap_mixer && !spec->no_analog)
13058 set_capture_mixer(codec);
13059 if (!spec->no_analog && has_cdefine_beep(codec))
13060 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13062 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13064 spec->vmaster_nid = 0x0c;
13066 codec->patch_ops = alc_patch_ops;
13067 if (board_config == ALC262_AUTO)
13068 spec->init_hook = alc262_auto_init;
13070 alc_init_jacks(codec);
13071 #ifdef CONFIG_SND_HDA_POWER_SAVE
13072 if (!spec->loopback.amplist)
13073 spec->loopback.amplist = alc262_loopbacks;
13080 * ALC268 channel source setting (2 channel)
13082 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13083 #define alc268_modes alc260_modes
13085 static hda_nid_t alc268_dac_nids[2] = {
13090 static hda_nid_t alc268_adc_nids[2] = {
13095 static hda_nid_t alc268_adc_nids_alt[1] = {
13100 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13102 static struct snd_kcontrol_new alc268_base_mixer[] = {
13103 /* output mixer control */
13104 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13105 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13106 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13107 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13108 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13109 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13110 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13114 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13115 /* output mixer control */
13116 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13117 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13118 ALC262_HIPPO_MASTER_SWITCH,
13119 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13120 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13121 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13125 /* bind Beep switches of both NID 0x0f and 0x10 */
13126 static struct hda_bind_ctls alc268_bind_beep_sw = {
13127 .ops = &snd_hda_bind_sw,
13129 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13130 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13135 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13136 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13137 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13141 static struct hda_verb alc268_eapd_verbs[] = {
13142 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13143 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13147 /* Toshiba specific */
13148 static struct hda_verb alc268_toshiba_verbs[] = {
13149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13153 /* Acer specific */
13154 /* bind volumes of both NID 0x02 and 0x03 */
13155 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13156 .ops = &snd_hda_bind_vol,
13158 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13159 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13164 /* mute/unmute internal speaker according to the hp jack and mute state */
13165 static void alc268_acer_automute(struct hda_codec *codec, int force)
13167 struct alc_spec *spec = codec->spec;
13170 if (force || !spec->sense_updated) {
13171 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13172 spec->sense_updated = 1;
13174 if (spec->jack_present)
13175 mute = HDA_AMP_MUTE; /* mute internal speaker */
13176 else /* unmute internal speaker if necessary */
13177 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13178 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13179 HDA_AMP_MUTE, mute);
13183 /* bind hp and internal speaker mute (with plug check) */
13184 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13185 struct snd_ctl_elem_value *ucontrol)
13187 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13188 long *valp = ucontrol->value.integer.value;
13191 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13193 alc268_acer_automute(codec, 0);
13197 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13198 /* output mixer control */
13199 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13201 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13202 .name = "Master Playback Switch",
13203 .subdevice = HDA_SUBDEV_AMP_FLAG,
13204 .info = snd_hda_mixer_amp_switch_info,
13205 .get = snd_hda_mixer_amp_switch_get,
13206 .put = alc268_acer_master_sw_put,
13207 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13209 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13213 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13214 /* output mixer control */
13215 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13217 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13218 .name = "Master Playback Switch",
13219 .subdevice = HDA_SUBDEV_AMP_FLAG,
13220 .info = snd_hda_mixer_amp_switch_info,
13221 .get = snd_hda_mixer_amp_switch_get,
13222 .put = alc268_acer_master_sw_put,
13223 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13225 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13226 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13227 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13231 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13232 /* output mixer control */
13233 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13235 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13236 .name = "Master Playback Switch",
13237 .subdevice = HDA_SUBDEV_AMP_FLAG,
13238 .info = snd_hda_mixer_amp_switch_info,
13239 .get = snd_hda_mixer_amp_switch_get,
13240 .put = alc268_acer_master_sw_put,
13241 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13243 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13244 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13248 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13249 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13252 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13253 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13254 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13258 static struct hda_verb alc268_acer_verbs[] = {
13259 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13260 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13264 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13265 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13269 /* unsolicited event for HP jack sensing */
13270 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13271 #define alc268_toshiba_setup alc262_hippo_setup
13272 #define alc268_toshiba_automute alc262_hippo_automute
13274 static void alc268_acer_unsol_event(struct hda_codec *codec,
13277 if ((res >> 26) != ALC880_HP_EVENT)
13279 alc268_acer_automute(codec, 1);
13282 static void alc268_acer_init_hook(struct hda_codec *codec)
13284 alc268_acer_automute(codec, 1);
13287 /* toggle speaker-output according to the hp-jack state */
13288 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13290 unsigned int present;
13291 unsigned char bits;
13293 present = snd_hda_jack_detect(codec, 0x15);
13294 bits = present ? HDA_AMP_MUTE : 0;
13295 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13296 HDA_AMP_MUTE, bits);
13297 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13298 HDA_AMP_MUTE, bits);
13301 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13304 switch (res >> 26) {
13305 case ALC880_HP_EVENT:
13306 alc268_aspire_one_speaker_automute(codec);
13308 case ALC880_MIC_EVENT:
13309 alc_mic_automute(codec);
13314 static void alc268_acer_lc_setup(struct hda_codec *codec)
13316 struct alc_spec *spec = codec->spec;
13317 spec->ext_mic.pin = 0x18;
13318 spec->ext_mic.mux_idx = 0;
13319 spec->int_mic.pin = 0x12;
13320 spec->int_mic.mux_idx = 6;
13321 spec->auto_mic = 1;
13324 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13326 alc268_aspire_one_speaker_automute(codec);
13327 alc_mic_automute(codec);
13330 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13331 /* output mixer control */
13332 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13333 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13334 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13335 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13336 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13337 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13341 static struct hda_verb alc268_dell_verbs[] = {
13342 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13344 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13345 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13349 /* mute/unmute internal speaker according to the hp jack and mute state */
13350 static void alc268_dell_setup(struct hda_codec *codec)
13352 struct alc_spec *spec = codec->spec;
13354 spec->autocfg.hp_pins[0] = 0x15;
13355 spec->autocfg.speaker_pins[0] = 0x14;
13356 spec->ext_mic.pin = 0x18;
13357 spec->ext_mic.mux_idx = 0;
13358 spec->int_mic.pin = 0x19;
13359 spec->int_mic.mux_idx = 1;
13360 spec->auto_mic = 1;
13363 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13364 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13365 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13368 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13369 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13370 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13371 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13375 static struct hda_verb alc267_quanta_il1_verbs[] = {
13376 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13381 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13383 struct alc_spec *spec = codec->spec;
13384 spec->autocfg.hp_pins[0] = 0x15;
13385 spec->autocfg.speaker_pins[0] = 0x14;
13386 spec->ext_mic.pin = 0x18;
13387 spec->ext_mic.mux_idx = 0;
13388 spec->int_mic.pin = 0x19;
13389 spec->int_mic.mux_idx = 1;
13390 spec->auto_mic = 1;
13394 * generic initialization of ADC, input mixers and output mixers
13396 static struct hda_verb alc268_base_init_verbs[] = {
13397 /* Unmute DAC0-1 and set vol = 0 */
13398 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13399 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13402 * Set up output mixers (0x0c - 0x0e)
13404 /* set vol=0 to output mixers */
13405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13406 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13409 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13413 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13414 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13416 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13417 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13418 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13420 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13422 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13423 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13424 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13426 /* set PCBEEP vol = 0, mute connections */
13427 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13429 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13431 /* Unmute Selector 23h,24h and set the default input to mic-in */
13433 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13434 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13435 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13442 * generic initialization of ADC, input mixers and output mixers
13444 static struct hda_verb alc268_volume_init_verbs[] = {
13445 /* set output DAC */
13446 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13447 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13449 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13450 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13451 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13452 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13453 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13455 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13456 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13457 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13459 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13460 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13462 /* set PCBEEP vol = 0, mute connections */
13463 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13464 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13465 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13470 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13471 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13472 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13476 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13477 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13478 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13483 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13484 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13485 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13486 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13487 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13492 static struct hda_input_mux alc268_capture_source = {
13496 { "Front Mic", 0x1 },
13502 static struct hda_input_mux alc268_acer_capture_source = {
13506 { "Internal Mic", 0x1 },
13511 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13515 { "Internal Mic", 0x6 },
13520 #ifdef CONFIG_SND_DEBUG
13521 static struct snd_kcontrol_new alc268_test_mixer[] = {
13522 /* Volume widgets */
13523 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13524 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13525 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13526 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13527 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13528 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13529 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13530 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13531 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13532 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13533 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13534 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13535 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13536 /* The below appears problematic on some hardwares */
13537 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13538 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13539 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13540 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13541 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13543 /* Modes for retasking pin widgets */
13544 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13545 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13546 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13547 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13549 /* Controls for GPIO pins, assuming they are configured as outputs */
13550 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13551 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13552 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13553 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13555 /* Switches to allow the digital SPDIF output pin to be enabled.
13556 * The ALC268 does not have an SPDIF input.
13558 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13560 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13561 * this output to turn on an external amplifier.
13563 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13564 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13570 /* create input playback/capture controls for the given pin */
13571 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13572 const char *ctlname, int idx)
13583 case 0x1a: /* ALC259/269 only */
13584 case 0x1b: /* ALC259/269 only */
13585 case 0x21: /* ALC269vb has this pin, too */
13589 snd_printd(KERN_WARNING "hda_codec: "
13590 "ignoring pin 0x%x as unknown\n", nid);
13593 if (spec->multiout.dac_nids[0] != dac &&
13594 spec->multiout.dac_nids[1] != dac) {
13595 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13596 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13600 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13604 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13605 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13607 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13608 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13614 /* add playback controls from the parsed DAC table */
13615 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13616 const struct auto_pin_cfg *cfg)
13621 spec->multiout.dac_nids = spec->private_dac_nids;
13623 nid = cfg->line_out_pins[0];
13626 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13630 err = alc268_new_analog_output(spec, nid, name, 0);
13635 nid = cfg->speaker_pins[0];
13637 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13638 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13642 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13646 nid = cfg->hp_pins[0];
13648 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13653 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13655 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13656 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13663 /* create playback/capture controls for input pins */
13664 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13665 const struct auto_pin_cfg *cfg)
13667 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13670 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13671 hda_nid_t nid, int pin_type)
13675 alc_set_pin_output(codec, nid, pin_type);
13676 if (nid == 0x14 || nid == 0x16)
13680 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13683 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13685 struct alc_spec *spec = codec->spec;
13688 for (i = 0; i < spec->autocfg.line_outs; i++) {
13689 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13690 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13691 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13695 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13697 struct alc_spec *spec = codec->spec;
13701 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13702 pin = spec->autocfg.hp_pins[i];
13703 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13705 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13706 pin = spec->autocfg.speaker_pins[i];
13707 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13709 if (spec->autocfg.mono_out_pin)
13710 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13711 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13714 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13716 struct alc_spec *spec = codec->spec;
13717 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13718 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13719 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13720 unsigned int dac_vol1, dac_vol2;
13722 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13723 snd_hda_codec_write(codec, speaker_nid, 0,
13724 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13725 /* mute mixer inputs from 0x1d */
13726 snd_hda_codec_write(codec, 0x0f, 0,
13727 AC_VERB_SET_AMP_GAIN_MUTE,
13729 snd_hda_codec_write(codec, 0x10, 0,
13730 AC_VERB_SET_AMP_GAIN_MUTE,
13733 /* unmute mixer inputs from 0x1d */
13734 snd_hda_codec_write(codec, 0x0f, 0,
13735 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13736 snd_hda_codec_write(codec, 0x10, 0,
13737 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13740 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13741 if (line_nid == 0x14)
13742 dac_vol2 = AMP_OUT_ZERO;
13743 else if (line_nid == 0x15)
13744 dac_vol1 = AMP_OUT_ZERO;
13745 if (hp_nid == 0x14)
13746 dac_vol2 = AMP_OUT_ZERO;
13747 else if (hp_nid == 0x15)
13748 dac_vol1 = AMP_OUT_ZERO;
13749 if (line_nid != 0x16 || hp_nid != 0x16 ||
13750 spec->autocfg.line_out_pins[1] != 0x16 ||
13751 spec->autocfg.line_out_pins[2] != 0x16)
13752 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13754 snd_hda_codec_write(codec, 0x02, 0,
13755 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13756 snd_hda_codec_write(codec, 0x03, 0,
13757 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13760 /* pcm configuration: identical with ALC880 */
13761 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13762 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13763 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13764 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13767 * BIOS auto configuration
13769 static int alc268_parse_auto_config(struct hda_codec *codec)
13771 struct alc_spec *spec = codec->spec;
13773 static hda_nid_t alc268_ignore[] = { 0 };
13775 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13779 if (!spec->autocfg.line_outs) {
13780 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13781 spec->multiout.max_channels = 2;
13782 spec->no_analog = 1;
13785 return 0; /* can't find valid BIOS pin config */
13787 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13790 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13794 spec->multiout.max_channels = 2;
13797 /* digital only support output */
13798 alc_auto_parse_digital(codec);
13799 if (spec->kctls.list)
13800 add_mixer(spec, spec->kctls.list);
13802 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13803 add_mixer(spec, alc268_beep_mixer);
13805 add_verb(spec, alc268_volume_init_verbs);
13806 spec->num_mux_defs = 2;
13807 spec->input_mux = &spec->private_imux[0];
13809 err = alc_auto_add_mic_boost(codec);
13813 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13818 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13820 /* init callback for auto-configuration model -- overriding the default init */
13821 static void alc268_auto_init(struct hda_codec *codec)
13823 struct alc_spec *spec = codec->spec;
13824 alc268_auto_init_multi_out(codec);
13825 alc268_auto_init_hp_out(codec);
13826 alc268_auto_init_mono_speaker_out(codec);
13827 alc268_auto_init_analog_input(codec);
13828 alc_auto_init_digital(codec);
13829 if (spec->unsol_event)
13830 alc_inithook(codec);
13834 * configuration and preset
13836 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13837 [ALC267_QUANTA_IL1] = "quanta-il1",
13838 [ALC268_3ST] = "3stack",
13839 [ALC268_TOSHIBA] = "toshiba",
13840 [ALC268_ACER] = "acer",
13841 [ALC268_ACER_DMIC] = "acer-dmic",
13842 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13843 [ALC268_DELL] = "dell",
13844 [ALC268_ZEPTO] = "zepto",
13845 #ifdef CONFIG_SND_DEBUG
13846 [ALC268_TEST] = "test",
13848 [ALC268_AUTO] = "auto",
13851 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13852 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13853 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13854 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13855 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13856 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13857 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13858 ALC268_ACER_ASPIRE_ONE),
13859 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13860 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13861 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13862 /* almost compatible with toshiba but with optional digital outs;
13863 * auto-probing seems working fine
13865 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13867 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13868 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13869 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13870 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13871 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13875 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13876 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13877 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13878 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13879 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13884 static struct alc_config_preset alc268_presets[] = {
13885 [ALC267_QUANTA_IL1] = {
13886 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13887 alc268_capture_nosrc_mixer },
13888 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13889 alc267_quanta_il1_verbs },
13890 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13891 .dac_nids = alc268_dac_nids,
13892 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13893 .adc_nids = alc268_adc_nids_alt,
13895 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13896 .channel_mode = alc268_modes,
13897 .unsol_event = alc_sku_unsol_event,
13898 .setup = alc267_quanta_il1_setup,
13899 .init_hook = alc_inithook,
13902 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13903 alc268_beep_mixer },
13904 .init_verbs = { alc268_base_init_verbs },
13905 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13906 .dac_nids = alc268_dac_nids,
13907 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13908 .adc_nids = alc268_adc_nids_alt,
13909 .capsrc_nids = alc268_capsrc_nids,
13911 .dig_out_nid = ALC268_DIGOUT_NID,
13912 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13913 .channel_mode = alc268_modes,
13914 .input_mux = &alc268_capture_source,
13916 [ALC268_TOSHIBA] = {
13917 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13918 alc268_beep_mixer },
13919 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13920 alc268_toshiba_verbs },
13921 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13922 .dac_nids = alc268_dac_nids,
13923 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13924 .adc_nids = alc268_adc_nids_alt,
13925 .capsrc_nids = alc268_capsrc_nids,
13927 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13928 .channel_mode = alc268_modes,
13929 .input_mux = &alc268_capture_source,
13930 .unsol_event = alc268_toshiba_unsol_event,
13931 .setup = alc268_toshiba_setup,
13932 .init_hook = alc268_toshiba_automute,
13935 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13936 alc268_beep_mixer },
13937 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13938 alc268_acer_verbs },
13939 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13940 .dac_nids = alc268_dac_nids,
13941 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13942 .adc_nids = alc268_adc_nids_alt,
13943 .capsrc_nids = alc268_capsrc_nids,
13945 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13946 .channel_mode = alc268_modes,
13947 .input_mux = &alc268_acer_capture_source,
13948 .unsol_event = alc268_acer_unsol_event,
13949 .init_hook = alc268_acer_init_hook,
13951 [ALC268_ACER_DMIC] = {
13952 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13953 alc268_beep_mixer },
13954 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13955 alc268_acer_verbs },
13956 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13957 .dac_nids = alc268_dac_nids,
13958 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13959 .adc_nids = alc268_adc_nids_alt,
13960 .capsrc_nids = alc268_capsrc_nids,
13962 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13963 .channel_mode = alc268_modes,
13964 .input_mux = &alc268_acer_dmic_capture_source,
13965 .unsol_event = alc268_acer_unsol_event,
13966 .init_hook = alc268_acer_init_hook,
13968 [ALC268_ACER_ASPIRE_ONE] = {
13969 .mixers = { alc268_acer_aspire_one_mixer,
13971 alc268_capture_nosrc_mixer },
13972 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13973 alc268_acer_aspire_one_verbs },
13974 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13975 .dac_nids = alc268_dac_nids,
13976 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13977 .adc_nids = alc268_adc_nids_alt,
13978 .capsrc_nids = alc268_capsrc_nids,
13980 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13981 .channel_mode = alc268_modes,
13982 .unsol_event = alc268_acer_lc_unsol_event,
13983 .setup = alc268_acer_lc_setup,
13984 .init_hook = alc268_acer_lc_init_hook,
13987 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13988 alc268_capture_nosrc_mixer },
13989 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13990 alc268_dell_verbs },
13991 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13992 .dac_nids = alc268_dac_nids,
13993 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13994 .adc_nids = alc268_adc_nids_alt,
13995 .capsrc_nids = alc268_capsrc_nids,
13997 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13998 .channel_mode = alc268_modes,
13999 .unsol_event = alc_sku_unsol_event,
14000 .setup = alc268_dell_setup,
14001 .init_hook = alc_inithook,
14004 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
14005 alc268_beep_mixer },
14006 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14007 alc268_toshiba_verbs },
14008 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14009 .dac_nids = alc268_dac_nids,
14010 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14011 .adc_nids = alc268_adc_nids_alt,
14012 .capsrc_nids = alc268_capsrc_nids,
14014 .dig_out_nid = ALC268_DIGOUT_NID,
14015 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14016 .channel_mode = alc268_modes,
14017 .input_mux = &alc268_capture_source,
14018 .setup = alc268_toshiba_setup,
14019 .init_hook = alc268_toshiba_automute,
14021 #ifdef CONFIG_SND_DEBUG
14023 .mixers = { alc268_test_mixer, alc268_capture_mixer },
14024 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14025 alc268_volume_init_verbs },
14026 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14027 .dac_nids = alc268_dac_nids,
14028 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14029 .adc_nids = alc268_adc_nids_alt,
14030 .capsrc_nids = alc268_capsrc_nids,
14032 .dig_out_nid = ALC268_DIGOUT_NID,
14033 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14034 .channel_mode = alc268_modes,
14035 .input_mux = &alc268_capture_source,
14040 static int patch_alc268(struct hda_codec *codec)
14042 struct alc_spec *spec;
14044 int i, has_beep, err;
14046 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14050 codec->spec = spec;
14052 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14056 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14057 board_config = snd_hda_check_board_codec_sid_config(codec,
14058 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14060 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14061 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14063 board_config = ALC268_AUTO;
14066 if (board_config == ALC268_AUTO) {
14067 /* automatic parse from the BIOS config */
14068 err = alc268_parse_auto_config(codec);
14074 "hda_codec: Cannot set up configuration "
14075 "from BIOS. Using base mode...\n");
14076 board_config = ALC268_3ST;
14080 if (board_config != ALC268_AUTO)
14081 setup_preset(codec, &alc268_presets[board_config]);
14083 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14084 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14085 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14087 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14090 for (i = 0; i < spec->num_mixers; i++) {
14091 if (spec->mixers[i] == alc268_beep_mixer) {
14098 err = snd_hda_attach_beep_device(codec, 0x1);
14103 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14104 /* override the amp caps for beep generator */
14105 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14106 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14107 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14108 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14109 (0 << AC_AMPCAP_MUTE_SHIFT));
14112 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14113 /* check whether NID 0x07 is valid */
14114 unsigned int wcap = get_wcaps(codec, 0x07);
14117 spec->capsrc_nids = alc268_capsrc_nids;
14119 wcap = get_wcaps_type(wcap);
14120 if (spec->auto_mic ||
14121 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14122 spec->adc_nids = alc268_adc_nids_alt;
14123 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14124 if (spec->auto_mic)
14125 fixup_automic_adc(codec);
14126 if (spec->auto_mic || spec->input_mux->num_items == 1)
14127 add_mixer(spec, alc268_capture_nosrc_mixer);
14129 add_mixer(spec, alc268_capture_alt_mixer);
14131 spec->adc_nids = alc268_adc_nids;
14132 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14133 add_mixer(spec, alc268_capture_mixer);
14135 /* set default input source */
14136 for (i = 0; i < spec->num_adc_nids; i++)
14137 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14138 0, AC_VERB_SET_CONNECT_SEL,
14139 i < spec->num_mux_defs ?
14140 spec->input_mux[i].items[0].index :
14141 spec->input_mux->items[0].index);
14144 spec->vmaster_nid = 0x02;
14146 codec->patch_ops = alc_patch_ops;
14147 if (board_config == ALC268_AUTO)
14148 spec->init_hook = alc268_auto_init;
14150 alc_init_jacks(codec);
14156 * ALC269 channel source setting (2 channel)
14158 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14160 #define alc269_dac_nids alc260_dac_nids
14162 static hda_nid_t alc269_adc_nids[1] = {
14167 static hda_nid_t alc269_capsrc_nids[1] = {
14171 static hda_nid_t alc269vb_adc_nids[1] = {
14176 static hda_nid_t alc269vb_capsrc_nids[1] = {
14180 static hda_nid_t alc269_adc_candidates[] = {
14184 #define alc269_modes alc260_modes
14185 #define alc269_capture_source alc880_lg_lw_capture_source
14187 static struct snd_kcontrol_new alc269_base_mixer[] = {
14188 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14189 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14190 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14191 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14194 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14195 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14196 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14197 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14199 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14203 static struct snd_kcontrol_new alc269_quanta_fl1_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),
14224 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14225 /* output mixer control */
14226 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14228 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14229 .name = "Master Playback Switch",
14230 .subdevice = HDA_SUBDEV_AMP_FLAG,
14231 .info = snd_hda_mixer_amp_switch_info,
14232 .get = snd_hda_mixer_amp_switch_get,
14233 .put = alc268_acer_master_sw_put,
14234 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14238 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14239 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14240 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14241 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14242 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14243 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14244 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14248 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14249 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14250 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14252 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14256 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14257 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14258 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14264 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14265 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14266 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14270 /* capture mixer elements */
14271 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14272 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14273 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14274 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14275 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14279 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14280 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14281 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14282 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14286 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14287 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14288 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14289 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14290 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14294 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14295 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14296 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14297 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14302 #define alc269_fujitsu_mixer alc269_laptop_mixer
14304 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14305 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14306 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14308 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14309 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14310 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14314 static struct hda_verb alc269_lifebook_verbs[] = {
14315 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14316 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14317 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14318 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14321 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14322 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14323 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14324 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14328 /* toggle speaker-output according to the hp-jack state */
14329 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14331 unsigned int present;
14332 unsigned char bits;
14334 present = snd_hda_jack_detect(codec, 0x15);
14335 bits = present ? HDA_AMP_MUTE : 0;
14336 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14337 HDA_AMP_MUTE, bits);
14338 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14339 HDA_AMP_MUTE, bits);
14341 snd_hda_codec_write(codec, 0x20, 0,
14342 AC_VERB_SET_COEF_INDEX, 0x0c);
14343 snd_hda_codec_write(codec, 0x20, 0,
14344 AC_VERB_SET_PROC_COEF, 0x680);
14346 snd_hda_codec_write(codec, 0x20, 0,
14347 AC_VERB_SET_COEF_INDEX, 0x0c);
14348 snd_hda_codec_write(codec, 0x20, 0,
14349 AC_VERB_SET_PROC_COEF, 0x480);
14352 /* toggle speaker-output according to the hp-jacks state */
14353 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14355 unsigned int present;
14356 unsigned char bits;
14358 /* Check laptop headphone socket */
14359 present = snd_hda_jack_detect(codec, 0x15);
14361 /* Check port replicator headphone socket */
14362 present |= snd_hda_jack_detect(codec, 0x1a);
14364 bits = present ? HDA_AMP_MUTE : 0;
14365 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14366 HDA_AMP_MUTE, bits);
14367 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14368 HDA_AMP_MUTE, bits);
14370 snd_hda_codec_write(codec, 0x20, 0,
14371 AC_VERB_SET_COEF_INDEX, 0x0c);
14372 snd_hda_codec_write(codec, 0x20, 0,
14373 AC_VERB_SET_PROC_COEF, 0x680);
14375 snd_hda_codec_write(codec, 0x20, 0,
14376 AC_VERB_SET_COEF_INDEX, 0x0c);
14377 snd_hda_codec_write(codec, 0x20, 0,
14378 AC_VERB_SET_PROC_COEF, 0x480);
14381 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14383 unsigned int present_laptop;
14384 unsigned int present_dock;
14386 present_laptop = snd_hda_jack_detect(codec, 0x18);
14387 present_dock = snd_hda_jack_detect(codec, 0x1b);
14389 /* Laptop mic port overrides dock mic port, design decision */
14391 snd_hda_codec_write(codec, 0x23, 0,
14392 AC_VERB_SET_CONNECT_SEL, 0x3);
14393 if (present_laptop)
14394 snd_hda_codec_write(codec, 0x23, 0,
14395 AC_VERB_SET_CONNECT_SEL, 0x0);
14396 if (!present_dock && !present_laptop)
14397 snd_hda_codec_write(codec, 0x23, 0,
14398 AC_VERB_SET_CONNECT_SEL, 0x1);
14401 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14404 switch (res >> 26) {
14405 case ALC880_HP_EVENT:
14406 alc269_quanta_fl1_speaker_automute(codec);
14408 case ALC880_MIC_EVENT:
14409 alc_mic_automute(codec);
14414 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14417 if ((res >> 26) == ALC880_HP_EVENT)
14418 alc269_lifebook_speaker_automute(codec);
14419 if ((res >> 26) == ALC880_MIC_EVENT)
14420 alc269_lifebook_mic_autoswitch(codec);
14423 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14425 struct alc_spec *spec = codec->spec;
14426 spec->autocfg.hp_pins[0] = 0x15;
14427 spec->autocfg.speaker_pins[0] = 0x14;
14428 spec->ext_mic.pin = 0x18;
14429 spec->ext_mic.mux_idx = 0;
14430 spec->int_mic.pin = 0x19;
14431 spec->int_mic.mux_idx = 1;
14432 spec->auto_mic = 1;
14435 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14437 alc269_quanta_fl1_speaker_automute(codec);
14438 alc_mic_automute(codec);
14441 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14443 alc269_lifebook_speaker_automute(codec);
14444 alc269_lifebook_mic_autoswitch(codec);
14447 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14448 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14449 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14450 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14451 {0x08, 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 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14458 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14459 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14460 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14461 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14463 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14464 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14468 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14469 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14470 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14471 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14472 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14473 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14474 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14475 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14479 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14480 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14481 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14482 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14484 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14485 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14486 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14490 static struct hda_verb alc271_acer_dmic_verbs[] = {
14491 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14492 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14493 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14495 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14496 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14497 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14498 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14499 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14500 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14504 /* toggle speaker-output according to the hp-jack state */
14505 static void alc269_speaker_automute(struct hda_codec *codec)
14507 struct alc_spec *spec = codec->spec;
14508 unsigned int nid = spec->autocfg.hp_pins[0];
14509 unsigned int present;
14510 unsigned char bits;
14512 present = snd_hda_jack_detect(codec, nid);
14513 bits = present ? HDA_AMP_MUTE : 0;
14514 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14515 HDA_AMP_MUTE, bits);
14516 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14517 HDA_AMP_MUTE, bits);
14518 alc_report_jack(codec, nid);
14521 /* unsolicited event for HP jack sensing */
14522 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14525 switch (res >> 26) {
14526 case ALC880_HP_EVENT:
14527 alc269_speaker_automute(codec);
14529 case ALC880_MIC_EVENT:
14530 alc_mic_automute(codec);
14535 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14537 struct alc_spec *spec = codec->spec;
14538 spec->autocfg.hp_pins[0] = 0x15;
14539 spec->autocfg.speaker_pins[0] = 0x14;
14540 spec->ext_mic.pin = 0x18;
14541 spec->ext_mic.mux_idx = 0;
14542 spec->int_mic.pin = 0x19;
14543 spec->int_mic.mux_idx = 1;
14544 spec->auto_mic = 1;
14547 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14549 struct alc_spec *spec = codec->spec;
14550 spec->autocfg.hp_pins[0] = 0x15;
14551 spec->autocfg.speaker_pins[0] = 0x14;
14552 spec->ext_mic.pin = 0x18;
14553 spec->ext_mic.mux_idx = 0;
14554 spec->int_mic.pin = 0x12;
14555 spec->int_mic.mux_idx = 5;
14556 spec->auto_mic = 1;
14559 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14561 struct alc_spec *spec = codec->spec;
14562 spec->autocfg.hp_pins[0] = 0x21;
14563 spec->autocfg.speaker_pins[0] = 0x14;
14564 spec->ext_mic.pin = 0x18;
14565 spec->ext_mic.mux_idx = 0;
14566 spec->int_mic.pin = 0x19;
14567 spec->int_mic.mux_idx = 1;
14568 spec->auto_mic = 1;
14571 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14573 struct alc_spec *spec = codec->spec;
14574 spec->autocfg.hp_pins[0] = 0x21;
14575 spec->autocfg.speaker_pins[0] = 0x14;
14576 spec->ext_mic.pin = 0x18;
14577 spec->ext_mic.mux_idx = 0;
14578 spec->int_mic.pin = 0x12;
14579 spec->int_mic.mux_idx = 6;
14580 spec->auto_mic = 1;
14583 static void alc269_laptop_inithook(struct hda_codec *codec)
14585 alc269_speaker_automute(codec);
14586 alc_mic_automute(codec);
14590 * generic initialization of ADC, input mixers and output mixers
14592 static struct hda_verb alc269_init_verbs[] = {
14594 * Unmute ADC0 and set the default input to mic-in
14596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14599 * Set up output mixers (0x02 - 0x03)
14601 /* set vol=0 to output mixers */
14602 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14603 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14605 /* set up input amps for analog loopback */
14606 /* Amp Indices: DAC = 0, mixer = 1 */
14607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14610 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14615 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14616 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14618 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14619 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14622 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14623 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14625 /* FIXME: use Mux-type input source selection */
14626 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14627 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14628 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14631 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14635 static struct hda_verb alc269vb_init_verbs[] = {
14637 * Unmute ADC0 and set the default input to mic-in
14639 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14642 * Set up output mixers (0x02 - 0x03)
14644 /* set vol=0 to output mixers */
14645 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14646 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14648 /* set up input amps for analog loopback */
14649 /* Amp Indices: DAC = 0, mixer = 1 */
14650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14654 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14655 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14657 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14658 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14659 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14660 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14661 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14662 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14663 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14666 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14668 /* FIXME: use Mux-type input source selection */
14669 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14670 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14671 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14674 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14678 #define alc269_auto_create_multi_out_ctls \
14679 alc268_auto_create_multi_out_ctls
14680 #define alc269_auto_create_input_ctls \
14681 alc268_auto_create_input_ctls
14683 #ifdef CONFIG_SND_HDA_POWER_SAVE
14684 #define alc269_loopbacks alc880_loopbacks
14687 /* pcm configuration: identical with ALC880 */
14688 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14689 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14690 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14691 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14693 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14697 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14698 /* NID is set in alc_build_pcms */
14700 .open = alc880_playback_pcm_open,
14701 .prepare = alc880_playback_pcm_prepare,
14702 .cleanup = alc880_playback_pcm_cleanup
14706 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14710 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14711 /* NID is set in alc_build_pcms */
14714 #ifdef CONFIG_SND_HDA_POWER_SAVE
14715 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14717 switch (codec->subsystem_id) {
14724 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14726 /* update mute-LED according to the speaker mute state */
14727 if (nid == 0x01 || nid == 0x14) {
14729 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14734 /* mic2 vref pin is used for mute LED control */
14735 snd_hda_codec_update_cache(codec, 0x19, 0,
14736 AC_VERB_SET_PIN_WIDGET_CONTROL,
14739 return alc_check_power_status(codec, nid);
14741 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14743 static int alc275_setup_dual_adc(struct hda_codec *codec)
14745 struct alc_spec *spec = codec->spec;
14747 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14749 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14750 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14751 if (spec->ext_mic.pin <= 0x12) {
14752 spec->private_adc_nids[0] = 0x08;
14753 spec->private_adc_nids[1] = 0x11;
14754 spec->private_capsrc_nids[0] = 0x23;
14755 spec->private_capsrc_nids[1] = 0x22;
14757 spec->private_adc_nids[0] = 0x11;
14758 spec->private_adc_nids[1] = 0x08;
14759 spec->private_capsrc_nids[0] = 0x22;
14760 spec->private_capsrc_nids[1] = 0x23;
14762 spec->adc_nids = spec->private_adc_nids;
14763 spec->capsrc_nids = spec->private_capsrc_nids;
14764 spec->num_adc_nids = 2;
14765 spec->dual_adc_switch = 1;
14766 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14767 spec->adc_nids[0], spec->adc_nids[1]);
14773 /* different alc269-variants */
14775 ALC269_TYPE_NORMAL,
14776 ALC269_TYPE_ALC258,
14777 ALC269_TYPE_ALC259,
14778 ALC269_TYPE_ALC269VB,
14779 ALC269_TYPE_ALC270,
14780 ALC269_TYPE_ALC271X,
14784 * BIOS auto configuration
14786 static int alc269_parse_auto_config(struct hda_codec *codec)
14788 struct alc_spec *spec = codec->spec;
14790 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14792 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14797 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14800 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14801 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14803 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14808 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14810 alc_auto_parse_digital(codec);
14812 if (spec->kctls.list)
14813 add_mixer(spec, spec->kctls.list);
14815 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14816 add_verb(spec, alc269vb_init_verbs);
14817 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14819 add_verb(spec, alc269_init_verbs);
14820 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14823 spec->num_mux_defs = 1;
14824 spec->input_mux = &spec->private_imux[0];
14826 if (!alc275_setup_dual_adc(codec))
14827 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14828 sizeof(alc269_adc_candidates));
14830 /* set default input source */
14831 if (!spec->dual_adc_switch)
14832 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14833 spec->input_mux->items[0].index);
14835 err = alc_auto_add_mic_boost(codec);
14839 if (!spec->cap_mixer && !spec->no_analog)
14840 set_capture_mixer(codec);
14845 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14846 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14847 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14850 /* init callback for auto-configuration model -- overriding the default init */
14851 static void alc269_auto_init(struct hda_codec *codec)
14853 struct alc_spec *spec = codec->spec;
14854 alc269_auto_init_multi_out(codec);
14855 alc269_auto_init_hp_out(codec);
14856 alc269_auto_init_analog_input(codec);
14857 alc_auto_init_digital(codec);
14858 if (spec->unsol_event)
14859 alc_inithook(codec);
14862 #ifdef SND_HDA_NEEDS_RESUME
14863 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14865 int val = alc_read_coef_idx(codec, 0x04);
14870 alc_write_coef_idx(codec, 0x04, val);
14873 #ifdef CONFIG_SND_HDA_POWER_SAVE
14874 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14876 struct alc_spec *spec = codec->spec;
14878 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14879 alc269_toggle_power_output(codec, 0);
14880 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14881 alc269_toggle_power_output(codec, 0);
14886 if (spec && spec->power_hook)
14887 spec->power_hook(codec);
14890 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14892 static int alc269_resume(struct hda_codec *codec)
14894 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14895 alc269_toggle_power_output(codec, 0);
14899 codec->patch_ops.init(codec);
14901 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14902 alc269_toggle_power_output(codec, 1);
14906 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14907 alc269_toggle_power_output(codec, 1);
14909 snd_hda_codec_resume_amp(codec);
14910 snd_hda_codec_resume_cache(codec);
14911 hda_call_check_power_status(codec, 0x01);
14914 #endif /* SND_HDA_NEEDS_RESUME */
14916 static void alc269_fixup_hweq(struct hda_codec *codec,
14917 const struct alc_fixup *fix, int action)
14921 if (action != ALC_FIXUP_ACT_INIT)
14923 coef = alc_read_coef_idx(codec, 0x1e);
14924 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14928 ALC269_FIXUP_SONY_VAIO,
14929 ALC275_FIXUP_SONY_VAIO_GPIO2,
14930 ALC269_FIXUP_DELL_M101Z,
14931 ALC269_FIXUP_SKU_IGNORE,
14932 ALC269_FIXUP_ASUS_G73JW,
14933 ALC269_FIXUP_LENOVO_EAPD,
14934 ALC275_FIXUP_SONY_HWEQ,
14937 static const struct alc_fixup alc269_fixups[] = {
14938 [ALC269_FIXUP_SONY_VAIO] = {
14939 .type = ALC_FIXUP_VERBS,
14940 .v.verbs = (const struct hda_verb[]) {
14941 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14945 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14946 .type = ALC_FIXUP_VERBS,
14947 .v.verbs = (const struct hda_verb[]) {
14948 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14949 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14950 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14954 .chain_id = ALC269_FIXUP_SONY_VAIO
14956 [ALC269_FIXUP_DELL_M101Z] = {
14957 .type = ALC_FIXUP_VERBS,
14958 .v.verbs = (const struct hda_verb[]) {
14959 /* Enables internal speaker */
14960 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14961 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14965 [ALC269_FIXUP_SKU_IGNORE] = {
14966 .type = ALC_FIXUP_SKU,
14967 .v.sku = ALC_FIXUP_SKU_IGNORE,
14969 [ALC269_FIXUP_ASUS_G73JW] = {
14970 .type = ALC_FIXUP_PINS,
14971 .v.pins = (const struct alc_pincfg[]) {
14972 { 0x17, 0x99130111 }, /* subwoofer */
14976 [ALC269_FIXUP_LENOVO_EAPD] = {
14977 .type = ALC_FIXUP_VERBS,
14978 .v.verbs = (const struct hda_verb[]) {
14979 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14983 [ALC275_FIXUP_SONY_HWEQ] = {
14984 .type = ALC_FIXUP_FUNC,
14985 .v.func = alc269_fixup_hweq,
14987 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14991 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14992 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14993 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14994 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14995 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14996 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14997 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14998 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14999 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
15000 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
15001 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
15002 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
15003 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
15009 * configuration and preset
15011 static const char * const alc269_models[ALC269_MODEL_LAST] = {
15012 [ALC269_BASIC] = "basic",
15013 [ALC269_QUANTA_FL1] = "quanta",
15014 [ALC269_AMIC] = "laptop-amic",
15015 [ALC269_DMIC] = "laptop-dmic",
15016 [ALC269_FUJITSU] = "fujitsu",
15017 [ALC269_LIFEBOOK] = "lifebook",
15018 [ALC269_AUTO] = "auto",
15021 static struct snd_pci_quirk alc269_cfg_tbl[] = {
15022 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
15023 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
15024 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
15026 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
15027 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
15028 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
15029 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
15030 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
15031 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
15032 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15033 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15034 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15035 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15036 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15037 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15038 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15039 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15040 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15041 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15042 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15043 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15044 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15045 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15046 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15047 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15048 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15049 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15050 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15051 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15052 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15053 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15054 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15055 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15056 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15057 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15058 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15059 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15060 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15061 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15062 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15064 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15066 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15067 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15068 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15069 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15070 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15071 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15072 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15073 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15074 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15075 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15079 static struct alc_config_preset alc269_presets[] = {
15081 .mixers = { alc269_base_mixer },
15082 .init_verbs = { alc269_init_verbs },
15083 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15084 .dac_nids = alc269_dac_nids,
15086 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15087 .channel_mode = alc269_modes,
15088 .input_mux = &alc269_capture_source,
15090 [ALC269_QUANTA_FL1] = {
15091 .mixers = { alc269_quanta_fl1_mixer },
15092 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15093 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15094 .dac_nids = alc269_dac_nids,
15096 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15097 .channel_mode = alc269_modes,
15098 .input_mux = &alc269_capture_source,
15099 .unsol_event = alc269_quanta_fl1_unsol_event,
15100 .setup = alc269_quanta_fl1_setup,
15101 .init_hook = alc269_quanta_fl1_init_hook,
15104 .mixers = { alc269_laptop_mixer },
15105 .cap_mixer = alc269_laptop_analog_capture_mixer,
15106 .init_verbs = { alc269_init_verbs,
15107 alc269_laptop_amic_init_verbs },
15108 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15109 .dac_nids = alc269_dac_nids,
15111 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15112 .channel_mode = alc269_modes,
15113 .unsol_event = alc269_laptop_unsol_event,
15114 .setup = alc269_laptop_amic_setup,
15115 .init_hook = alc269_laptop_inithook,
15118 .mixers = { alc269_laptop_mixer },
15119 .cap_mixer = alc269_laptop_digital_capture_mixer,
15120 .init_verbs = { alc269_init_verbs,
15121 alc269_laptop_dmic_init_verbs },
15122 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15123 .dac_nids = alc269_dac_nids,
15125 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15126 .channel_mode = alc269_modes,
15127 .unsol_event = alc269_laptop_unsol_event,
15128 .setup = alc269_laptop_dmic_setup,
15129 .init_hook = alc269_laptop_inithook,
15131 [ALC269VB_AMIC] = {
15132 .mixers = { alc269vb_laptop_mixer },
15133 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15134 .init_verbs = { alc269vb_init_verbs,
15135 alc269vb_laptop_amic_init_verbs },
15136 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15137 .dac_nids = alc269_dac_nids,
15139 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15140 .channel_mode = alc269_modes,
15141 .unsol_event = alc269_laptop_unsol_event,
15142 .setup = alc269vb_laptop_amic_setup,
15143 .init_hook = alc269_laptop_inithook,
15145 [ALC269VB_DMIC] = {
15146 .mixers = { alc269vb_laptop_mixer },
15147 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15148 .init_verbs = { alc269vb_init_verbs,
15149 alc269vb_laptop_dmic_init_verbs },
15150 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15151 .dac_nids = alc269_dac_nids,
15153 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15154 .channel_mode = alc269_modes,
15155 .unsol_event = alc269_laptop_unsol_event,
15156 .setup = alc269vb_laptop_dmic_setup,
15157 .init_hook = alc269_laptop_inithook,
15159 [ALC269_FUJITSU] = {
15160 .mixers = { alc269_fujitsu_mixer },
15161 .cap_mixer = alc269_laptop_digital_capture_mixer,
15162 .init_verbs = { alc269_init_verbs,
15163 alc269_laptop_dmic_init_verbs },
15164 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15165 .dac_nids = alc269_dac_nids,
15167 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15168 .channel_mode = alc269_modes,
15169 .unsol_event = alc269_laptop_unsol_event,
15170 .setup = alc269_laptop_dmic_setup,
15171 .init_hook = alc269_laptop_inithook,
15173 [ALC269_LIFEBOOK] = {
15174 .mixers = { alc269_lifebook_mixer },
15175 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15176 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15177 .dac_nids = alc269_dac_nids,
15179 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15180 .channel_mode = alc269_modes,
15181 .input_mux = &alc269_capture_source,
15182 .unsol_event = alc269_lifebook_unsol_event,
15183 .init_hook = alc269_lifebook_init_hook,
15186 .mixers = { alc269_asus_mixer },
15187 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15188 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15189 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15190 .dac_nids = alc269_dac_nids,
15191 .adc_nids = alc262_dmic_adc_nids,
15192 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15193 .capsrc_nids = alc262_dmic_capsrc_nids,
15194 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15195 .channel_mode = alc269_modes,
15196 .input_mux = &alc269_capture_source,
15197 .dig_out_nid = ALC880_DIGOUT_NID,
15198 .unsol_event = alc_sku_unsol_event,
15199 .setup = alc269vb_laptop_dmic_setup,
15200 .init_hook = alc_inithook,
15204 static int alc269_fill_coef(struct hda_codec *codec)
15208 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15209 alc_write_coef_idx(codec, 0xf, 0x960b);
15210 alc_write_coef_idx(codec, 0xe, 0x8817);
15213 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15214 alc_write_coef_idx(codec, 0xf, 0x960b);
15215 alc_write_coef_idx(codec, 0xe, 0x8814);
15218 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15219 val = alc_read_coef_idx(codec, 0x04);
15220 /* Power up output pin */
15221 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15224 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15225 val = alc_read_coef_idx(codec, 0xd);
15226 if ((val & 0x0c00) >> 10 != 0x1) {
15227 /* Capless ramp up clock control */
15228 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15230 val = alc_read_coef_idx(codec, 0x17);
15231 if ((val & 0x01c0) >> 6 != 0x4) {
15232 /* Class D power on reset */
15233 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15239 static int patch_alc269(struct hda_codec *codec)
15241 struct alc_spec *spec;
15242 int board_config, coef;
15245 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15249 codec->spec = spec;
15251 alc_auto_parse_customize_define(codec);
15253 if (codec->vendor_id == 0x10ec0269) {
15254 coef = alc_read_coef_idx(codec, 0);
15255 if ((coef & 0x00f0) == 0x0010) {
15256 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15257 spec->cdefine.platform_type == 1) {
15258 alc_codec_rename(codec, "ALC271X");
15259 spec->codec_variant = ALC269_TYPE_ALC271X;
15260 } else if ((coef & 0xf000) == 0x1000) {
15261 spec->codec_variant = ALC269_TYPE_ALC270;
15262 } else if ((coef & 0xf000) == 0x2000) {
15263 alc_codec_rename(codec, "ALC259");
15264 spec->codec_variant = ALC269_TYPE_ALC259;
15265 } else if ((coef & 0xf000) == 0x3000) {
15266 alc_codec_rename(codec, "ALC258");
15267 spec->codec_variant = ALC269_TYPE_ALC258;
15269 alc_codec_rename(codec, "ALC269VB");
15270 spec->codec_variant = ALC269_TYPE_ALC269VB;
15273 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15274 alc269_fill_coef(codec);
15277 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15281 if (board_config < 0) {
15282 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15284 board_config = ALC269_AUTO;
15287 if (board_config == ALC269_AUTO) {
15288 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15289 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15292 if (board_config == ALC269_AUTO) {
15293 /* automatic parse from the BIOS config */
15294 err = alc269_parse_auto_config(codec);
15300 "hda_codec: Cannot set up configuration "
15301 "from BIOS. Using base mode...\n");
15302 board_config = ALC269_BASIC;
15306 if (has_cdefine_beep(codec)) {
15307 err = snd_hda_attach_beep_device(codec, 0x1);
15314 if (board_config != ALC269_AUTO)
15315 setup_preset(codec, &alc269_presets[board_config]);
15317 if (board_config == ALC269_QUANTA_FL1) {
15318 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15319 * fix the sample rate of analog I/O to 44.1kHz
15321 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15322 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15323 } else if (spec->dual_adc_switch) {
15324 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15325 /* switch ADC dynamically */
15326 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15328 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15329 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15331 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15332 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15334 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15335 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15336 spec->adc_nids = alc269_adc_nids;
15337 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15338 spec->capsrc_nids = alc269_capsrc_nids;
15340 spec->adc_nids = alc269vb_adc_nids;
15341 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15342 spec->capsrc_nids = alc269vb_capsrc_nids;
15346 if (!spec->cap_mixer)
15347 set_capture_mixer(codec);
15348 if (has_cdefine_beep(codec))
15349 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15351 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15353 spec->vmaster_nid = 0x02;
15355 codec->patch_ops = alc_patch_ops;
15356 #ifdef CONFIG_SND_HDA_POWER_SAVE
15357 codec->patch_ops.suspend = alc269_suspend;
15359 #ifdef SND_HDA_NEEDS_RESUME
15360 codec->patch_ops.resume = alc269_resume;
15362 if (board_config == ALC269_AUTO)
15363 spec->init_hook = alc269_auto_init;
15365 alc_init_jacks(codec);
15366 #ifdef CONFIG_SND_HDA_POWER_SAVE
15367 if (!spec->loopback.amplist)
15368 spec->loopback.amplist = alc269_loopbacks;
15369 if (alc269_mic2_for_mute_led(codec))
15370 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15377 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15381 * set the path ways for 2 channel output
15382 * need to set the codec line out and mic 1 pin widgets to inputs
15384 static struct hda_verb alc861_threestack_ch2_init[] = {
15385 /* set pin widget 1Ah (line in) for input */
15386 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15387 /* set pin widget 18h (mic1/2) for input, for mic also enable
15390 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15392 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15394 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15395 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15401 * need to set the codec line out and mic 1 pin widgets to outputs
15403 static struct hda_verb alc861_threestack_ch6_init[] = {
15404 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15405 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15406 /* set pin widget 18h (mic1) for output (CLFE)*/
15407 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15409 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15410 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15412 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15414 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15415 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15420 static struct hda_channel_mode alc861_threestack_modes[2] = {
15421 { 2, alc861_threestack_ch2_init },
15422 { 6, alc861_threestack_ch6_init },
15424 /* Set mic1 as input and unmute the mixer */
15425 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15426 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15430 /* Set mic1 as output and mute mixer */
15431 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15432 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15433 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15437 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15438 { 2, alc861_uniwill_m31_ch2_init },
15439 { 4, alc861_uniwill_m31_ch4_init },
15442 /* Set mic1 and line-in as input and unmute the mixer */
15443 static struct hda_verb alc861_asus_ch2_init[] = {
15444 /* set pin widget 1Ah (line in) for input */
15445 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15446 /* set pin widget 18h (mic1/2) for input, for mic also enable
15449 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15451 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15453 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15454 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15458 /* Set mic1 nad line-in as output and mute mixer */
15459 static struct hda_verb alc861_asus_ch6_init[] = {
15460 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15461 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15462 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15463 /* set pin widget 18h (mic1) for output (CLFE)*/
15464 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15465 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15466 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15467 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15469 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15471 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15472 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15477 static struct hda_channel_mode alc861_asus_modes[2] = {
15478 { 2, alc861_asus_ch2_init },
15479 { 6, alc861_asus_ch6_init },
15484 static struct snd_kcontrol_new alc861_base_mixer[] = {
15485 /* output mixer control */
15486 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15487 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15488 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15489 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15490 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15492 /*Input mixer control */
15493 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15494 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15495 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15496 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15497 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15498 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15500 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15507 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15508 /* output mixer control */
15509 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15510 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15511 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15512 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15513 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15515 /* Input mixer control */
15516 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15517 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15518 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15519 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15520 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15521 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15523 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15525 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15528 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15529 .name = "Channel Mode",
15530 .info = alc_ch_mode_info,
15531 .get = alc_ch_mode_get,
15532 .put = alc_ch_mode_put,
15533 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15538 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15539 /* output mixer control */
15540 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15542 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15547 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15548 /* output mixer control */
15549 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15550 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15551 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15552 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15553 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15555 /* Input mixer control */
15556 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15557 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15558 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15559 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15560 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15561 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15563 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15565 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15568 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15569 .name = "Channel Mode",
15570 .info = alc_ch_mode_info,
15571 .get = alc_ch_mode_get,
15572 .put = alc_ch_mode_put,
15573 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15578 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15579 /* output mixer control */
15580 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15581 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15582 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15583 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15584 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15586 /* Input mixer control */
15587 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15588 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15589 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15590 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15591 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15592 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15594 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15595 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15596 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15599 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15600 .name = "Channel Mode",
15601 .info = alc_ch_mode_info,
15602 .get = alc_ch_mode_get,
15603 .put = alc_ch_mode_put,
15604 .private_value = ARRAY_SIZE(alc861_asus_modes),
15609 /* additional mixer */
15610 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15611 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15612 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15617 * generic initialization of ADC, input mixers and output mixers
15619 static struct hda_verb alc861_base_init_verbs[] = {
15621 * Unmute ADC0 and set the default input to mic-in
15623 /* port-A for surround (rear panel) */
15624 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15625 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15626 /* port-B for mic-in (rear panel) with vref */
15627 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15628 /* port-C for line-in (rear panel) */
15629 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15630 /* port-D for Front */
15631 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15632 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15633 /* port-E for HP out (front panel) */
15634 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15635 /* route front PCM to HP */
15636 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15637 /* port-F for mic-in (front panel) with vref */
15638 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15639 /* port-G for CLFE (rear panel) */
15640 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15641 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15642 /* port-H for side (rear panel) */
15643 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15644 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15646 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15647 /* route front mic to ADC1*/
15648 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15651 /* Unmute DAC0~3 & spdif out*/
15652 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15653 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15654 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15655 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15658 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15659 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15660 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15661 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15662 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15664 /* Unmute Stereo Mixer 15 */
15665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15667 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15673 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15674 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15675 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15677 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15678 /* hp used DAC 3 (Front) */
15679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15680 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15685 static struct hda_verb alc861_threestack_init_verbs[] = {
15687 * Unmute ADC0 and set the default input to mic-in
15689 /* port-A for surround (rear panel) */
15690 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15691 /* port-B for mic-in (rear panel) with vref */
15692 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15693 /* port-C for line-in (rear panel) */
15694 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15695 /* port-D for Front */
15696 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15697 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15698 /* port-E for HP out (front panel) */
15699 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15700 /* route front PCM to HP */
15701 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15702 /* port-F for mic-in (front panel) with vref */
15703 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15704 /* port-G for CLFE (rear panel) */
15705 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15706 /* port-H for side (rear panel) */
15707 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15709 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15710 /* route front mic to ADC1*/
15711 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15713 /* Unmute DAC0~3 & spdif out*/
15714 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15715 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15716 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15717 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15718 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15720 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15721 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15722 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15723 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15724 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15726 /* Unmute Stereo Mixer 15 */
15727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15729 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15734 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15735 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15736 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15737 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15738 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15739 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15740 /* hp used DAC 3 (Front) */
15741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15742 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15746 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15748 * Unmute ADC0 and set the default input to mic-in
15750 /* port-A for surround (rear panel) */
15751 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15752 /* port-B for mic-in (rear panel) with vref */
15753 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15754 /* port-C for line-in (rear panel) */
15755 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15756 /* port-D for Front */
15757 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15758 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15759 /* port-E for HP out (front panel) */
15760 /* this has to be set to VREF80 */
15761 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15762 /* route front PCM to HP */
15763 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15764 /* port-F for mic-in (front panel) with vref */
15765 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15766 /* port-G for CLFE (rear panel) */
15767 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15768 /* port-H for side (rear panel) */
15769 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15771 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15772 /* route front mic to ADC1*/
15773 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15774 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15775 /* Unmute DAC0~3 & spdif out*/
15776 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15777 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15778 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15779 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15782 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15783 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15784 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15785 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15786 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15788 /* Unmute Stereo Mixer 15 */
15789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15794 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15795 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15796 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15797 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15798 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15800 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15802 /* hp used DAC 3 (Front) */
15803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15808 static struct hda_verb alc861_asus_init_verbs[] = {
15810 * Unmute ADC0 and set the default input to mic-in
15812 /* port-A for surround (rear panel)
15813 * according to codec#0 this is the HP jack
15815 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15816 /* route front PCM to HP */
15817 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15818 /* port-B for mic-in (rear panel) with vref */
15819 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15820 /* port-C for line-in (rear panel) */
15821 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15822 /* port-D for Front */
15823 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15824 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15825 /* port-E for HP out (front panel) */
15826 /* this has to be set to VREF80 */
15827 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15828 /* route front PCM to HP */
15829 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15830 /* port-F for mic-in (front panel) with vref */
15831 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15832 /* port-G for CLFE (rear panel) */
15833 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15834 /* port-H for side (rear panel) */
15835 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15837 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15838 /* route front mic to ADC1*/
15839 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15840 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15841 /* Unmute DAC0~3 & spdif out*/
15842 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15843 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15844 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15845 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15847 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15848 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15849 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15850 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15851 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15853 /* Unmute Stereo Mixer 15 */
15854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15857 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15859 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15860 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15861 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15862 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15864 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15866 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15867 /* hp used DAC 3 (Front) */
15868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15869 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15873 /* additional init verbs for ASUS laptops */
15874 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15875 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15876 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15881 * generic initialization of ADC, input mixers and output mixers
15883 static struct hda_verb alc861_auto_init_verbs[] = {
15885 * Unmute ADC0 and set the default input to mic-in
15887 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15890 /* Unmute DAC0~3 & spdif out*/
15891 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15892 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15893 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15894 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15897 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15898 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15899 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15900 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15901 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15903 /* Unmute Stereo Mixer 15 */
15904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15907 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15909 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15910 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15911 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15912 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15915 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15916 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15918 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15921 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15923 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15924 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15925 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15927 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15932 static struct hda_verb alc861_toshiba_init_verbs[] = {
15933 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15938 /* toggle speaker-output according to the hp-jack state */
15939 static void alc861_toshiba_automute(struct hda_codec *codec)
15941 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15943 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15944 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15945 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15946 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15949 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15952 if ((res >> 26) == ALC880_HP_EVENT)
15953 alc861_toshiba_automute(codec);
15956 /* pcm configuration: identical with ALC880 */
15957 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15958 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15959 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15960 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15963 #define ALC861_DIGOUT_NID 0x07
15965 static struct hda_channel_mode alc861_8ch_modes[1] = {
15969 static hda_nid_t alc861_dac_nids[4] = {
15970 /* front, surround, clfe, side */
15971 0x03, 0x06, 0x05, 0x04
15974 static hda_nid_t alc660_dac_nids[3] = {
15975 /* front, clfe, surround */
15979 static hda_nid_t alc861_adc_nids[1] = {
15984 static struct hda_input_mux alc861_capture_source = {
15988 { "Front Mic", 0x3 },
15995 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15997 struct alc_spec *spec = codec->spec;
15998 hda_nid_t mix, srcs[5];
16001 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
16003 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16006 for (i = 0; i < num; i++) {
16008 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
16009 if (type != AC_WID_AUD_OUT)
16011 for (j = 0; j < spec->multiout.num_dacs; j++)
16012 if (spec->multiout.dac_nids[j] == srcs[i])
16014 if (j >= spec->multiout.num_dacs)
16020 /* fill in the dac_nids table from the parsed pin configuration */
16021 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
16022 const struct auto_pin_cfg *cfg)
16024 struct alc_spec *spec = codec->spec;
16026 hda_nid_t nid, dac;
16028 spec->multiout.dac_nids = spec->private_dac_nids;
16029 for (i = 0; i < cfg->line_outs; i++) {
16030 nid = cfg->line_out_pins[i];
16031 dac = alc861_look_for_dac(codec, nid);
16034 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
16039 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16040 hda_nid_t nid, int idx, unsigned int chs)
16042 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16043 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16046 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16047 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16049 /* add playback controls from the parsed DAC table */
16050 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16051 const struct auto_pin_cfg *cfg)
16053 struct alc_spec *spec = codec->spec;
16054 static const char * const chname[4] = {
16055 "Front", "Surround", NULL /*CLFE*/, "Side"
16057 const char *pfx = alc_get_line_out_pfx(cfg, true);
16061 for (i = 0; i < cfg->line_outs; i++) {
16062 nid = spec->multiout.dac_nids[i];
16065 if (!pfx && i == 2) {
16067 err = alc861_create_out_sw(codec, "Center", nid, 1);
16070 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16074 const char *name = pfx;
16077 err = __alc861_create_out_sw(codec, name, nid, i, 3);
16085 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16087 struct alc_spec *spec = codec->spec;
16094 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16095 nid = alc861_look_for_dac(codec, pin);
16097 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16100 spec->multiout.hp_nid = nid;
16106 /* create playback/capture controls for input pins */
16107 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16108 const struct auto_pin_cfg *cfg)
16110 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16113 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16115 int pin_type, hda_nid_t dac)
16117 hda_nid_t mix, srcs[5];
16120 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16122 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16124 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16126 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16129 for (i = 0; i < num; i++) {
16131 if (srcs[i] == dac || srcs[i] == 0x15)
16132 mute = AMP_IN_UNMUTE(i);
16134 mute = AMP_IN_MUTE(i);
16135 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16140 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16142 struct alc_spec *spec = codec->spec;
16145 for (i = 0; i < spec->autocfg.line_outs; i++) {
16146 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16147 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16149 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16150 spec->multiout.dac_nids[i]);
16154 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16156 struct alc_spec *spec = codec->spec;
16158 if (spec->autocfg.hp_outs)
16159 alc861_auto_set_output_and_unmute(codec,
16160 spec->autocfg.hp_pins[0],
16162 spec->multiout.hp_nid);
16163 if (spec->autocfg.speaker_outs)
16164 alc861_auto_set_output_and_unmute(codec,
16165 spec->autocfg.speaker_pins[0],
16167 spec->multiout.dac_nids[0]);
16170 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16172 struct alc_spec *spec = codec->spec;
16173 struct auto_pin_cfg *cfg = &spec->autocfg;
16176 for (i = 0; i < cfg->num_inputs; i++) {
16177 hda_nid_t nid = cfg->inputs[i].pin;
16178 if (nid >= 0x0c && nid <= 0x11)
16179 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16183 /* parse the BIOS configuration and set up the alc_spec */
16184 /* return 1 if successful, 0 if the proper config is not found,
16185 * or a negative error code
16187 static int alc861_parse_auto_config(struct hda_codec *codec)
16189 struct alc_spec *spec = codec->spec;
16191 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16193 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16197 if (!spec->autocfg.line_outs)
16198 return 0; /* can't find valid BIOS pin config */
16200 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16203 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16206 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16209 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16213 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16215 alc_auto_parse_digital(codec);
16217 if (spec->kctls.list)
16218 add_mixer(spec, spec->kctls.list);
16220 add_verb(spec, alc861_auto_init_verbs);
16222 spec->num_mux_defs = 1;
16223 spec->input_mux = &spec->private_imux[0];
16225 spec->adc_nids = alc861_adc_nids;
16226 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16227 set_capture_mixer(codec);
16229 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16234 /* additional initialization for auto-configuration model */
16235 static void alc861_auto_init(struct hda_codec *codec)
16237 struct alc_spec *spec = codec->spec;
16238 alc861_auto_init_multi_out(codec);
16239 alc861_auto_init_hp_out(codec);
16240 alc861_auto_init_analog_input(codec);
16241 alc_auto_init_digital(codec);
16242 if (spec->unsol_event)
16243 alc_inithook(codec);
16246 #ifdef CONFIG_SND_HDA_POWER_SAVE
16247 static struct hda_amp_list alc861_loopbacks[] = {
16248 { 0x15, HDA_INPUT, 0 },
16249 { 0x15, HDA_INPUT, 1 },
16250 { 0x15, HDA_INPUT, 2 },
16251 { 0x15, HDA_INPUT, 3 },
16258 * configuration and preset
16260 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16261 [ALC861_3ST] = "3stack",
16262 [ALC660_3ST] = "3stack-660",
16263 [ALC861_3ST_DIG] = "3stack-dig",
16264 [ALC861_6ST_DIG] = "6stack-dig",
16265 [ALC861_UNIWILL_M31] = "uniwill-m31",
16266 [ALC861_TOSHIBA] = "toshiba",
16267 [ALC861_ASUS] = "asus",
16268 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16269 [ALC861_AUTO] = "auto",
16272 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16273 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16274 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16275 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16276 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16277 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16278 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16279 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16280 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16281 * Any other models that need this preset?
16283 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16284 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16285 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16286 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16287 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16288 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16289 /* FIXME: the below seems conflict */
16290 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16291 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16292 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16296 static struct alc_config_preset alc861_presets[] = {
16298 .mixers = { alc861_3ST_mixer },
16299 .init_verbs = { alc861_threestack_init_verbs },
16300 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16301 .dac_nids = alc861_dac_nids,
16302 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16303 .channel_mode = alc861_threestack_modes,
16305 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16306 .adc_nids = alc861_adc_nids,
16307 .input_mux = &alc861_capture_source,
16309 [ALC861_3ST_DIG] = {
16310 .mixers = { alc861_base_mixer },
16311 .init_verbs = { alc861_threestack_init_verbs },
16312 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16313 .dac_nids = alc861_dac_nids,
16314 .dig_out_nid = ALC861_DIGOUT_NID,
16315 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16316 .channel_mode = alc861_threestack_modes,
16318 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16319 .adc_nids = alc861_adc_nids,
16320 .input_mux = &alc861_capture_source,
16322 [ALC861_6ST_DIG] = {
16323 .mixers = { alc861_base_mixer },
16324 .init_verbs = { alc861_base_init_verbs },
16325 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16326 .dac_nids = alc861_dac_nids,
16327 .dig_out_nid = ALC861_DIGOUT_NID,
16328 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16329 .channel_mode = alc861_8ch_modes,
16330 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16331 .adc_nids = alc861_adc_nids,
16332 .input_mux = &alc861_capture_source,
16335 .mixers = { alc861_3ST_mixer },
16336 .init_verbs = { alc861_threestack_init_verbs },
16337 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16338 .dac_nids = alc660_dac_nids,
16339 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16340 .channel_mode = alc861_threestack_modes,
16342 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16343 .adc_nids = alc861_adc_nids,
16344 .input_mux = &alc861_capture_source,
16346 [ALC861_UNIWILL_M31] = {
16347 .mixers = { alc861_uniwill_m31_mixer },
16348 .init_verbs = { alc861_uniwill_m31_init_verbs },
16349 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16350 .dac_nids = alc861_dac_nids,
16351 .dig_out_nid = ALC861_DIGOUT_NID,
16352 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16353 .channel_mode = alc861_uniwill_m31_modes,
16355 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16356 .adc_nids = alc861_adc_nids,
16357 .input_mux = &alc861_capture_source,
16359 [ALC861_TOSHIBA] = {
16360 .mixers = { alc861_toshiba_mixer },
16361 .init_verbs = { alc861_base_init_verbs,
16362 alc861_toshiba_init_verbs },
16363 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16364 .dac_nids = alc861_dac_nids,
16365 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16366 .channel_mode = alc883_3ST_2ch_modes,
16367 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16368 .adc_nids = alc861_adc_nids,
16369 .input_mux = &alc861_capture_source,
16370 .unsol_event = alc861_toshiba_unsol_event,
16371 .init_hook = alc861_toshiba_automute,
16374 .mixers = { alc861_asus_mixer },
16375 .init_verbs = { alc861_asus_init_verbs },
16376 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16377 .dac_nids = alc861_dac_nids,
16378 .dig_out_nid = ALC861_DIGOUT_NID,
16379 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16380 .channel_mode = alc861_asus_modes,
16383 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16384 .adc_nids = alc861_adc_nids,
16385 .input_mux = &alc861_capture_source,
16387 [ALC861_ASUS_LAPTOP] = {
16388 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16389 .init_verbs = { alc861_asus_init_verbs,
16390 alc861_asus_laptop_init_verbs },
16391 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16392 .dac_nids = alc861_dac_nids,
16393 .dig_out_nid = ALC861_DIGOUT_NID,
16394 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16395 .channel_mode = alc883_3ST_2ch_modes,
16397 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16398 .adc_nids = alc861_adc_nids,
16399 .input_mux = &alc861_capture_source,
16403 /* Pin config fixes */
16405 PINFIX_FSC_AMILO_PI1505,
16408 static const struct alc_fixup alc861_fixups[] = {
16409 [PINFIX_FSC_AMILO_PI1505] = {
16410 .type = ALC_FIXUP_PINS,
16411 .v.pins = (const struct alc_pincfg[]) {
16412 { 0x0b, 0x0221101f }, /* HP */
16413 { 0x0f, 0x90170310 }, /* speaker */
16419 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16420 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16424 static int patch_alc861(struct hda_codec *codec)
16426 struct alc_spec *spec;
16430 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16434 codec->spec = spec;
16436 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16440 if (board_config < 0) {
16441 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16443 board_config = ALC861_AUTO;
16446 if (board_config == ALC861_AUTO) {
16447 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16448 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16451 if (board_config == ALC861_AUTO) {
16452 /* automatic parse from the BIOS config */
16453 err = alc861_parse_auto_config(codec);
16459 "hda_codec: Cannot set up configuration "
16460 "from BIOS. Using base mode...\n");
16461 board_config = ALC861_3ST_DIG;
16465 err = snd_hda_attach_beep_device(codec, 0x23);
16471 if (board_config != ALC861_AUTO)
16472 setup_preset(codec, &alc861_presets[board_config]);
16474 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16475 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16477 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16478 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16480 if (!spec->cap_mixer)
16481 set_capture_mixer(codec);
16482 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16484 spec->vmaster_nid = 0x03;
16486 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16488 codec->patch_ops = alc_patch_ops;
16489 if (board_config == ALC861_AUTO) {
16490 spec->init_hook = alc861_auto_init;
16491 #ifdef CONFIG_SND_HDA_POWER_SAVE
16492 spec->power_hook = alc_power_eapd;
16495 #ifdef CONFIG_SND_HDA_POWER_SAVE
16496 if (!spec->loopback.amplist)
16497 spec->loopback.amplist = alc861_loopbacks;
16504 * ALC861-VD support
16508 * In addition, an independent DAC
16510 #define ALC861VD_DIGOUT_NID 0x06
16512 static hda_nid_t alc861vd_dac_nids[4] = {
16513 /* front, surr, clfe, side surr */
16514 0x02, 0x03, 0x04, 0x05
16517 /* dac_nids for ALC660vd are in a different order - according to
16518 * Realtek's driver.
16519 * This should probably result in a different mixer for 6stack models
16520 * of ALC660vd codecs, but for now there is only 3stack mixer
16521 * - and it is the same as in 861vd.
16522 * adc_nids in ALC660vd are (is) the same as in 861vd
16524 static hda_nid_t alc660vd_dac_nids[3] = {
16525 /* front, rear, clfe, rear_surr */
16529 static hda_nid_t alc861vd_adc_nids[1] = {
16534 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16537 /* FIXME: should be a matrix-type input source selection */
16538 static struct hda_input_mux alc861vd_capture_source = {
16542 { "Front Mic", 0x1 },
16548 static struct hda_input_mux alc861vd_dallas_capture_source = {
16552 { "Internal Mic", 0x1 },
16556 static struct hda_input_mux alc861vd_hp_capture_source = {
16559 { "Front Mic", 0x0 },
16560 { "ATAPI Mic", 0x1 },
16567 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16574 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16575 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16576 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16577 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16578 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16585 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16586 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16587 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16588 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16589 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16593 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16594 { 6, alc861vd_6stack_ch6_init },
16595 { 8, alc861vd_6stack_ch8_init },
16598 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16600 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16601 .name = "Channel Mode",
16602 .info = alc_ch_mode_info,
16603 .get = alc_ch_mode_get,
16604 .put = alc_ch_mode_put,
16609 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16610 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16612 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16613 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16616 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16617 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16619 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16623 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16624 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16626 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16627 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16629 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16631 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16635 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16636 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16637 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16648 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16649 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16654 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16656 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16658 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16660 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16662 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16663 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16672 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16673 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16674 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16678 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16682 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16686 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16687 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16692 /* Pin assignment: Speaker=0x14, HP = 0x15,
16693 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16695 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16696 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16697 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16698 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16699 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16700 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16702 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16703 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16704 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16705 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16709 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16710 * Front Mic=0x18, ATAPI Mic = 0x19,
16712 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16715 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16716 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16717 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16718 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16719 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16720 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16726 * generic initialization of ADC, input mixers and output mixers
16728 static struct hda_verb alc861vd_volume_init_verbs[] = {
16730 * Unmute ADC0 and set the default input to mic-in
16732 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16733 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16735 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16736 * the analog-loopback mixer widget
16738 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16745 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16752 * Set up output mixers (0x02 - 0x05)
16754 /* set vol=0 to output mixers */
16755 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16756 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16758 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16760 /* set up input amps for analog loopback */
16761 /* Amp Indices: DAC = 0, mixer = 1 */
16762 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16763 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16764 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16765 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16766 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16769 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16775 * 3-stack pin configuration:
16776 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16778 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16780 * Set pin mode and muting
16782 /* set front pin widgets 0x14 for output */
16783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16785 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16787 /* Mic (rear) pin: input vref at 80% */
16788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16790 /* Front Mic pin: input vref at 80% */
16791 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16792 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16793 /* Line In pin: input */
16794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16796 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16799 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16800 /* CD pin widget for input */
16801 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16807 * 6-stack pin configuration:
16809 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16811 * Set pin mode and muting
16813 /* set front pin widgets 0x14 for output */
16814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16815 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16816 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16818 /* Rear Pin: output 1 (0x0d) */
16819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16821 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16822 /* CLFE Pin: output 2 (0x0e) */
16823 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16824 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16825 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16826 /* Side Pin: output 3 (0x0f) */
16827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16829 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16831 /* Mic (rear) pin: input vref at 80% */
16832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16833 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16834 /* Front Mic pin: input vref at 80% */
16835 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16836 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16837 /* Line In pin: input */
16838 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16839 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16840 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16841 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16842 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16843 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16844 /* CD pin widget for input */
16845 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16850 static struct hda_verb alc861vd_eapd_verbs[] = {
16851 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16855 static struct hda_verb alc660vd_eapd_verbs[] = {
16856 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16857 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16861 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16864 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16865 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16870 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16872 struct alc_spec *spec = codec->spec;
16873 spec->autocfg.hp_pins[0] = 0x1b;
16874 spec->autocfg.speaker_pins[0] = 0x14;
16877 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16879 alc_automute_amp(codec);
16880 alc88x_simple_mic_automute(codec);
16883 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16886 switch (res >> 26) {
16887 case ALC880_MIC_EVENT:
16888 alc88x_simple_mic_automute(codec);
16891 alc_automute_amp_unsol_event(codec, res);
16896 static struct hda_verb alc861vd_dallas_verbs[] = {
16897 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16898 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16899 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16900 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16904 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16905 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16906 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16909 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16913 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16915 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16916 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16917 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16918 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16920 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16921 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16922 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16923 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16924 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16925 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16926 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16927 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16929 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16930 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16931 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16934 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16935 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16936 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16941 /* toggle speaker-output according to the hp-jack state */
16942 static void alc861vd_dallas_setup(struct hda_codec *codec)
16944 struct alc_spec *spec = codec->spec;
16946 spec->autocfg.hp_pins[0] = 0x15;
16947 spec->autocfg.speaker_pins[0] = 0x14;
16950 #ifdef CONFIG_SND_HDA_POWER_SAVE
16951 #define alc861vd_loopbacks alc880_loopbacks
16954 /* pcm configuration: identical with ALC880 */
16955 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16956 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16957 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16958 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16961 * configuration and preset
16963 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16964 [ALC660VD_3ST] = "3stack-660",
16965 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16966 [ALC660VD_ASUS_V1S] = "asus-v1s",
16967 [ALC861VD_3ST] = "3stack",
16968 [ALC861VD_3ST_DIG] = "3stack-digout",
16969 [ALC861VD_6ST_DIG] = "6stack-digout",
16970 [ALC861VD_LENOVO] = "lenovo",
16971 [ALC861VD_DALLAS] = "dallas",
16972 [ALC861VD_HP] = "hp",
16973 [ALC861VD_AUTO] = "auto",
16976 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16977 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16978 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16979 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16980 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16981 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16982 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16983 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16984 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16985 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16986 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16987 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16988 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16989 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16990 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16991 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16995 static struct alc_config_preset alc861vd_presets[] = {
16997 .mixers = { alc861vd_3st_mixer },
16998 .init_verbs = { alc861vd_volume_init_verbs,
16999 alc861vd_3stack_init_verbs },
17000 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17001 .dac_nids = alc660vd_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 [ALC660VD_3ST_DIG] = {
17007 .mixers = { alc861vd_3st_mixer },
17008 .init_verbs = { alc861vd_volume_init_verbs,
17009 alc861vd_3stack_init_verbs },
17010 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17011 .dac_nids = alc660vd_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,
17018 .mixers = { alc861vd_3st_mixer },
17019 .init_verbs = { alc861vd_volume_init_verbs,
17020 alc861vd_3stack_init_verbs },
17021 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17022 .dac_nids = alc861vd_dac_nids,
17023 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17024 .channel_mode = alc861vd_3stack_2ch_modes,
17025 .input_mux = &alc861vd_capture_source,
17027 [ALC861VD_3ST_DIG] = {
17028 .mixers = { alc861vd_3st_mixer },
17029 .init_verbs = { alc861vd_volume_init_verbs,
17030 alc861vd_3stack_init_verbs },
17031 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17032 .dac_nids = alc861vd_dac_nids,
17033 .dig_out_nid = ALC861VD_DIGOUT_NID,
17034 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17035 .channel_mode = alc861vd_3stack_2ch_modes,
17036 .input_mux = &alc861vd_capture_source,
17038 [ALC861VD_6ST_DIG] = {
17039 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17040 .init_verbs = { alc861vd_volume_init_verbs,
17041 alc861vd_6stack_init_verbs },
17042 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17043 .dac_nids = alc861vd_dac_nids,
17044 .dig_out_nid = ALC861VD_DIGOUT_NID,
17045 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17046 .channel_mode = alc861vd_6stack_modes,
17047 .input_mux = &alc861vd_capture_source,
17049 [ALC861VD_LENOVO] = {
17050 .mixers = { alc861vd_lenovo_mixer },
17051 .init_verbs = { alc861vd_volume_init_verbs,
17052 alc861vd_3stack_init_verbs,
17053 alc861vd_eapd_verbs,
17054 alc861vd_lenovo_unsol_verbs },
17055 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17056 .dac_nids = alc660vd_dac_nids,
17057 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17058 .channel_mode = alc861vd_3stack_2ch_modes,
17059 .input_mux = &alc861vd_capture_source,
17060 .unsol_event = alc861vd_lenovo_unsol_event,
17061 .setup = alc861vd_lenovo_setup,
17062 .init_hook = alc861vd_lenovo_init_hook,
17064 [ALC861VD_DALLAS] = {
17065 .mixers = { alc861vd_dallas_mixer },
17066 .init_verbs = { alc861vd_dallas_verbs },
17067 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17068 .dac_nids = alc861vd_dac_nids,
17069 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17070 .channel_mode = alc861vd_3stack_2ch_modes,
17071 .input_mux = &alc861vd_dallas_capture_source,
17072 .unsol_event = alc_automute_amp_unsol_event,
17073 .setup = alc861vd_dallas_setup,
17074 .init_hook = alc_automute_amp,
17077 .mixers = { alc861vd_hp_mixer },
17078 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17079 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17080 .dac_nids = alc861vd_dac_nids,
17081 .dig_out_nid = ALC861VD_DIGOUT_NID,
17082 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17083 .channel_mode = alc861vd_3stack_2ch_modes,
17084 .input_mux = &alc861vd_hp_capture_source,
17085 .unsol_event = alc_automute_amp_unsol_event,
17086 .setup = alc861vd_dallas_setup,
17087 .init_hook = alc_automute_amp,
17089 [ALC660VD_ASUS_V1S] = {
17090 .mixers = { alc861vd_lenovo_mixer },
17091 .init_verbs = { alc861vd_volume_init_verbs,
17092 alc861vd_3stack_init_verbs,
17093 alc861vd_eapd_verbs,
17094 alc861vd_lenovo_unsol_verbs },
17095 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17096 .dac_nids = alc660vd_dac_nids,
17097 .dig_out_nid = ALC861VD_DIGOUT_NID,
17098 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17099 .channel_mode = alc861vd_3stack_2ch_modes,
17100 .input_mux = &alc861vd_capture_source,
17101 .unsol_event = alc861vd_lenovo_unsol_event,
17102 .setup = alc861vd_lenovo_setup,
17103 .init_hook = alc861vd_lenovo_init_hook,
17108 * BIOS auto configuration
17110 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17111 const struct auto_pin_cfg *cfg)
17113 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17117 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17118 hda_nid_t nid, int pin_type, int dac_idx)
17120 alc_set_pin_output(codec, nid, pin_type);
17123 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17125 struct alc_spec *spec = codec->spec;
17128 for (i = 0; i <= HDA_SIDE; i++) {
17129 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17130 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17132 alc861vd_auto_set_output_and_unmute(codec, nid,
17138 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17140 struct alc_spec *spec = codec->spec;
17143 pin = spec->autocfg.hp_pins[0];
17144 if (pin) /* connect to front and use dac 0 */
17145 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17146 pin = spec->autocfg.speaker_pins[0];
17148 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17151 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17153 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17155 struct alc_spec *spec = codec->spec;
17156 struct auto_pin_cfg *cfg = &spec->autocfg;
17159 for (i = 0; i < cfg->num_inputs; i++) {
17160 hda_nid_t nid = cfg->inputs[i].pin;
17161 if (alc_is_input_pin(codec, nid)) {
17162 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17163 if (nid != ALC861VD_PIN_CD_NID &&
17164 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17165 snd_hda_codec_write(codec, nid, 0,
17166 AC_VERB_SET_AMP_GAIN_MUTE,
17172 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17174 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17175 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17177 /* add playback controls from the parsed DAC table */
17178 /* Based on ALC880 version. But ALC861VD has separate,
17179 * different NIDs for mute/unmute switch and volume control */
17180 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17181 const struct auto_pin_cfg *cfg)
17183 static const char * const chname[4] = {
17184 "Front", "Surround", "CLFE", "Side"
17186 const char *pfx = alc_get_line_out_pfx(cfg, true);
17187 hda_nid_t nid_v, nid_s;
17190 for (i = 0; i < cfg->line_outs; i++) {
17191 if (!spec->multiout.dac_nids[i])
17193 nid_v = alc861vd_idx_to_mixer_vol(
17195 spec->multiout.dac_nids[i]));
17196 nid_s = alc861vd_idx_to_mixer_switch(
17198 spec->multiout.dac_nids[i]));
17200 if (!pfx && i == 2) {
17202 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17204 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17208 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17210 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17214 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17216 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17220 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17222 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17227 const char *name = pfx;
17230 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17232 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17236 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17238 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17247 /* add playback controls for speaker and HP outputs */
17248 /* Based on ALC880 version. But ALC861VD has separate,
17249 * different NIDs for mute/unmute switch and volume control */
17250 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17251 hda_nid_t pin, const char *pfx)
17253 hda_nid_t nid_v, nid_s;
17259 if (alc880_is_fixed_pin(pin)) {
17260 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17261 /* specify the DAC as the extra output */
17262 if (!spec->multiout.hp_nid)
17263 spec->multiout.hp_nid = nid_v;
17265 spec->multiout.extra_out_nid[0] = nid_v;
17266 /* control HP volume/switch on the output mixer amp */
17267 nid_v = alc861vd_idx_to_mixer_vol(
17268 alc880_fixed_pin_idx(pin));
17269 nid_s = alc861vd_idx_to_mixer_switch(
17270 alc880_fixed_pin_idx(pin));
17272 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17273 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17276 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17277 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17280 } else if (alc880_is_multi_pin(pin)) {
17281 /* set manual connection */
17282 /* we have only a switch on HP-out PIN */
17283 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17284 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17291 /* parse the BIOS configuration and set up the alc_spec
17292 * return 1 if successful, 0 if the proper config is not found,
17293 * or a negative error code
17294 * Based on ALC880 version - had to change it to override
17295 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17296 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17298 struct alc_spec *spec = codec->spec;
17300 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17302 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17306 if (!spec->autocfg.line_outs)
17307 return 0; /* can't find valid BIOS pin config */
17309 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17312 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17315 err = alc861vd_auto_create_extra_out(spec,
17316 spec->autocfg.speaker_pins[0],
17320 err = alc861vd_auto_create_extra_out(spec,
17321 spec->autocfg.hp_pins[0],
17325 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17329 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17331 alc_auto_parse_digital(codec);
17333 if (spec->kctls.list)
17334 add_mixer(spec, spec->kctls.list);
17336 add_verb(spec, alc861vd_volume_init_verbs);
17338 spec->num_mux_defs = 1;
17339 spec->input_mux = &spec->private_imux[0];
17341 err = alc_auto_add_mic_boost(codec);
17345 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17350 /* additional initialization for auto-configuration model */
17351 static void alc861vd_auto_init(struct hda_codec *codec)
17353 struct alc_spec *spec = codec->spec;
17354 alc861vd_auto_init_multi_out(codec);
17355 alc861vd_auto_init_hp_out(codec);
17356 alc861vd_auto_init_analog_input(codec);
17357 alc861vd_auto_init_input_src(codec);
17358 alc_auto_init_digital(codec);
17359 if (spec->unsol_event)
17360 alc_inithook(codec);
17364 ALC660VD_FIX_ASUS_GPIO1
17368 static const struct alc_fixup alc861vd_fixups[] = {
17369 [ALC660VD_FIX_ASUS_GPIO1] = {
17370 .type = ALC_FIXUP_VERBS,
17371 .v.verbs = (const struct hda_verb[]) {
17372 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17373 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17374 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17380 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17381 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17385 static int patch_alc861vd(struct hda_codec *codec)
17387 struct alc_spec *spec;
17388 int err, board_config;
17390 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17394 codec->spec = spec;
17396 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17400 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17401 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17403 board_config = ALC861VD_AUTO;
17406 if (board_config == ALC861VD_AUTO) {
17407 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17408 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17411 if (board_config == ALC861VD_AUTO) {
17412 /* automatic parse from the BIOS config */
17413 err = alc861vd_parse_auto_config(codec);
17419 "hda_codec: Cannot set up configuration "
17420 "from BIOS. Using base mode...\n");
17421 board_config = ALC861VD_3ST;
17425 err = snd_hda_attach_beep_device(codec, 0x23);
17431 if (board_config != ALC861VD_AUTO)
17432 setup_preset(codec, &alc861vd_presets[board_config]);
17434 if (codec->vendor_id == 0x10ec0660) {
17435 /* always turn on EAPD */
17436 add_verb(spec, alc660vd_eapd_verbs);
17439 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17440 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17442 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17443 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17445 if (!spec->adc_nids) {
17446 spec->adc_nids = alc861vd_adc_nids;
17447 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17449 if (!spec->capsrc_nids)
17450 spec->capsrc_nids = alc861vd_capsrc_nids;
17452 set_capture_mixer(codec);
17453 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17455 spec->vmaster_nid = 0x02;
17457 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17459 codec->patch_ops = alc_patch_ops;
17461 if (board_config == ALC861VD_AUTO)
17462 spec->init_hook = alc861vd_auto_init;
17463 #ifdef CONFIG_SND_HDA_POWER_SAVE
17464 if (!spec->loopback.amplist)
17465 spec->loopback.amplist = alc861vd_loopbacks;
17474 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17475 * configuration. Each pin widget can choose any input DACs and a mixer.
17476 * Each ADC is connected from a mixer of all inputs. This makes possible
17477 * 6-channel independent captures.
17479 * In addition, an independent DAC for the multi-playback (not used in this
17482 #define ALC662_DIGOUT_NID 0x06
17483 #define ALC662_DIGIN_NID 0x0a
17485 static hda_nid_t alc662_dac_nids[4] = {
17486 /* front, rear, clfe, rear_surr */
17490 static hda_nid_t alc272_dac_nids[2] = {
17494 static hda_nid_t alc662_adc_nids[2] = {
17499 static hda_nid_t alc272_adc_nids[1] = {
17504 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17505 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17509 /* FIXME: should be a matrix-type input source selection */
17510 static struct hda_input_mux alc662_capture_source = {
17514 { "Front Mic", 0x1 },
17520 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17528 static struct hda_input_mux alc663_capture_source = {
17532 { "Front Mic", 0x1 },
17537 #if 0 /* set to 1 for testing other input sources below */
17538 static struct hda_input_mux alc272_nc10_capture_source = {
17541 { "Autoselect Mic", 0x0 },
17542 { "Internal Mic", 0x1 },
17543 { "In-0x02", 0x2 },
17544 { "In-0x03", 0x3 },
17545 { "In-0x04", 0x4 },
17546 { "In-0x05", 0x5 },
17547 { "In-0x06", 0x6 },
17548 { "In-0x07", 0x7 },
17549 { "In-0x08", 0x8 },
17550 { "In-0x09", 0x9 },
17551 { "In-0x0a", 0x0a },
17552 { "In-0x0b", 0x0b },
17553 { "In-0x0c", 0x0c },
17554 { "In-0x0d", 0x0d },
17555 { "In-0x0e", 0x0e },
17556 { "In-0x0f", 0x0f },
17564 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17571 static struct hda_verb alc662_3ST_ch2_init[] = {
17572 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17573 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17574 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17575 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17582 static struct hda_verb alc662_3ST_ch6_init[] = {
17583 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17584 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17585 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17586 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17587 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17588 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17592 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17593 { 2, alc662_3ST_ch2_init },
17594 { 6, alc662_3ST_ch6_init },
17600 static struct hda_verb alc662_sixstack_ch6_init[] = {
17601 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17602 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17603 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17610 static struct hda_verb alc662_sixstack_ch8_init[] = {
17611 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17612 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17613 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17617 static struct hda_channel_mode alc662_5stack_modes[2] = {
17618 { 2, alc662_sixstack_ch6_init },
17619 { 6, alc662_sixstack_ch8_init },
17622 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17623 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17626 static struct snd_kcontrol_new alc662_base_mixer[] = {
17627 /* output mixer control */
17628 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17629 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17630 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17631 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17632 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17633 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17634 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17635 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17638 /*Input mixer control */
17639 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17640 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17641 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17642 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17643 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17644 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17650 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17651 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17652 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 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_3ST_6ch_mixer[] = {
17666 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17667 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17668 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17669 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17670 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17671 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17672 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17673 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17674 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17675 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17676 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17677 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17678 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17680 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17681 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17682 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17686 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17687 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17688 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17690 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17699 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17700 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17701 ALC262_HIPPO_MASTER_SWITCH,
17703 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17707 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17708 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17709 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17713 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17714 ALC262_HIPPO_MASTER_SWITCH,
17715 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17716 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17717 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17718 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17719 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17720 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17721 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17727 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17728 .ops = &snd_hda_bind_vol,
17730 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17731 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17736 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17737 .ops = &snd_hda_bind_sw,
17739 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17740 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17745 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17746 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17747 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17753 static struct hda_bind_ctls alc663_asus_tree_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(0x21, 3, 0, HDA_OUTPUT),
17763 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17764 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17765 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_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),
17774 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17775 .ops = &snd_hda_bind_sw,
17777 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17778 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17779 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17784 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17785 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17786 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17788 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17789 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17790 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17794 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17795 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17796 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17798 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17800 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17801 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17805 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17806 .ops = &snd_hda_bind_vol,
17808 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17809 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17814 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17815 .ops = &snd_hda_bind_sw,
17817 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17818 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17823 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17824 HDA_BIND_VOL("Master Playback Volume",
17825 &alc663_asus_two_bind_master_vol),
17826 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17827 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17830 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17834 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17835 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17836 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17837 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17838 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17840 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17844 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17845 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17846 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17847 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17848 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17849 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17852 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17853 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17854 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17858 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17859 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17860 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17864 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17865 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17866 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17867 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17868 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17872 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17873 .ops = &snd_hda_bind_sw,
17875 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17876 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17877 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17878 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17879 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17884 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17885 .ops = &snd_hda_bind_sw,
17887 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17888 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17893 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17894 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17895 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17896 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17897 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17898 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17899 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17900 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17902 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17906 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17907 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17908 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17909 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17910 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17911 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17918 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17921 .name = "Channel Mode",
17922 .info = alc_ch_mode_info,
17923 .get = alc_ch_mode_get,
17924 .put = alc_ch_mode_put,
17929 static struct hda_verb alc662_init_verbs[] = {
17930 /* ADC: mute amp left and right */
17931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17932 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17936 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17937 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17938 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17939 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17941 /* Front Pin: output 0 (0x0c) */
17942 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17943 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17945 /* Rear Pin: output 1 (0x0d) */
17946 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17947 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17949 /* CLFE Pin: output 2 (0x0e) */
17950 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17951 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17953 /* Mic (rear) pin: input vref at 80% */
17954 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17955 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17956 /* Front Mic pin: input vref at 80% */
17957 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17958 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17959 /* Line In pin: input */
17960 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17961 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17962 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17963 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17964 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17965 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17966 /* CD pin widget for input */
17967 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17969 /* FIXME: use matrix-type input source selection */
17970 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17975 /* always trun on EAPD */
17976 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17977 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17982 static struct hda_verb alc663_init_verbs[] = {
17983 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17984 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17985 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17986 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17988 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17992 static struct hda_verb alc272_init_verbs[] = {
17993 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17994 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17995 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17996 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17997 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17998 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17999 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18000 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18004 static struct hda_verb alc662_sue_init_verbs[] = {
18005 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18006 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18010 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
18011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18012 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18016 /* Set Unsolicited Event*/
18017 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
18018 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18019 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18023 static struct hda_verb alc663_m51va_init_verbs[] = {
18024 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18025 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18026 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18027 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18028 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18032 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18036 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18037 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18038 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18039 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18042 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18043 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18047 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18048 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18049 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18050 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18051 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18054 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18055 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18059 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18062 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18065 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18066 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18070 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18071 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18072 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18073 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18074 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18075 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18077 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18080 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18081 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18086 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18087 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18088 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18089 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18090 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18091 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18093 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18096 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18097 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18098 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18102 static struct hda_verb alc663_g71v_init_verbs[] = {
18103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18104 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18105 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18107 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18108 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18109 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18111 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18112 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18113 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18117 static struct hda_verb alc663_g50v_init_verbs[] = {
18118 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18119 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18120 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18122 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18123 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18127 static struct hda_verb alc662_ecs_init_verbs[] = {
18128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18130 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18131 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18135 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18136 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18137 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18138 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18139 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18140 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18141 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18142 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18143 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18145 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18146 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18150 static struct hda_verb alc272_dell_init_verbs[] = {
18151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18152 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18154 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18155 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18156 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18157 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18158 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18159 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18160 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18161 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18165 static struct hda_verb alc663_mode7_init_verbs[] = {
18166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18168 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18169 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18170 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18171 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18172 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18173 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18174 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18175 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18178 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18179 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18184 static struct hda_verb alc663_mode8_init_verbs[] = {
18185 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18189 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18190 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18191 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18192 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18193 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18194 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18195 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18198 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18199 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18200 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18204 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18205 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18206 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18210 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18211 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18212 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18216 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18218 unsigned int present;
18219 unsigned char bits;
18221 present = snd_hda_jack_detect(codec, 0x14);
18222 bits = present ? HDA_AMP_MUTE : 0;
18224 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18225 HDA_AMP_MUTE, bits);
18228 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18230 unsigned int present;
18231 unsigned char bits;
18233 present = snd_hda_jack_detect(codec, 0x1b);
18234 bits = present ? HDA_AMP_MUTE : 0;
18236 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18237 HDA_AMP_MUTE, bits);
18238 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18239 HDA_AMP_MUTE, bits);
18242 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18245 if ((res >> 26) == ALC880_HP_EVENT)
18246 alc662_lenovo_101e_all_automute(codec);
18247 if ((res >> 26) == ALC880_FRONT_EVENT)
18248 alc662_lenovo_101e_ispeaker_automute(codec);
18251 /* unsolicited event for HP jack sensing */
18252 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18255 if ((res >> 26) == ALC880_MIC_EVENT)
18256 alc_mic_automute(codec);
18258 alc262_hippo_unsol_event(codec, res);
18261 static void alc662_eeepc_setup(struct hda_codec *codec)
18263 struct alc_spec *spec = codec->spec;
18265 alc262_hippo1_setup(codec);
18266 spec->ext_mic.pin = 0x18;
18267 spec->ext_mic.mux_idx = 0;
18268 spec->int_mic.pin = 0x19;
18269 spec->int_mic.mux_idx = 1;
18270 spec->auto_mic = 1;
18273 static void alc662_eeepc_inithook(struct hda_codec *codec)
18275 alc262_hippo_automute(codec);
18276 alc_mic_automute(codec);
18279 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18281 struct alc_spec *spec = codec->spec;
18283 spec->autocfg.hp_pins[0] = 0x14;
18284 spec->autocfg.speaker_pins[0] = 0x1b;
18287 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18289 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18291 unsigned int present;
18292 unsigned char bits;
18294 present = snd_hda_jack_detect(codec, 0x21);
18295 bits = present ? HDA_AMP_MUTE : 0;
18296 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18297 HDA_AMP_MUTE, bits);
18298 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18299 HDA_AMP_MUTE, bits);
18302 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18304 unsigned int present;
18305 unsigned char bits;
18307 present = snd_hda_jack_detect(codec, 0x21);
18308 bits = present ? HDA_AMP_MUTE : 0;
18309 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18310 HDA_AMP_MUTE, bits);
18311 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18312 HDA_AMP_MUTE, bits);
18313 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18314 HDA_AMP_MUTE, bits);
18315 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18316 HDA_AMP_MUTE, bits);
18319 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18321 unsigned int present;
18322 unsigned char bits;
18324 present = snd_hda_jack_detect(codec, 0x15);
18325 bits = present ? HDA_AMP_MUTE : 0;
18326 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18327 HDA_AMP_MUTE, bits);
18328 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18329 HDA_AMP_MUTE, bits);
18330 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18331 HDA_AMP_MUTE, bits);
18332 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18333 HDA_AMP_MUTE, bits);
18336 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18338 unsigned int present;
18339 unsigned char bits;
18341 present = snd_hda_jack_detect(codec, 0x1b);
18342 bits = present ? 0 : PIN_OUT;
18343 snd_hda_codec_write(codec, 0x14, 0,
18344 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18347 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18349 unsigned int present1, present2;
18351 present1 = snd_hda_jack_detect(codec, 0x21);
18352 present2 = snd_hda_jack_detect(codec, 0x15);
18354 if (present1 || present2) {
18355 snd_hda_codec_write_cache(codec, 0x14, 0,
18356 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18358 snd_hda_codec_write_cache(codec, 0x14, 0,
18359 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18363 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18365 unsigned int present1, present2;
18367 present1 = snd_hda_jack_detect(codec, 0x1b);
18368 present2 = snd_hda_jack_detect(codec, 0x15);
18370 if (present1 || present2) {
18371 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18372 HDA_AMP_MUTE, HDA_AMP_MUTE);
18373 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18374 HDA_AMP_MUTE, HDA_AMP_MUTE);
18376 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18378 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18383 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18385 unsigned int present1, present2;
18387 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18388 AC_VERB_GET_PIN_SENSE, 0)
18389 & AC_PINSENSE_PRESENCE;
18390 present2 = snd_hda_codec_read(codec, 0x21, 0,
18391 AC_VERB_GET_PIN_SENSE, 0)
18392 & AC_PINSENSE_PRESENCE;
18394 if (present1 || present2) {
18395 snd_hda_codec_write_cache(codec, 0x14, 0,
18396 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18397 snd_hda_codec_write_cache(codec, 0x17, 0,
18398 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18400 snd_hda_codec_write_cache(codec, 0x14, 0,
18401 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18402 snd_hda_codec_write_cache(codec, 0x17, 0,
18403 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18407 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18409 unsigned int present1, present2;
18411 present1 = snd_hda_codec_read(codec, 0x21, 0,
18412 AC_VERB_GET_PIN_SENSE, 0)
18413 & AC_PINSENSE_PRESENCE;
18414 present2 = snd_hda_codec_read(codec, 0x15, 0,
18415 AC_VERB_GET_PIN_SENSE, 0)
18416 & AC_PINSENSE_PRESENCE;
18418 if (present1 || present2) {
18419 snd_hda_codec_write_cache(codec, 0x14, 0,
18420 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18421 snd_hda_codec_write_cache(codec, 0x17, 0,
18422 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18424 snd_hda_codec_write_cache(codec, 0x14, 0,
18425 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18426 snd_hda_codec_write_cache(codec, 0x17, 0,
18427 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18431 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18434 switch (res >> 26) {
18435 case ALC880_HP_EVENT:
18436 alc663_m51va_speaker_automute(codec);
18438 case ALC880_MIC_EVENT:
18439 alc_mic_automute(codec);
18444 static void alc663_m51va_setup(struct hda_codec *codec)
18446 struct alc_spec *spec = codec->spec;
18447 spec->ext_mic.pin = 0x18;
18448 spec->ext_mic.mux_idx = 0;
18449 spec->int_mic.pin = 0x12;
18450 spec->int_mic.mux_idx = 9;
18451 spec->auto_mic = 1;
18454 static void alc663_m51va_inithook(struct hda_codec *codec)
18456 alc663_m51va_speaker_automute(codec);
18457 alc_mic_automute(codec);
18460 /* ***************** Mode1 ******************************/
18461 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18463 static void alc663_mode1_setup(struct hda_codec *codec)
18465 struct alc_spec *spec = codec->spec;
18466 spec->ext_mic.pin = 0x18;
18467 spec->ext_mic.mux_idx = 0;
18468 spec->int_mic.pin = 0x19;
18469 spec->int_mic.mux_idx = 1;
18470 spec->auto_mic = 1;
18473 #define alc663_mode1_inithook alc663_m51va_inithook
18475 /* ***************** Mode2 ******************************/
18476 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18479 switch (res >> 26) {
18480 case ALC880_HP_EVENT:
18481 alc662_f5z_speaker_automute(codec);
18483 case ALC880_MIC_EVENT:
18484 alc_mic_automute(codec);
18489 #define alc662_mode2_setup alc663_mode1_setup
18491 static void alc662_mode2_inithook(struct hda_codec *codec)
18493 alc662_f5z_speaker_automute(codec);
18494 alc_mic_automute(codec);
18496 /* ***************** Mode3 ******************************/
18497 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18500 switch (res >> 26) {
18501 case ALC880_HP_EVENT:
18502 alc663_two_hp_m1_speaker_automute(codec);
18504 case ALC880_MIC_EVENT:
18505 alc_mic_automute(codec);
18510 #define alc663_mode3_setup alc663_mode1_setup
18512 static void alc663_mode3_inithook(struct hda_codec *codec)
18514 alc663_two_hp_m1_speaker_automute(codec);
18515 alc_mic_automute(codec);
18517 /* ***************** Mode4 ******************************/
18518 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18521 switch (res >> 26) {
18522 case ALC880_HP_EVENT:
18523 alc663_21jd_two_speaker_automute(codec);
18525 case ALC880_MIC_EVENT:
18526 alc_mic_automute(codec);
18531 #define alc663_mode4_setup alc663_mode1_setup
18533 static void alc663_mode4_inithook(struct hda_codec *codec)
18535 alc663_21jd_two_speaker_automute(codec);
18536 alc_mic_automute(codec);
18538 /* ***************** Mode5 ******************************/
18539 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18542 switch (res >> 26) {
18543 case ALC880_HP_EVENT:
18544 alc663_15jd_two_speaker_automute(codec);
18546 case ALC880_MIC_EVENT:
18547 alc_mic_automute(codec);
18552 #define alc663_mode5_setup alc663_mode1_setup
18554 static void alc663_mode5_inithook(struct hda_codec *codec)
18556 alc663_15jd_two_speaker_automute(codec);
18557 alc_mic_automute(codec);
18559 /* ***************** Mode6 ******************************/
18560 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18563 switch (res >> 26) {
18564 case ALC880_HP_EVENT:
18565 alc663_two_hp_m2_speaker_automute(codec);
18567 case ALC880_MIC_EVENT:
18568 alc_mic_automute(codec);
18573 #define alc663_mode6_setup alc663_mode1_setup
18575 static void alc663_mode6_inithook(struct hda_codec *codec)
18577 alc663_two_hp_m2_speaker_automute(codec);
18578 alc_mic_automute(codec);
18581 /* ***************** Mode7 ******************************/
18582 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18585 switch (res >> 26) {
18586 case ALC880_HP_EVENT:
18587 alc663_two_hp_m7_speaker_automute(codec);
18589 case ALC880_MIC_EVENT:
18590 alc_mic_automute(codec);
18595 #define alc663_mode7_setup alc663_mode1_setup
18597 static void alc663_mode7_inithook(struct hda_codec *codec)
18599 alc663_two_hp_m7_speaker_automute(codec);
18600 alc_mic_automute(codec);
18603 /* ***************** Mode8 ******************************/
18604 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18607 switch (res >> 26) {
18608 case ALC880_HP_EVENT:
18609 alc663_two_hp_m8_speaker_automute(codec);
18611 case ALC880_MIC_EVENT:
18612 alc_mic_automute(codec);
18617 #define alc663_mode8_setup alc663_m51va_setup
18619 static void alc663_mode8_inithook(struct hda_codec *codec)
18621 alc663_two_hp_m8_speaker_automute(codec);
18622 alc_mic_automute(codec);
18625 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18627 unsigned int present;
18628 unsigned char bits;
18630 present = snd_hda_jack_detect(codec, 0x21);
18631 bits = present ? HDA_AMP_MUTE : 0;
18632 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18633 HDA_AMP_MUTE, bits);
18634 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18635 HDA_AMP_MUTE, bits);
18638 static void alc663_g71v_front_automute(struct hda_codec *codec)
18640 unsigned int present;
18641 unsigned char bits;
18643 present = snd_hda_jack_detect(codec, 0x15);
18644 bits = present ? HDA_AMP_MUTE : 0;
18645 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18646 HDA_AMP_MUTE, bits);
18649 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18652 switch (res >> 26) {
18653 case ALC880_HP_EVENT:
18654 alc663_g71v_hp_automute(codec);
18656 case ALC880_FRONT_EVENT:
18657 alc663_g71v_front_automute(codec);
18659 case ALC880_MIC_EVENT:
18660 alc_mic_automute(codec);
18665 #define alc663_g71v_setup alc663_m51va_setup
18667 static void alc663_g71v_inithook(struct hda_codec *codec)
18669 alc663_g71v_front_automute(codec);
18670 alc663_g71v_hp_automute(codec);
18671 alc_mic_automute(codec);
18674 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18677 switch (res >> 26) {
18678 case ALC880_HP_EVENT:
18679 alc663_m51va_speaker_automute(codec);
18681 case ALC880_MIC_EVENT:
18682 alc_mic_automute(codec);
18687 #define alc663_g50v_setup alc663_m51va_setup
18689 static void alc663_g50v_inithook(struct hda_codec *codec)
18691 alc663_m51va_speaker_automute(codec);
18692 alc_mic_automute(codec);
18695 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18696 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18697 ALC262_HIPPO_MASTER_SWITCH,
18699 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18700 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18701 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18703 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18704 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18705 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18709 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18710 /* Master Playback automatically created from Speaker and Headphone */
18711 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18712 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18713 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18714 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18718 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18720 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18721 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18722 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18726 #ifdef CONFIG_SND_HDA_POWER_SAVE
18727 #define alc662_loopbacks alc880_loopbacks
18731 /* pcm configuration: identical with ALC880 */
18732 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18733 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18734 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18735 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18738 * configuration and preset
18740 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18741 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18742 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18743 [ALC662_3ST_6ch] = "3stack-6ch",
18744 [ALC662_5ST_DIG] = "6stack-dig",
18745 [ALC662_LENOVO_101E] = "lenovo-101e",
18746 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18747 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18748 [ALC662_ECS] = "ecs",
18749 [ALC663_ASUS_M51VA] = "m51va",
18750 [ALC663_ASUS_G71V] = "g71v",
18751 [ALC663_ASUS_H13] = "h13",
18752 [ALC663_ASUS_G50V] = "g50v",
18753 [ALC663_ASUS_MODE1] = "asus-mode1",
18754 [ALC662_ASUS_MODE2] = "asus-mode2",
18755 [ALC663_ASUS_MODE3] = "asus-mode3",
18756 [ALC663_ASUS_MODE4] = "asus-mode4",
18757 [ALC663_ASUS_MODE5] = "asus-mode5",
18758 [ALC663_ASUS_MODE6] = "asus-mode6",
18759 [ALC663_ASUS_MODE7] = "asus-mode7",
18760 [ALC663_ASUS_MODE8] = "asus-mode8",
18761 [ALC272_DELL] = "dell",
18762 [ALC272_DELL_ZM1] = "dell-zm1",
18763 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18764 [ALC662_AUTO] = "auto",
18767 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18768 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18769 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18770 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18771 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18772 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18773 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18774 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18775 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18776 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18777 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18778 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18779 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18780 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18781 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18782 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18783 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18784 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18785 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18786 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18787 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18788 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18789 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18790 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18791 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18792 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18793 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18794 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18795 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18796 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18797 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18798 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18799 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18800 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18801 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18802 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18803 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18804 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18805 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18806 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18807 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18808 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18809 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18810 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18811 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18812 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18813 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18814 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18815 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18816 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18817 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18818 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18819 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18820 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18821 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18822 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18823 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18824 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18825 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18826 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18827 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18828 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18829 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18830 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18831 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18832 ALC662_3ST_6ch_DIG),
18833 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18834 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18835 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18836 ALC662_3ST_6ch_DIG),
18837 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18838 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18839 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18840 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18841 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18842 ALC662_3ST_6ch_DIG),
18843 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18845 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18849 static struct alc_config_preset alc662_presets[] = {
18850 [ALC662_3ST_2ch_DIG] = {
18851 .mixers = { alc662_3ST_2ch_mixer },
18852 .init_verbs = { alc662_init_verbs },
18853 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18854 .dac_nids = alc662_dac_nids,
18855 .dig_out_nid = ALC662_DIGOUT_NID,
18856 .dig_in_nid = ALC662_DIGIN_NID,
18857 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18858 .channel_mode = alc662_3ST_2ch_modes,
18859 .input_mux = &alc662_capture_source,
18861 [ALC662_3ST_6ch_DIG] = {
18862 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18863 .init_verbs = { alc662_init_verbs },
18864 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18865 .dac_nids = alc662_dac_nids,
18866 .dig_out_nid = ALC662_DIGOUT_NID,
18867 .dig_in_nid = ALC662_DIGIN_NID,
18868 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18869 .channel_mode = alc662_3ST_6ch_modes,
18871 .input_mux = &alc662_capture_source,
18873 [ALC662_3ST_6ch] = {
18874 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18875 .init_verbs = { alc662_init_verbs },
18876 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18877 .dac_nids = alc662_dac_nids,
18878 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18879 .channel_mode = alc662_3ST_6ch_modes,
18881 .input_mux = &alc662_capture_source,
18883 [ALC662_5ST_DIG] = {
18884 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18885 .init_verbs = { alc662_init_verbs },
18886 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18887 .dac_nids = alc662_dac_nids,
18888 .dig_out_nid = ALC662_DIGOUT_NID,
18889 .dig_in_nid = ALC662_DIGIN_NID,
18890 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18891 .channel_mode = alc662_5stack_modes,
18892 .input_mux = &alc662_capture_source,
18894 [ALC662_LENOVO_101E] = {
18895 .mixers = { alc662_lenovo_101e_mixer },
18896 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18897 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18898 .dac_nids = alc662_dac_nids,
18899 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18900 .channel_mode = alc662_3ST_2ch_modes,
18901 .input_mux = &alc662_lenovo_101e_capture_source,
18902 .unsol_event = alc662_lenovo_101e_unsol_event,
18903 .init_hook = alc662_lenovo_101e_all_automute,
18905 [ALC662_ASUS_EEEPC_P701] = {
18906 .mixers = { alc662_eeepc_p701_mixer },
18907 .init_verbs = { alc662_init_verbs,
18908 alc662_eeepc_sue_init_verbs },
18909 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18910 .dac_nids = alc662_dac_nids,
18911 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18912 .channel_mode = alc662_3ST_2ch_modes,
18913 .unsol_event = alc662_eeepc_unsol_event,
18914 .setup = alc662_eeepc_setup,
18915 .init_hook = alc662_eeepc_inithook,
18917 [ALC662_ASUS_EEEPC_EP20] = {
18918 .mixers = { alc662_eeepc_ep20_mixer,
18919 alc662_chmode_mixer },
18920 .init_verbs = { alc662_init_verbs,
18921 alc662_eeepc_ep20_sue_init_verbs },
18922 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18923 .dac_nids = alc662_dac_nids,
18924 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18925 .channel_mode = alc662_3ST_6ch_modes,
18926 .input_mux = &alc662_lenovo_101e_capture_source,
18927 .unsol_event = alc662_eeepc_unsol_event,
18928 .setup = alc662_eeepc_ep20_setup,
18929 .init_hook = alc662_eeepc_ep20_inithook,
18932 .mixers = { alc662_ecs_mixer },
18933 .init_verbs = { alc662_init_verbs,
18934 alc662_ecs_init_verbs },
18935 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18936 .dac_nids = alc662_dac_nids,
18937 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18938 .channel_mode = alc662_3ST_2ch_modes,
18939 .unsol_event = alc662_eeepc_unsol_event,
18940 .setup = alc662_eeepc_setup,
18941 .init_hook = alc662_eeepc_inithook,
18943 [ALC663_ASUS_M51VA] = {
18944 .mixers = { alc663_m51va_mixer },
18945 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18946 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18947 .dac_nids = alc662_dac_nids,
18948 .dig_out_nid = ALC662_DIGOUT_NID,
18949 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18950 .channel_mode = alc662_3ST_2ch_modes,
18951 .unsol_event = alc663_m51va_unsol_event,
18952 .setup = alc663_m51va_setup,
18953 .init_hook = alc663_m51va_inithook,
18955 [ALC663_ASUS_G71V] = {
18956 .mixers = { alc663_g71v_mixer },
18957 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18958 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18959 .dac_nids = alc662_dac_nids,
18960 .dig_out_nid = ALC662_DIGOUT_NID,
18961 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18962 .channel_mode = alc662_3ST_2ch_modes,
18963 .unsol_event = alc663_g71v_unsol_event,
18964 .setup = alc663_g71v_setup,
18965 .init_hook = alc663_g71v_inithook,
18967 [ALC663_ASUS_H13] = {
18968 .mixers = { alc663_m51va_mixer },
18969 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18970 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18971 .dac_nids = alc662_dac_nids,
18972 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18973 .channel_mode = alc662_3ST_2ch_modes,
18974 .unsol_event = alc663_m51va_unsol_event,
18975 .init_hook = alc663_m51va_inithook,
18977 [ALC663_ASUS_G50V] = {
18978 .mixers = { alc663_g50v_mixer },
18979 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18980 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18981 .dac_nids = alc662_dac_nids,
18982 .dig_out_nid = ALC662_DIGOUT_NID,
18983 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18984 .channel_mode = alc662_3ST_6ch_modes,
18985 .input_mux = &alc663_capture_source,
18986 .unsol_event = alc663_g50v_unsol_event,
18987 .setup = alc663_g50v_setup,
18988 .init_hook = alc663_g50v_inithook,
18990 [ALC663_ASUS_MODE1] = {
18991 .mixers = { alc663_m51va_mixer },
18992 .cap_mixer = alc662_auto_capture_mixer,
18993 .init_verbs = { alc662_init_verbs,
18994 alc663_21jd_amic_init_verbs },
18995 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18997 .dac_nids = alc662_dac_nids,
18998 .dig_out_nid = ALC662_DIGOUT_NID,
18999 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19000 .channel_mode = alc662_3ST_2ch_modes,
19001 .unsol_event = alc663_mode1_unsol_event,
19002 .setup = alc663_mode1_setup,
19003 .init_hook = alc663_mode1_inithook,
19005 [ALC662_ASUS_MODE2] = {
19006 .mixers = { alc662_1bjd_mixer },
19007 .cap_mixer = alc662_auto_capture_mixer,
19008 .init_verbs = { alc662_init_verbs,
19009 alc662_1bjd_amic_init_verbs },
19010 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19011 .dac_nids = alc662_dac_nids,
19012 .dig_out_nid = ALC662_DIGOUT_NID,
19013 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19014 .channel_mode = alc662_3ST_2ch_modes,
19015 .unsol_event = alc662_mode2_unsol_event,
19016 .setup = alc662_mode2_setup,
19017 .init_hook = alc662_mode2_inithook,
19019 [ALC663_ASUS_MODE3] = {
19020 .mixers = { alc663_two_hp_m1_mixer },
19021 .cap_mixer = alc662_auto_capture_mixer,
19022 .init_verbs = { alc662_init_verbs,
19023 alc663_two_hp_amic_m1_init_verbs },
19024 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19026 .dac_nids = alc662_dac_nids,
19027 .dig_out_nid = ALC662_DIGOUT_NID,
19028 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19029 .channel_mode = alc662_3ST_2ch_modes,
19030 .unsol_event = alc663_mode3_unsol_event,
19031 .setup = alc663_mode3_setup,
19032 .init_hook = alc663_mode3_inithook,
19034 [ALC663_ASUS_MODE4] = {
19035 .mixers = { alc663_asus_21jd_clfe_mixer },
19036 .cap_mixer = alc662_auto_capture_mixer,
19037 .init_verbs = { alc662_init_verbs,
19038 alc663_21jd_amic_init_verbs},
19039 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19041 .dac_nids = alc662_dac_nids,
19042 .dig_out_nid = ALC662_DIGOUT_NID,
19043 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19044 .channel_mode = alc662_3ST_2ch_modes,
19045 .unsol_event = alc663_mode4_unsol_event,
19046 .setup = alc663_mode4_setup,
19047 .init_hook = alc663_mode4_inithook,
19049 [ALC663_ASUS_MODE5] = {
19050 .mixers = { alc663_asus_15jd_clfe_mixer },
19051 .cap_mixer = alc662_auto_capture_mixer,
19052 .init_verbs = { alc662_init_verbs,
19053 alc663_15jd_amic_init_verbs },
19054 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19056 .dac_nids = alc662_dac_nids,
19057 .dig_out_nid = ALC662_DIGOUT_NID,
19058 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19059 .channel_mode = alc662_3ST_2ch_modes,
19060 .unsol_event = alc663_mode5_unsol_event,
19061 .setup = alc663_mode5_setup,
19062 .init_hook = alc663_mode5_inithook,
19064 [ALC663_ASUS_MODE6] = {
19065 .mixers = { alc663_two_hp_m2_mixer },
19066 .cap_mixer = alc662_auto_capture_mixer,
19067 .init_verbs = { alc662_init_verbs,
19068 alc663_two_hp_amic_m2_init_verbs },
19069 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19071 .dac_nids = alc662_dac_nids,
19072 .dig_out_nid = ALC662_DIGOUT_NID,
19073 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19074 .channel_mode = alc662_3ST_2ch_modes,
19075 .unsol_event = alc663_mode6_unsol_event,
19076 .setup = alc663_mode6_setup,
19077 .init_hook = alc663_mode6_inithook,
19079 [ALC663_ASUS_MODE7] = {
19080 .mixers = { alc663_mode7_mixer },
19081 .cap_mixer = alc662_auto_capture_mixer,
19082 .init_verbs = { alc662_init_verbs,
19083 alc663_mode7_init_verbs },
19084 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19086 .dac_nids = alc662_dac_nids,
19087 .dig_out_nid = ALC662_DIGOUT_NID,
19088 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19089 .channel_mode = alc662_3ST_2ch_modes,
19090 .unsol_event = alc663_mode7_unsol_event,
19091 .setup = alc663_mode7_setup,
19092 .init_hook = alc663_mode7_inithook,
19094 [ALC663_ASUS_MODE8] = {
19095 .mixers = { alc663_mode8_mixer },
19096 .cap_mixer = alc662_auto_capture_mixer,
19097 .init_verbs = { alc662_init_verbs,
19098 alc663_mode8_init_verbs },
19099 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19101 .dac_nids = alc662_dac_nids,
19102 .dig_out_nid = ALC662_DIGOUT_NID,
19103 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19104 .channel_mode = alc662_3ST_2ch_modes,
19105 .unsol_event = alc663_mode8_unsol_event,
19106 .setup = alc663_mode8_setup,
19107 .init_hook = alc663_mode8_inithook,
19110 .mixers = { alc663_m51va_mixer },
19111 .cap_mixer = alc272_auto_capture_mixer,
19112 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19113 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19114 .dac_nids = alc662_dac_nids,
19115 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19116 .adc_nids = alc272_adc_nids,
19117 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19118 .capsrc_nids = alc272_capsrc_nids,
19119 .channel_mode = alc662_3ST_2ch_modes,
19120 .unsol_event = alc663_m51va_unsol_event,
19121 .setup = alc663_m51va_setup,
19122 .init_hook = alc663_m51va_inithook,
19124 [ALC272_DELL_ZM1] = {
19125 .mixers = { alc663_m51va_mixer },
19126 .cap_mixer = alc662_auto_capture_mixer,
19127 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19128 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19129 .dac_nids = alc662_dac_nids,
19130 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19131 .adc_nids = alc662_adc_nids,
19133 .capsrc_nids = alc662_capsrc_nids,
19134 .channel_mode = alc662_3ST_2ch_modes,
19135 .unsol_event = alc663_m51va_unsol_event,
19136 .setup = alc663_m51va_setup,
19137 .init_hook = alc663_m51va_inithook,
19139 [ALC272_SAMSUNG_NC10] = {
19140 .mixers = { alc272_nc10_mixer },
19141 .init_verbs = { alc662_init_verbs,
19142 alc663_21jd_amic_init_verbs },
19143 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19144 .dac_nids = alc272_dac_nids,
19145 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19146 .channel_mode = alc662_3ST_2ch_modes,
19147 /*.input_mux = &alc272_nc10_capture_source,*/
19148 .unsol_event = alc663_mode4_unsol_event,
19149 .setup = alc663_mode4_setup,
19150 .init_hook = alc663_mode4_inithook,
19156 * BIOS auto configuration
19159 /* convert from MIX nid to DAC */
19160 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19164 else if (nid >= 0x0c && nid <= 0x0e)
19165 return nid - 0x0c + 0x02;
19166 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19172 /* get MIX nid connected to the given pin targeted to DAC */
19173 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19179 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19180 for (i = 0; i < num; i++) {
19181 if (alc662_mix_to_dac(mix[i]) == dac)
19187 /* look for an empty DAC slot */
19188 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19190 struct alc_spec *spec = codec->spec;
19194 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19197 for (i = 0; i < num; i++) {
19198 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19201 for (j = 0; j < spec->multiout.num_dacs; j++)
19202 if (spec->multiout.dac_nids[j] == nid)
19204 if (j >= spec->multiout.num_dacs)
19210 /* fill in the dac_nids table from the parsed pin configuration */
19211 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19212 const struct auto_pin_cfg *cfg)
19214 struct alc_spec *spec = codec->spec;
19218 spec->multiout.dac_nids = spec->private_dac_nids;
19219 for (i = 0; i < cfg->line_outs; i++) {
19220 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19223 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19228 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19229 hda_nid_t nid, int idx, unsigned int chs)
19231 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
19232 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19235 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19236 hda_nid_t nid, int idx, unsigned int chs)
19238 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19239 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19242 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19243 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19244 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19245 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19246 #define alc662_add_stereo_vol(spec, pfx, nid) \
19247 alc662_add_vol_ctl(spec, pfx, nid, 3)
19248 #define alc662_add_stereo_sw(spec, pfx, nid) \
19249 alc662_add_sw_ctl(spec, pfx, nid, 3)
19251 /* add playback controls from the parsed DAC table */
19252 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19253 const struct auto_pin_cfg *cfg)
19255 struct alc_spec *spec = codec->spec;
19256 static const char * const chname[4] = {
19257 "Front", "Surround", NULL /*CLFE*/, "Side"
19259 const char *pfx = alc_get_line_out_pfx(cfg, true);
19260 hda_nid_t nid, mix;
19263 for (i = 0; i < cfg->line_outs; i++) {
19264 nid = spec->multiout.dac_nids[i];
19267 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19270 if (!pfx && i == 2) {
19272 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19275 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19278 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19281 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19285 const char *name = pfx;
19288 err = __alc662_add_vol_ctl(spec, name, nid, i, 3);
19291 err = __alc662_add_sw_ctl(spec, name, mix, i, 3);
19299 /* add playback controls for speaker and HP outputs */
19300 /* return DAC nid if any new DAC is assigned */
19301 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19304 struct alc_spec *spec = codec->spec;
19305 hda_nid_t nid, mix;
19310 nid = alc662_look_for_dac(codec, pin);
19312 /* the corresponding DAC is already occupied */
19313 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19314 return 0; /* no way */
19315 /* create a switch only */
19316 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19317 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19320 mix = alc662_dac_to_mix(codec, pin, nid);
19323 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19326 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19332 /* create playback/capture controls for input pins */
19333 #define alc662_auto_create_input_ctls \
19334 alc882_auto_create_input_ctls
19336 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19337 hda_nid_t nid, int pin_type,
19341 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19343 alc_set_pin_output(codec, nid, pin_type);
19344 /* need the manual connection? */
19345 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19348 for (i = 0; i < num; i++) {
19349 if (alc662_mix_to_dac(srcs[i]) != dac)
19351 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19356 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19358 struct alc_spec *spec = codec->spec;
19359 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19362 for (i = 0; i <= HDA_SIDE; i++) {
19363 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19365 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19366 spec->multiout.dac_nids[i]);
19370 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19372 struct alc_spec *spec = codec->spec;
19375 pin = spec->autocfg.hp_pins[0];
19377 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19378 spec->multiout.hp_nid);
19379 pin = spec->autocfg.speaker_pins[0];
19381 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19382 spec->multiout.extra_out_nid[0]);
19385 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19387 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19389 struct alc_spec *spec = codec->spec;
19390 struct auto_pin_cfg *cfg = &spec->autocfg;
19393 for (i = 0; i < cfg->num_inputs; i++) {
19394 hda_nid_t nid = cfg->inputs[i].pin;
19395 if (alc_is_input_pin(codec, nid)) {
19396 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19397 if (nid != ALC662_PIN_CD_NID &&
19398 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19399 snd_hda_codec_write(codec, nid, 0,
19400 AC_VERB_SET_AMP_GAIN_MUTE,
19406 #define alc662_auto_init_input_src alc882_auto_init_input_src
19408 static int alc662_parse_auto_config(struct hda_codec *codec)
19410 struct alc_spec *spec = codec->spec;
19412 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19414 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19418 if (!spec->autocfg.line_outs)
19419 return 0; /* can't find valid BIOS pin config */
19421 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19424 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19427 err = alc662_auto_create_extra_out(codec,
19428 spec->autocfg.speaker_pins[0],
19433 spec->multiout.extra_out_nid[0] = err;
19434 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19439 spec->multiout.hp_nid = err;
19440 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19444 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19446 alc_auto_parse_digital(codec);
19448 if (spec->kctls.list)
19449 add_mixer(spec, spec->kctls.list);
19451 spec->num_mux_defs = 1;
19452 spec->input_mux = &spec->private_imux[0];
19454 add_verb(spec, alc662_init_verbs);
19455 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19456 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19457 add_verb(spec, alc663_init_verbs);
19459 if (codec->vendor_id == 0x10ec0272)
19460 add_verb(spec, alc272_init_verbs);
19462 err = alc_auto_add_mic_boost(codec);
19466 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19467 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19468 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19470 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19475 /* additional initialization for auto-configuration model */
19476 static void alc662_auto_init(struct hda_codec *codec)
19478 struct alc_spec *spec = codec->spec;
19479 alc662_auto_init_multi_out(codec);
19480 alc662_auto_init_hp_out(codec);
19481 alc662_auto_init_analog_input(codec);
19482 alc662_auto_init_input_src(codec);
19483 alc_auto_init_digital(codec);
19484 if (spec->unsol_event)
19485 alc_inithook(codec);
19488 static void alc272_fixup_mario(struct hda_codec *codec,
19489 const struct alc_fixup *fix, int action)
19491 if (action != ALC_FIXUP_ACT_PROBE)
19493 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19494 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19495 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19496 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19497 (0 << AC_AMPCAP_MUTE_SHIFT)))
19498 printk(KERN_WARNING
19499 "hda_codec: failed to override amp caps for NID 0x2\n");
19503 ALC662_FIXUP_ASPIRE,
19504 ALC662_FIXUP_IDEAPAD,
19505 ALC272_FIXUP_MARIO,
19506 ALC662_FIXUP_CZC_P10T,
19509 static const struct alc_fixup alc662_fixups[] = {
19510 [ALC662_FIXUP_ASPIRE] = {
19511 .type = ALC_FIXUP_PINS,
19512 .v.pins = (const struct alc_pincfg[]) {
19513 { 0x15, 0x99130112 }, /* subwoofer */
19517 [ALC662_FIXUP_IDEAPAD] = {
19518 .type = ALC_FIXUP_PINS,
19519 .v.pins = (const struct alc_pincfg[]) {
19520 { 0x17, 0x99130112 }, /* subwoofer */
19524 [ALC272_FIXUP_MARIO] = {
19525 .type = ALC_FIXUP_FUNC,
19526 .v.func = alc272_fixup_mario,
19528 [ALC662_FIXUP_CZC_P10T] = {
19529 .type = ALC_FIXUP_VERBS,
19530 .v.verbs = (const struct hda_verb[]) {
19531 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19537 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19538 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19539 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19540 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19541 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19542 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19543 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19547 static const struct alc_model_fixup alc662_fixup_models[] = {
19548 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19553 static int patch_alc662(struct hda_codec *codec)
19555 struct alc_spec *spec;
19556 int err, board_config;
19559 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19563 codec->spec = spec;
19565 alc_auto_parse_customize_define(codec);
19567 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19569 coef = alc_read_coef_idx(codec, 0);
19570 if (coef == 0x8020 || coef == 0x8011)
19571 alc_codec_rename(codec, "ALC661");
19572 else if (coef & (1 << 14) &&
19573 codec->bus->pci->subsystem_vendor == 0x1025 &&
19574 spec->cdefine.platform_type == 1)
19575 alc_codec_rename(codec, "ALC272X");
19576 else if (coef == 0x4011)
19577 alc_codec_rename(codec, "ALC656");
19579 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19582 if (board_config < 0) {
19583 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19585 board_config = ALC662_AUTO;
19588 if (board_config == ALC662_AUTO) {
19589 alc_pick_fixup(codec, alc662_fixup_models,
19590 alc662_fixup_tbl, alc662_fixups);
19591 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19592 /* automatic parse from the BIOS config */
19593 err = alc662_parse_auto_config(codec);
19599 "hda_codec: Cannot set up configuration "
19600 "from BIOS. Using base mode...\n");
19601 board_config = ALC662_3ST_2ch_DIG;
19605 if (has_cdefine_beep(codec)) {
19606 err = snd_hda_attach_beep_device(codec, 0x1);
19613 if (board_config != ALC662_AUTO)
19614 setup_preset(codec, &alc662_presets[board_config]);
19616 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19617 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19619 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19620 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19622 if (!spec->adc_nids) {
19623 spec->adc_nids = alc662_adc_nids;
19624 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19626 if (!spec->capsrc_nids)
19627 spec->capsrc_nids = alc662_capsrc_nids;
19629 if (!spec->cap_mixer)
19630 set_capture_mixer(codec);
19632 if (has_cdefine_beep(codec)) {
19633 switch (codec->vendor_id) {
19635 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19640 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19643 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19647 spec->vmaster_nid = 0x02;
19649 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19651 codec->patch_ops = alc_patch_ops;
19652 if (board_config == ALC662_AUTO)
19653 spec->init_hook = alc662_auto_init;
19655 alc_init_jacks(codec);
19657 #ifdef CONFIG_SND_HDA_POWER_SAVE
19658 if (!spec->loopback.amplist)
19659 spec->loopback.amplist = alc662_loopbacks;
19665 static int patch_alc888(struct hda_codec *codec)
19667 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19668 kfree(codec->chip_name);
19669 if (codec->vendor_id == 0x10ec0887)
19670 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19672 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19673 if (!codec->chip_name) {
19677 return patch_alc662(codec);
19679 return patch_alc882(codec);
19685 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19686 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19687 #define alc680_modes alc260_modes
19689 static hda_nid_t alc680_dac_nids[3] = {
19690 /* Lout1, Lout2, hp */
19694 static hda_nid_t alc680_adc_nids[3] = {
19696 /* DMIC, MIC, Line-in*/
19701 * Analog capture ADC cgange
19703 static void alc680_rec_autoswitch(struct hda_codec *codec)
19705 struct alc_spec *spec = codec->spec;
19706 struct auto_pin_cfg *cfg = &spec->autocfg;
19708 int type_found = AUTO_PIN_LAST;
19712 for (i = 0; i < cfg->num_inputs; i++) {
19713 nid = cfg->inputs[i].pin;
19714 if (!(snd_hda_query_pin_caps(codec, nid) &
19715 AC_PINCAP_PRES_DETECT))
19717 if (snd_hda_jack_detect(codec, nid)) {
19718 if (cfg->inputs[i].type < type_found) {
19719 type_found = cfg->inputs[i].type;
19727 snd_hda_get_connections(codec, pin_found, &nid, 1);
19729 if (nid != spec->cur_adc)
19730 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19731 spec->cur_adc = nid;
19732 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19733 spec->cur_adc_format);
19736 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19737 struct hda_codec *codec,
19738 unsigned int stream_tag,
19739 unsigned int format,
19740 struct snd_pcm_substream *substream)
19742 struct alc_spec *spec = codec->spec;
19744 spec->cur_adc = 0x07;
19745 spec->cur_adc_stream_tag = stream_tag;
19746 spec->cur_adc_format = format;
19748 alc680_rec_autoswitch(codec);
19752 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19753 struct hda_codec *codec,
19754 struct snd_pcm_substream *substream)
19756 snd_hda_codec_cleanup_stream(codec, 0x07);
19757 snd_hda_codec_cleanup_stream(codec, 0x08);
19758 snd_hda_codec_cleanup_stream(codec, 0x09);
19762 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19763 .substreams = 1, /* can be overridden */
19766 /* NID is set in alc_build_pcms */
19768 .prepare = alc680_capture_pcm_prepare,
19769 .cleanup = alc680_capture_pcm_cleanup
19773 static struct snd_kcontrol_new alc680_base_mixer[] = {
19774 /* output mixer control */
19775 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19776 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19777 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19779 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19780 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19781 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19785 static struct hda_bind_ctls alc680_bind_cap_vol = {
19786 .ops = &snd_hda_bind_vol,
19788 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19789 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19790 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19795 static struct hda_bind_ctls alc680_bind_cap_switch = {
19796 .ops = &snd_hda_bind_sw,
19798 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19799 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19800 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19805 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19806 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19807 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19812 * generic initialization of ADC, input mixers and output mixers
19814 static struct hda_verb alc680_init_verbs[] = {
19815 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19816 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19817 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19819 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19820 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19821 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19822 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19823 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19826 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19829 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19830 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19832 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19833 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19834 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19839 /* toggle speaker-output according to the hp-jack state */
19840 static void alc680_base_setup(struct hda_codec *codec)
19842 struct alc_spec *spec = codec->spec;
19844 spec->autocfg.hp_pins[0] = 0x16;
19845 spec->autocfg.speaker_pins[0] = 0x14;
19846 spec->autocfg.speaker_pins[1] = 0x15;
19847 spec->autocfg.num_inputs = 2;
19848 spec->autocfg.inputs[0].pin = 0x18;
19849 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19850 spec->autocfg.inputs[1].pin = 0x19;
19851 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19854 static void alc680_unsol_event(struct hda_codec *codec,
19857 if ((res >> 26) == ALC880_HP_EVENT)
19858 alc_automute_amp(codec);
19859 if ((res >> 26) == ALC880_MIC_EVENT)
19860 alc680_rec_autoswitch(codec);
19863 static void alc680_inithook(struct hda_codec *codec)
19865 alc_automute_amp(codec);
19866 alc680_rec_autoswitch(codec);
19869 /* create input playback/capture controls for the given pin */
19870 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19871 const char *ctlname, int idx)
19889 if (spec->multiout.dac_nids[0] != dac &&
19890 spec->multiout.dac_nids[1] != dac) {
19891 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19892 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19897 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19898 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19902 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19908 /* add playback controls from the parsed DAC table */
19909 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19910 const struct auto_pin_cfg *cfg)
19915 spec->multiout.dac_nids = spec->private_dac_nids;
19917 nid = cfg->line_out_pins[0];
19920 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19924 err = alc680_new_analog_output(spec, nid, name, 0);
19929 nid = cfg->speaker_pins[0];
19931 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19935 nid = cfg->hp_pins[0];
19937 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19945 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19946 hda_nid_t nid, int pin_type)
19948 alc_set_pin_output(codec, nid, pin_type);
19951 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19953 struct alc_spec *spec = codec->spec;
19954 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19956 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19957 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19961 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19963 struct alc_spec *spec = codec->spec;
19966 pin = spec->autocfg.hp_pins[0];
19968 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19969 pin = spec->autocfg.speaker_pins[0];
19971 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19974 /* pcm configuration: identical with ALC880 */
19975 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19976 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19977 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19978 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19979 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19982 * BIOS auto configuration
19984 static int alc680_parse_auto_config(struct hda_codec *codec)
19986 struct alc_spec *spec = codec->spec;
19988 static hda_nid_t alc680_ignore[] = { 0 };
19990 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19995 if (!spec->autocfg.line_outs) {
19996 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19997 spec->multiout.max_channels = 2;
19998 spec->no_analog = 1;
20001 return 0; /* can't find valid BIOS pin config */
20003 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
20007 spec->multiout.max_channels = 2;
20010 /* digital only support output */
20011 alc_auto_parse_digital(codec);
20012 if (spec->kctls.list)
20013 add_mixer(spec, spec->kctls.list);
20015 add_verb(spec, alc680_init_verbs);
20017 err = alc_auto_add_mic_boost(codec);
20024 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
20026 /* init callback for auto-configuration model -- overriding the default init */
20027 static void alc680_auto_init(struct hda_codec *codec)
20029 struct alc_spec *spec = codec->spec;
20030 alc680_auto_init_multi_out(codec);
20031 alc680_auto_init_hp_out(codec);
20032 alc680_auto_init_analog_input(codec);
20033 alc_auto_init_digital(codec);
20034 if (spec->unsol_event)
20035 alc_inithook(codec);
20039 * configuration and preset
20041 static const char * const alc680_models[ALC680_MODEL_LAST] = {
20042 [ALC680_BASE] = "base",
20043 [ALC680_AUTO] = "auto",
20046 static struct snd_pci_quirk alc680_cfg_tbl[] = {
20047 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20051 static struct alc_config_preset alc680_presets[] = {
20053 .mixers = { alc680_base_mixer },
20054 .cap_mixer = alc680_master_capture_mixer,
20055 .init_verbs = { alc680_init_verbs },
20056 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20057 .dac_nids = alc680_dac_nids,
20058 .dig_out_nid = ALC680_DIGOUT_NID,
20059 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20060 .channel_mode = alc680_modes,
20061 .unsol_event = alc680_unsol_event,
20062 .setup = alc680_base_setup,
20063 .init_hook = alc680_inithook,
20068 static int patch_alc680(struct hda_codec *codec)
20070 struct alc_spec *spec;
20074 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20078 codec->spec = spec;
20080 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20084 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20085 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20087 board_config = ALC680_AUTO;
20090 if (board_config == ALC680_AUTO) {
20091 /* automatic parse from the BIOS config */
20092 err = alc680_parse_auto_config(codec);
20098 "hda_codec: Cannot set up configuration "
20099 "from BIOS. Using base mode...\n");
20100 board_config = ALC680_BASE;
20104 if (board_config != ALC680_AUTO)
20105 setup_preset(codec, &alc680_presets[board_config]);
20107 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20108 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20109 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20110 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20112 if (!spec->adc_nids) {
20113 spec->adc_nids = alc680_adc_nids;
20114 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20117 if (!spec->cap_mixer)
20118 set_capture_mixer(codec);
20120 spec->vmaster_nid = 0x02;
20122 codec->patch_ops = alc_patch_ops;
20123 if (board_config == ALC680_AUTO)
20124 spec->init_hook = alc680_auto_init;
20132 static struct hda_codec_preset snd_hda_preset_realtek[] = {
20133 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20134 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20135 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20136 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20137 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20138 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20139 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20140 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20141 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20142 .patch = patch_alc861 },
20143 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20144 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20145 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20146 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20147 .patch = patch_alc882 },
20148 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20149 .patch = patch_alc662 },
20150 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20151 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20152 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20153 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20154 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20155 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20156 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20157 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20158 .patch = patch_alc882 },
20159 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20160 .patch = patch_alc882 },
20161 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20162 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20163 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20164 .patch = patch_alc882 },
20165 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20166 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20167 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20168 {} /* terminator */
20171 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20173 MODULE_LICENSE("GPL");
20174 MODULE_DESCRIPTION("Realtek HD-audio codec");
20176 static struct hda_codec_preset_list realtek_list = {
20177 .preset = snd_hda_preset_realtek,
20178 .owner = THIS_MODULE,
20181 static int __init patch_realtek_init(void)
20183 return snd_hda_add_codec_preset(&realtek_list);
20186 static void __exit patch_realtek_exit(void)
20188 snd_hda_delete_codec_preset(&realtek_list);
20191 module_init(patch_realtek_init)
20192 module_exit(patch_realtek_exit)