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 "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
141 ALC269_MODEL_LAST /* last tag */
158 /* ALC861-VD models */
180 ALC662_ASUS_EEEPC_P701,
181 ALC662_ASUS_EEEPC_EP20,
223 ALC883_TARGA_2ch_DIG,
224 ALC883_TARGA_8ch_DIG,
227 ALC888_ACER_ASPIRE_4930G,
228 ALC888_ACER_ASPIRE_6530G,
229 ALC888_ACER_ASPIRE_8930G,
230 ALC888_ACER_ASPIRE_7730G,
233 ALC883_MEDION_WIM2160,
235 ALC883_LENOVO_101E_2ch,
236 ALC883_LENOVO_NB0763,
237 ALC888_LENOVO_MS7195_DIG,
245 ALC883_FUJITSU_PI2515,
246 ALC888_FUJITSU_XA3530,
247 ALC883_3ST_6ch_INTEL,
267 #define GPIO_MASK 0x03
269 /* extra amp-initialization sequence types */
278 struct alc_mic_route {
280 unsigned char mux_idx;
281 unsigned char amix_idx;
284 #define MUX_IDX_UNDEF ((unsigned char)-1)
286 struct alc_customize_define {
287 unsigned int sku_cfg;
288 unsigned char port_connectivity;
289 unsigned char check_sum;
290 unsigned char customization;
291 unsigned char external_amp;
292 unsigned int enable_pcbeep:1;
293 unsigned int platform_type:1;
295 unsigned int override:1;
299 /* codec parameterization */
300 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
301 unsigned int num_mixers;
302 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
303 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
305 const struct hda_verb *init_verbs[10]; /* initialization verbs
309 unsigned int num_init_verbs;
311 char stream_name_analog[32]; /* analog PCM stream */
312 struct hda_pcm_stream *stream_analog_playback;
313 struct hda_pcm_stream *stream_analog_capture;
314 struct hda_pcm_stream *stream_analog_alt_playback;
315 struct hda_pcm_stream *stream_analog_alt_capture;
317 char stream_name_digital[32]; /* digital PCM stream */
318 struct hda_pcm_stream *stream_digital_playback;
319 struct hda_pcm_stream *stream_digital_capture;
322 struct hda_multi_out multiout; /* playback set-up
323 * max_channels, dacs must be set
324 * dig_out_nid and hp_nid are optional
326 hda_nid_t alt_dac_nid;
327 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
331 unsigned int num_adc_nids;
333 hda_nid_t *capsrc_nids;
334 hda_nid_t dig_in_nid; /* digital-in NID; optional */
336 /* capture setup for dynamic dual-adc switch */
337 unsigned int cur_adc_idx;
339 unsigned int cur_adc_stream_tag;
340 unsigned int cur_adc_format;
343 unsigned int num_mux_defs;
344 const struct hda_input_mux *input_mux;
345 unsigned int cur_mux[3];
346 struct alc_mic_route ext_mic;
347 struct alc_mic_route int_mic;
350 const struct hda_channel_mode *channel_mode;
351 int num_channel_mode;
353 int const_channel_count;
354 int ext_channel_count;
356 /* PCM information */
357 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
359 /* dynamic controls, init_verbs and input_mux */
360 struct auto_pin_cfg autocfg;
361 struct alc_customize_define cdefine;
362 struct snd_array kctls;
363 struct hda_input_mux private_imux[3];
364 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
365 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
366 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
369 void (*init_hook)(struct hda_codec *codec);
370 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
371 #ifdef CONFIG_SND_HDA_POWER_SAVE
372 void (*power_hook)(struct hda_codec *codec);
375 /* for pin sensing */
376 unsigned int sense_updated: 1;
377 unsigned int jack_present: 1;
378 unsigned int master_sw: 1;
379 unsigned int auto_mic:1;
382 unsigned int no_analog :1; /* digital I/O only */
383 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
386 /* for virtual master */
387 hda_nid_t vmaster_nid;
388 #ifdef CONFIG_SND_HDA_POWER_SAVE
389 struct hda_loopback_check loopback;
394 unsigned int pll_coef_idx, pll_coef_bit;
398 * configuration template - to be copied to the spec instance
400 struct alc_config_preset {
401 struct snd_kcontrol_new *mixers[5]; /* should be identical size
404 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
405 const struct hda_verb *init_verbs[5];
406 unsigned int num_dacs;
408 hda_nid_t dig_out_nid; /* optional */
409 hda_nid_t hp_nid; /* optional */
410 hda_nid_t *slave_dig_outs;
411 unsigned int num_adc_nids;
413 hda_nid_t *capsrc_nids;
414 hda_nid_t dig_in_nid;
415 unsigned int num_channel_mode;
416 const struct hda_channel_mode *channel_mode;
418 int const_channel_count;
419 unsigned int num_mux_defs;
420 const struct hda_input_mux *input_mux;
421 void (*unsol_event)(struct hda_codec *, unsigned int);
422 void (*setup)(struct hda_codec *);
423 void (*init_hook)(struct hda_codec *);
424 #ifdef CONFIG_SND_HDA_POWER_SAVE
425 struct hda_amp_list *loopbacks;
426 void (*power_hook)(struct hda_codec *codec);
434 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_info *uinfo)
437 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
438 struct alc_spec *spec = codec->spec;
439 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
440 if (mux_idx >= spec->num_mux_defs)
442 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
444 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
447 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
448 struct snd_ctl_elem_value *ucontrol)
450 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
451 struct alc_spec *spec = codec->spec;
452 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
454 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
458 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 const struct hda_input_mux *imux;
464 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
465 unsigned int mux_idx;
466 hda_nid_t nid = spec->capsrc_nids ?
467 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
470 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
471 imux = &spec->input_mux[mux_idx];
472 if (!imux->num_items && mux_idx > 0)
473 imux = &spec->input_mux[0];
475 type = get_wcaps_type(get_wcaps(codec, nid));
476 if (type == AC_WID_AUD_MIX) {
477 /* Matrix-mixer style (e.g. ALC882) */
478 unsigned int *cur_val = &spec->cur_mux[adc_idx];
481 idx = ucontrol->value.enumerated.item[0];
482 if (idx >= imux->num_items)
483 idx = imux->num_items - 1;
486 for (i = 0; i < imux->num_items; i++) {
487 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
488 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
489 imux->items[i].index,
495 /* MUX style (e.g. ALC880) */
496 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
497 &spec->cur_mux[adc_idx]);
502 * channel mode setting
504 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
505 struct snd_ctl_elem_info *uinfo)
507 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
508 struct alc_spec *spec = codec->spec;
509 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
510 spec->num_channel_mode);
513 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
514 struct snd_ctl_elem_value *ucontrol)
516 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
517 struct alc_spec *spec = codec->spec;
518 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
519 spec->num_channel_mode,
520 spec->ext_channel_count);
523 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_value *ucontrol)
526 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
527 struct alc_spec *spec = codec->spec;
528 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
529 spec->num_channel_mode,
530 &spec->ext_channel_count);
531 if (err >= 0 && !spec->const_channel_count) {
532 spec->multiout.max_channels = spec->ext_channel_count;
533 if (spec->need_dac_fix)
534 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
540 * Control the mode of pin widget settings via the mixer. "pc" is used
541 * instead of "%" to avoid consequences of accidently treating the % as
542 * being part of a format specifier. Maximum allowed length of a value is
543 * 63 characters plus NULL terminator.
545 * Note: some retasking pin complexes seem to ignore requests for input
546 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
547 * are requested. Therefore order this list so that this behaviour will not
548 * cause problems when mixer clients move through the enum sequentially.
549 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
552 static char *alc_pin_mode_names[] = {
553 "Mic 50pc bias", "Mic 80pc bias",
554 "Line in", "Line out", "Headphone out",
556 static unsigned char alc_pin_mode_values[] = {
557 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
559 /* The control can present all 5 options, or it can limit the options based
560 * in the pin being assumed to be exclusively an input or an output pin. In
561 * addition, "input" pins may or may not process the mic bias option
562 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
563 * accept requests for bias as of chip versions up to March 2006) and/or
564 * wiring in the computer.
566 #define ALC_PIN_DIR_IN 0x00
567 #define ALC_PIN_DIR_OUT 0x01
568 #define ALC_PIN_DIR_INOUT 0x02
569 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
570 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
572 /* Info about the pin modes supported by the different pin direction modes.
573 * For each direction the minimum and maximum values are given.
575 static signed char alc_pin_mode_dir_info[5][2] = {
576 { 0, 2 }, /* ALC_PIN_DIR_IN */
577 { 3, 4 }, /* ALC_PIN_DIR_OUT */
578 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
579 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
580 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
582 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
583 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
584 #define alc_pin_mode_n_items(_dir) \
585 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
587 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_info *uinfo)
590 unsigned int item_num = uinfo->value.enumerated.item;
591 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
593 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
595 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
597 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
598 item_num = alc_pin_mode_min(dir);
599 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
603 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
604 struct snd_ctl_elem_value *ucontrol)
607 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
608 hda_nid_t nid = kcontrol->private_value & 0xffff;
609 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
610 long *valp = ucontrol->value.integer.value;
611 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
612 AC_VERB_GET_PIN_WIDGET_CONTROL,
615 /* Find enumerated value for current pinctl setting */
616 i = alc_pin_mode_min(dir);
617 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
619 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
623 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
624 struct snd_ctl_elem_value *ucontrol)
627 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
628 hda_nid_t nid = kcontrol->private_value & 0xffff;
629 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
630 long val = *ucontrol->value.integer.value;
631 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
632 AC_VERB_GET_PIN_WIDGET_CONTROL,
635 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
636 val = alc_pin_mode_min(dir);
638 change = pinctl != alc_pin_mode_values[val];
640 /* Set pin mode to that requested */
641 snd_hda_codec_write_cache(codec, nid, 0,
642 AC_VERB_SET_PIN_WIDGET_CONTROL,
643 alc_pin_mode_values[val]);
645 /* Also enable the retasking pin's input/output as required
646 * for the requested pin mode. Enum values of 2 or less are
649 * Dynamically switching the input/output buffers probably
650 * reduces noise slightly (particularly on input) so we'll
651 * do it. However, having both input and output buffers
652 * enabled simultaneously doesn't seem to be problematic if
653 * this turns out to be necessary in the future.
656 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
657 HDA_AMP_MUTE, HDA_AMP_MUTE);
658 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
661 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
662 HDA_AMP_MUTE, HDA_AMP_MUTE);
663 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
670 #define ALC_PIN_MODE(xname, nid, dir) \
671 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
672 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
673 .info = alc_pin_mode_info, \
674 .get = alc_pin_mode_get, \
675 .put = alc_pin_mode_put, \
676 .private_value = nid | (dir<<16) }
678 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
679 * together using a mask with more than one bit set. This control is
680 * currently used only by the ALC260 test model. At this stage they are not
681 * needed for any "production" models.
683 #ifdef CONFIG_SND_DEBUG
684 #define alc_gpio_data_info snd_ctl_boolean_mono_info
686 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
687 struct snd_ctl_elem_value *ucontrol)
689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
690 hda_nid_t nid = kcontrol->private_value & 0xffff;
691 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
692 long *valp = ucontrol->value.integer.value;
693 unsigned int val = snd_hda_codec_read(codec, nid, 0,
694 AC_VERB_GET_GPIO_DATA, 0x00);
696 *valp = (val & mask) != 0;
699 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol)
703 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
704 hda_nid_t nid = kcontrol->private_value & 0xffff;
705 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
706 long val = *ucontrol->value.integer.value;
707 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
708 AC_VERB_GET_GPIO_DATA,
711 /* Set/unset the masked GPIO bit(s) as needed */
712 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
717 snd_hda_codec_write_cache(codec, nid, 0,
718 AC_VERB_SET_GPIO_DATA, gpio_data);
722 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
723 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
724 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
725 .info = alc_gpio_data_info, \
726 .get = alc_gpio_data_get, \
727 .put = alc_gpio_data_put, \
728 .private_value = nid | (mask<<16) }
729 #endif /* CONFIG_SND_DEBUG */
731 /* A switch control to allow the enabling of the digital IO pins on the
732 * ALC260. This is incredibly simplistic; the intention of this control is
733 * to provide something in the test model allowing digital outputs to be
734 * identified if present. If models are found which can utilise these
735 * outputs a more complete mixer control can be devised for those models if
738 #ifdef CONFIG_SND_DEBUG
739 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
741 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
742 struct snd_ctl_elem_value *ucontrol)
744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
745 hda_nid_t nid = kcontrol->private_value & 0xffff;
746 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
747 long *valp = ucontrol->value.integer.value;
748 unsigned int val = snd_hda_codec_read(codec, nid, 0,
749 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
751 *valp = (val & mask) != 0;
754 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
755 struct snd_ctl_elem_value *ucontrol)
758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
759 hda_nid_t nid = kcontrol->private_value & 0xffff;
760 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
761 long val = *ucontrol->value.integer.value;
762 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
763 AC_VERB_GET_DIGI_CONVERT_1,
766 /* Set/unset the masked control bit(s) as needed */
767 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
772 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
777 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
778 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
779 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
780 .info = alc_spdif_ctrl_info, \
781 .get = alc_spdif_ctrl_get, \
782 .put = alc_spdif_ctrl_put, \
783 .private_value = nid | (mask<<16) }
784 #endif /* CONFIG_SND_DEBUG */
786 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
787 * Again, this is only used in the ALC26x test models to help identify when
788 * the EAPD line must be asserted for features to work.
790 #ifdef CONFIG_SND_DEBUG
791 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
793 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_value *ucontrol)
796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
797 hda_nid_t nid = kcontrol->private_value & 0xffff;
798 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
799 long *valp = ucontrol->value.integer.value;
800 unsigned int val = snd_hda_codec_read(codec, nid, 0,
801 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
803 *valp = (val & mask) != 0;
807 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
808 struct snd_ctl_elem_value *ucontrol)
811 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
812 hda_nid_t nid = kcontrol->private_value & 0xffff;
813 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
814 long val = *ucontrol->value.integer.value;
815 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
816 AC_VERB_GET_EAPD_BTLENABLE,
819 /* Set/unset the masked control bit(s) as needed */
820 change = (!val ? 0 : mask) != (ctrl_data & mask);
825 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
831 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
832 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
833 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
834 .info = alc_eapd_ctrl_info, \
835 .get = alc_eapd_ctrl_get, \
836 .put = alc_eapd_ctrl_put, \
837 .private_value = nid | (mask<<16) }
838 #endif /* CONFIG_SND_DEBUG */
841 * set up the input pin config (depending on the given auto-pin type)
843 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
846 unsigned int val = PIN_IN;
848 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
851 oldval = snd_hda_codec_read(codec, nid, 0,
852 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
853 pincap = snd_hda_query_pin_caps(codec, nid);
854 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
855 /* if the default pin setup is vref50, we give it priority */
856 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
858 else if (pincap & AC_PINCAP_VREF_50)
860 else if (pincap & AC_PINCAP_VREF_100)
862 else if (pincap & AC_PINCAP_VREF_GRD)
865 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
870 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
872 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
874 spec->mixers[spec->num_mixers++] = mix;
877 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
879 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
881 spec->init_verbs[spec->num_init_verbs++] = verb;
885 * set up from the preset table
887 static void setup_preset(struct hda_codec *codec,
888 const struct alc_config_preset *preset)
890 struct alc_spec *spec = codec->spec;
893 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
894 add_mixer(spec, preset->mixers[i]);
895 spec->cap_mixer = preset->cap_mixer;
896 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
898 add_verb(spec, preset->init_verbs[i]);
900 spec->channel_mode = preset->channel_mode;
901 spec->num_channel_mode = preset->num_channel_mode;
902 spec->need_dac_fix = preset->need_dac_fix;
903 spec->const_channel_count = preset->const_channel_count;
905 if (preset->const_channel_count)
906 spec->multiout.max_channels = preset->const_channel_count;
908 spec->multiout.max_channels = spec->channel_mode[0].channels;
909 spec->ext_channel_count = spec->channel_mode[0].channels;
911 spec->multiout.num_dacs = preset->num_dacs;
912 spec->multiout.dac_nids = preset->dac_nids;
913 spec->multiout.dig_out_nid = preset->dig_out_nid;
914 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
915 spec->multiout.hp_nid = preset->hp_nid;
917 spec->num_mux_defs = preset->num_mux_defs;
918 if (!spec->num_mux_defs)
919 spec->num_mux_defs = 1;
920 spec->input_mux = preset->input_mux;
922 spec->num_adc_nids = preset->num_adc_nids;
923 spec->adc_nids = preset->adc_nids;
924 spec->capsrc_nids = preset->capsrc_nids;
925 spec->dig_in_nid = preset->dig_in_nid;
927 spec->unsol_event = preset->unsol_event;
928 spec->init_hook = preset->init_hook;
929 #ifdef CONFIG_SND_HDA_POWER_SAVE
930 spec->power_hook = preset->power_hook;
931 spec->loopback.amplist = preset->loopbacks;
935 preset->setup(codec);
938 /* Enable GPIO mask and set output */
939 static struct hda_verb alc_gpio1_init_verbs[] = {
940 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
941 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
942 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
946 static struct hda_verb alc_gpio2_init_verbs[] = {
947 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
948 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
949 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
953 static struct hda_verb alc_gpio3_init_verbs[] = {
954 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
955 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
956 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
961 * Fix hardware PLL issue
962 * On some codecs, the analog PLL gating control must be off while
963 * the default value is 1.
965 static void alc_fix_pll(struct hda_codec *codec)
967 struct alc_spec *spec = codec->spec;
972 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
974 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
975 AC_VERB_GET_PROC_COEF, 0);
976 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
978 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
979 val & ~(1 << spec->pll_coef_bit));
982 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
983 unsigned int coef_idx, unsigned int coef_bit)
985 struct alc_spec *spec = codec->spec;
987 spec->pll_coef_idx = coef_idx;
988 spec->pll_coef_bit = coef_bit;
992 static void alc_automute_pin(struct hda_codec *codec)
994 struct alc_spec *spec = codec->spec;
995 unsigned int nid = spec->autocfg.hp_pins[0];
1000 spec->jack_present = snd_hda_jack_detect(codec, nid);
1001 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1002 nid = spec->autocfg.speaker_pins[i];
1005 snd_hda_codec_write(codec, nid, 0,
1006 AC_VERB_SET_PIN_WIDGET_CONTROL,
1007 spec->jack_present ? 0 : PIN_OUT);
1011 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1014 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1017 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1018 for (i = 0; i < nums; i++)
1024 /* switch the current ADC according to the jack state */
1025 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1027 struct alc_spec *spec = codec->spec;
1028 unsigned int present;
1031 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1033 spec->cur_adc_idx = 1;
1035 spec->cur_adc_idx = 0;
1036 new_adc = spec->adc_nids[spec->cur_adc_idx];
1037 if (spec->cur_adc && spec->cur_adc != new_adc) {
1038 /* stream is running, let's swap the current ADC */
1039 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
1040 spec->cur_adc = new_adc;
1041 snd_hda_codec_setup_stream(codec, new_adc,
1042 spec->cur_adc_stream_tag, 0,
1043 spec->cur_adc_format);
1047 static void alc_mic_automute(struct hda_codec *codec)
1049 struct alc_spec *spec = codec->spec;
1050 struct alc_mic_route *dead, *alive;
1051 unsigned int present, type;
1054 if (!spec->auto_mic)
1056 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1058 if (snd_BUG_ON(!spec->adc_nids))
1061 if (spec->dual_adc_switch) {
1062 alc_dual_mic_adc_auto_switch(codec);
1066 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1068 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1070 alive = &spec->ext_mic;
1071 dead = &spec->int_mic;
1073 alive = &spec->int_mic;
1074 dead = &spec->ext_mic;
1077 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1078 if (type == AC_WID_AUD_MIX) {
1079 /* Matrix-mixer style (e.g. ALC882) */
1080 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1083 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1085 HDA_AMP_MUTE, HDA_AMP_MUTE);
1087 /* MUX style (e.g. ALC880) */
1088 snd_hda_codec_write_cache(codec, cap_nid, 0,
1089 AC_VERB_SET_CONNECT_SEL,
1093 /* FIXME: analog mixer */
1096 /* unsolicited event for HP jack sensing */
1097 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1099 if (codec->vendor_id == 0x10ec0880)
1104 case ALC880_HP_EVENT:
1105 alc_automute_pin(codec);
1107 case ALC880_MIC_EVENT:
1108 alc_mic_automute(codec);
1113 static void alc_inithook(struct hda_codec *codec)
1115 alc_automute_pin(codec);
1116 alc_mic_automute(codec);
1119 /* additional initialization for ALC888 variants */
1120 static void alc888_coef_init(struct hda_codec *codec)
1124 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1125 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1126 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1127 if ((tmp & 0xf0) == 0x20)
1129 snd_hda_codec_read(codec, 0x20, 0,
1130 AC_VERB_SET_PROC_COEF, 0x830);
1133 snd_hda_codec_read(codec, 0x20, 0,
1134 AC_VERB_SET_PROC_COEF, 0x3030);
1137 static void alc889_coef_init(struct hda_codec *codec)
1141 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1142 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1143 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1144 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1147 /* turn on/off EAPD control (only if available) */
1148 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1150 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1152 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1157 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1162 case ALC_INIT_GPIO1:
1163 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1165 case ALC_INIT_GPIO2:
1166 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1168 case ALC_INIT_GPIO3:
1169 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1171 case ALC_INIT_DEFAULT:
1172 switch (codec->vendor_id) {
1174 set_eapd(codec, 0x0f, 1);
1175 set_eapd(codec, 0x10, 1);
1188 set_eapd(codec, 0x14, 1);
1189 set_eapd(codec, 0x15, 1);
1192 switch (codec->vendor_id) {
1194 snd_hda_codec_write(codec, 0x1a, 0,
1195 AC_VERB_SET_COEF_INDEX, 7);
1196 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1197 AC_VERB_GET_PROC_COEF, 0);
1198 snd_hda_codec_write(codec, 0x1a, 0,
1199 AC_VERB_SET_COEF_INDEX, 7);
1200 snd_hda_codec_write(codec, 0x1a, 0,
1201 AC_VERB_SET_PROC_COEF,
1211 alc889_coef_init(codec);
1214 alc888_coef_init(codec);
1216 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1219 snd_hda_codec_write(codec, 0x20, 0,
1220 AC_VERB_SET_COEF_INDEX, 7);
1221 tmp = snd_hda_codec_read(codec, 0x20, 0,
1222 AC_VERB_GET_PROC_COEF, 0);
1223 snd_hda_codec_write(codec, 0x20, 0,
1224 AC_VERB_SET_COEF_INDEX, 7);
1225 snd_hda_codec_write(codec, 0x20, 0,
1226 AC_VERB_SET_PROC_COEF,
1235 static void alc_init_auto_hp(struct hda_codec *codec)
1237 struct alc_spec *spec = codec->spec;
1239 if (!spec->autocfg.hp_pins[0])
1242 if (!spec->autocfg.speaker_pins[0]) {
1243 if (spec->autocfg.line_out_pins[0] &&
1244 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1245 spec->autocfg.speaker_pins[0] =
1246 spec->autocfg.line_out_pins[0];
1251 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1252 spec->autocfg.hp_pins[0]);
1253 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1254 AC_VERB_SET_UNSOLICITED_ENABLE,
1255 AC_USRSP_EN | ALC880_HP_EVENT);
1256 spec->unsol_event = alc_sku_unsol_event;
1259 static void alc_init_auto_mic(struct hda_codec *codec)
1261 struct alc_spec *spec = codec->spec;
1262 struct auto_pin_cfg *cfg = &spec->autocfg;
1263 hda_nid_t fixed, ext;
1266 /* there must be only two mic inputs exclusively */
1267 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1268 if (cfg->input_pins[i])
1272 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1273 hda_nid_t nid = cfg->input_pins[i];
1274 unsigned int defcfg;
1277 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1278 switch (get_defcfg_connect(defcfg)) {
1279 case AC_JACK_PORT_FIXED:
1281 return; /* already occupied */
1284 case AC_JACK_PORT_COMPLEX:
1286 return; /* already occupied */
1290 return; /* invalid entry */
1295 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1296 return; /* no unsol support */
1297 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1299 spec->ext_mic.pin = ext;
1300 spec->int_mic.pin = fixed;
1301 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1302 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1304 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1305 AC_VERB_SET_UNSOLICITED_ENABLE,
1306 AC_USRSP_EN | ALC880_MIC_EVENT);
1307 spec->unsol_event = alc_sku_unsol_event;
1310 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1312 unsigned int ass, tmp, i;
1314 struct alc_spec *spec = codec->spec;
1316 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1318 ass = codec->subsystem_id & 0xffff;
1319 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1323 if (codec->vendor_id == 0x10ec0260)
1325 ass = snd_hda_codec_get_pincfg(codec, nid);
1328 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1329 codec->chip_name, ass);
1335 for (i = 1; i < 16; i++) {
1339 if (((ass >> 16) & 0xf) != tmp)
1342 spec->cdefine.port_connectivity = ass >> 30;
1343 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1344 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1345 spec->cdefine.customization = ass >> 8;
1347 spec->cdefine.sku_cfg = ass;
1348 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1349 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1350 spec->cdefine.swap = (ass & 0x2) >> 1;
1351 spec->cdefine.override = ass & 0x1;
1353 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1354 nid, spec->cdefine.sku_cfg);
1355 snd_printd("SKU: port_connectivity=0x%x\n",
1356 spec->cdefine.port_connectivity);
1357 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1358 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1359 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1360 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1361 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1362 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1363 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1368 /* check subsystem ID and set up device-specific initialization;
1369 * return 1 if initialized, 0 if invalid SSID
1371 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1372 * 31 ~ 16 : Manufacture ID
1374 * 7 ~ 0 : Assembly ID
1375 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1377 static int alc_subsystem_id(struct hda_codec *codec,
1378 hda_nid_t porta, hda_nid_t porte,
1379 hda_nid_t portd, hda_nid_t porti)
1381 unsigned int ass, tmp, i;
1383 struct alc_spec *spec = codec->spec;
1385 ass = codec->subsystem_id & 0xffff;
1386 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1389 /* invalid SSID, check the special NID pin defcfg instead */
1391 * 31~30 : port connectivity
1394 * 19~16 : Check sum (15:1)
1399 if (codec->vendor_id == 0x10ec0260)
1401 ass = snd_hda_codec_get_pincfg(codec, nid);
1402 snd_printd("realtek: No valid SSID, "
1403 "checking pincfg 0x%08x for NID 0x%x\n",
1407 if ((ass >> 30) != 1) /* no physical connection */
1412 for (i = 1; i < 16; i++) {
1416 if (((ass >> 16) & 0xf) != tmp)
1419 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1420 ass & 0xffff, codec->vendor_id);
1424 * 2 : 0 --> Desktop, 1 --> Laptop
1425 * 3~5 : External Amplifier control
1428 tmp = (ass & 0x38) >> 3; /* external Amp control */
1431 spec->init_amp = ALC_INIT_GPIO1;
1434 spec->init_amp = ALC_INIT_GPIO2;
1437 spec->init_amp = ALC_INIT_GPIO3;
1440 spec->init_amp = ALC_INIT_DEFAULT;
1444 /* is laptop or Desktop and enable the function "Mute internal speaker
1445 * when the external headphone out jack is plugged"
1447 if (!(ass & 0x8000))
1450 * 10~8 : Jack location
1451 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1453 * 15 : 1 --> enable the function "Mute internal speaker
1454 * when the external headphone out jack is plugged"
1456 if (!spec->autocfg.hp_pins[0]) {
1458 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1469 for (i = 0; i < spec->autocfg.line_outs; i++)
1470 if (spec->autocfg.line_out_pins[i] == nid)
1472 spec->autocfg.hp_pins[0] = nid;
1475 alc_init_auto_hp(codec);
1476 alc_init_auto_mic(codec);
1480 static void alc_ssid_check(struct hda_codec *codec,
1481 hda_nid_t porta, hda_nid_t porte,
1482 hda_nid_t portd, hda_nid_t porti)
1484 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1485 struct alc_spec *spec = codec->spec;
1486 snd_printd("realtek: "
1487 "Enable default setup for auto mode as fallback\n");
1488 spec->init_amp = ALC_INIT_DEFAULT;
1489 alc_init_auto_hp(codec);
1490 alc_init_auto_mic(codec);
1495 * Fix-up pin default configurations and add default verbs
1504 const struct alc_pincfg *pins;
1505 const struct hda_verb *verbs;
1508 static void alc_pick_fixup(struct hda_codec *codec,
1509 const struct snd_pci_quirk *quirk,
1510 const struct alc_fixup *fix,
1513 const struct alc_pincfg *cfg;
1515 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1518 fix += quirk->value;
1520 if (pre_init && cfg) {
1521 #ifdef CONFIG_SND_DEBUG_VERBOSE
1522 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1523 codec->chip_name, quirk->name);
1525 for (; cfg->nid; cfg++)
1526 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1528 if (!pre_init && fix->verbs) {
1529 #ifdef CONFIG_SND_DEBUG_VERBOSE
1530 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1531 codec->chip_name, quirk->name);
1533 add_verb(codec->spec, fix->verbs);
1537 static int alc_read_coef_idx(struct hda_codec *codec,
1538 unsigned int coef_idx)
1541 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1543 val = snd_hda_codec_read(codec, 0x20, 0,
1544 AC_VERB_GET_PROC_COEF, 0);
1548 /* set right pin controls for digital I/O */
1549 static void alc_auto_init_digital(struct hda_codec *codec)
1551 struct alc_spec *spec = codec->spec;
1555 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1556 pin = spec->autocfg.dig_out_pins[i];
1558 snd_hda_codec_write(codec, pin, 0,
1559 AC_VERB_SET_PIN_WIDGET_CONTROL,
1563 pin = spec->autocfg.dig_in_pin;
1565 snd_hda_codec_write(codec, pin, 0,
1566 AC_VERB_SET_PIN_WIDGET_CONTROL,
1570 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1571 static void alc_auto_parse_digital(struct hda_codec *codec)
1573 struct alc_spec *spec = codec->spec;
1577 /* support multiple SPDIFs; the secondary is set up as a slave */
1578 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1579 err = snd_hda_get_connections(codec,
1580 spec->autocfg.dig_out_pins[i],
1585 spec->multiout.dig_out_nid = dig_nid;
1586 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1588 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1589 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1591 spec->slave_dig_outs[i - 1] = dig_nid;
1595 if (spec->autocfg.dig_in_pin) {
1597 err = snd_hda_get_connections(codec,
1598 spec->autocfg.dig_in_pin,
1601 spec->dig_in_nid = dig_nid;
1612 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1613 /* Mic-in jack as mic in */
1614 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1615 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1616 /* Line-in jack as Line in */
1617 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1618 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1619 /* Line-Out as Front */
1620 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1627 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1628 /* Mic-in jack as mic in */
1629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1631 /* Line-in jack as Surround */
1632 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1633 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1634 /* Line-Out as Front */
1635 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1642 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1643 /* Mic-in jack as CLFE */
1644 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1645 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1646 /* Line-in jack as Surround */
1647 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1648 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1649 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1650 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1657 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1658 /* Mic-in jack as CLFE */
1659 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1660 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1661 /* Line-in jack as Surround */
1662 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1663 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1664 /* Line-Out as Side */
1665 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1669 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1670 { 2, alc888_4ST_ch2_intel_init },
1671 { 4, alc888_4ST_ch4_intel_init },
1672 { 6, alc888_4ST_ch6_intel_init },
1673 { 8, alc888_4ST_ch8_intel_init },
1677 * ALC888 Fujitsu Siemens Amillo xa3530
1680 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1681 /* Front Mic: set to PIN_IN (empty by default) */
1682 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1683 /* Connect Internal HP to Front */
1684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1685 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1686 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1687 /* Connect Bass HP to Front */
1688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1691 /* Connect Line-Out side jack (SPDIF) to Side */
1692 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1695 /* Connect Mic jack to CLFE */
1696 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1697 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1698 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1699 /* Connect Line-in jack to Surround */
1700 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1701 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1702 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1703 /* Connect HP out jack to Front */
1704 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1705 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1706 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1707 /* Enable unsolicited event for HP jack and Line-out jack */
1708 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1709 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1713 static void alc_automute_amp(struct hda_codec *codec)
1715 struct alc_spec *spec = codec->spec;
1720 spec->jack_present = 0;
1721 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1722 nid = spec->autocfg.hp_pins[i];
1725 if (snd_hda_jack_detect(codec, nid)) {
1726 spec->jack_present = 1;
1731 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1732 /* Toggle internal speakers muting */
1733 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1734 nid = spec->autocfg.speaker_pins[i];
1737 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1738 HDA_AMP_MUTE, mute);
1742 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1745 if (codec->vendor_id == 0x10ec0880)
1749 if (res == ALC880_HP_EVENT)
1750 alc_automute_amp(codec);
1753 static void alc889_automute_setup(struct hda_codec *codec)
1755 struct alc_spec *spec = codec->spec;
1757 spec->autocfg.hp_pins[0] = 0x15;
1758 spec->autocfg.speaker_pins[0] = 0x14;
1759 spec->autocfg.speaker_pins[1] = 0x16;
1760 spec->autocfg.speaker_pins[2] = 0x17;
1761 spec->autocfg.speaker_pins[3] = 0x19;
1762 spec->autocfg.speaker_pins[4] = 0x1a;
1765 static void alc889_intel_init_hook(struct hda_codec *codec)
1767 alc889_coef_init(codec);
1768 alc_automute_amp(codec);
1771 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1773 struct alc_spec *spec = codec->spec;
1775 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1776 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1777 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1778 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1782 * ALC888 Acer Aspire 4930G model
1785 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1786 /* Front Mic: set to PIN_IN (empty by default) */
1787 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1788 /* Unselect Front Mic by default in input mixer 3 */
1789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1790 /* Enable unsolicited event for HP jack */
1791 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1792 /* Connect Internal HP to front */
1793 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1794 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1795 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1796 /* Connect HP out to front */
1797 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1804 * ALC888 Acer Aspire 6530G model
1807 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1808 /* Route to built-in subwoofer as well as speakers */
1809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1811 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1812 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1813 /* Bias voltage on for external mic port */
1814 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1815 /* Front Mic: set to PIN_IN (empty by default) */
1816 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1817 /* Unselect Front Mic by default in input mixer 3 */
1818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1819 /* Enable unsolicited event for HP jack */
1820 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1821 /* Enable speaker output */
1822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1824 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1825 /* Enable headphone output */
1826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1828 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1829 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1834 * ALC889 Acer Aspire 8930G model
1837 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1838 /* Front Mic: set to PIN_IN (empty by default) */
1839 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1840 /* Unselect Front Mic by default in input mixer 3 */
1841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1842 /* Enable unsolicited event for HP jack */
1843 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1844 /* Connect Internal Front to Front */
1845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1847 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1848 /* Connect Internal Rear to Rear */
1849 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1850 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1851 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1852 /* Connect Internal CLFE to CLFE */
1853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1854 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1855 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1856 /* Connect HP out to Front */
1857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1858 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1859 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1860 /* Enable all DACs */
1861 /* DAC DISABLE/MUTE 1? */
1862 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1863 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1864 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1865 /* DAC DISABLE/MUTE 2? */
1866 /* some bit here disables the other DACs. Init=0x4900 */
1867 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1868 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1870 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1871 * which makes the stereo useless. However, either the mic or the ALC889
1872 * makes the signal become a difference/sum signal instead of standard
1873 * stereo, which is annoying. So instead we flip this bit which makes the
1874 * codec replicate the sum signal to both channels, turning it into a
1877 /* DMIC_CONTROL? Init value = 0x0001 */
1878 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1879 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1883 static struct hda_input_mux alc888_2_capture_sources[2] = {
1884 /* Front mic only available on one ADC */
1891 { "Front Mic", 0xb },
1904 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1905 /* Interal mic only available on one ADC */
1912 { "Input Mix", 0xa },
1922 { "Input Mix", 0xa },
1927 static struct hda_input_mux alc889_capture_sources[3] = {
1928 /* Digital mic only available on first "ADC" */
1935 { "Front Mic", 0xb },
1936 { "Input Mix", 0xa },
1945 { "Input Mix", 0xa },
1954 { "Input Mix", 0xa },
1959 static struct snd_kcontrol_new alc888_base_mixer[] = {
1960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1963 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1966 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1967 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1968 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1969 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1970 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1973 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1974 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1981 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1982 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1983 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1984 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1985 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1986 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1988 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1989 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1990 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1992 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2000 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2002 struct alc_spec *spec = codec->spec;
2004 spec->autocfg.hp_pins[0] = 0x15;
2005 spec->autocfg.speaker_pins[0] = 0x14;
2006 spec->autocfg.speaker_pins[1] = 0x16;
2007 spec->autocfg.speaker_pins[2] = 0x17;
2010 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2012 struct alc_spec *spec = codec->spec;
2014 spec->autocfg.hp_pins[0] = 0x15;
2015 spec->autocfg.speaker_pins[0] = 0x14;
2016 spec->autocfg.speaker_pins[1] = 0x16;
2017 spec->autocfg.speaker_pins[2] = 0x17;
2020 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2022 struct alc_spec *spec = codec->spec;
2024 spec->autocfg.hp_pins[0] = 0x15;
2025 spec->autocfg.speaker_pins[0] = 0x14;
2026 spec->autocfg.speaker_pins[1] = 0x16;
2027 spec->autocfg.speaker_pins[2] = 0x1b;
2031 * ALC880 3-stack model
2033 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2034 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2035 * F-Mic = 0x1b, HP = 0x19
2038 static hda_nid_t alc880_dac_nids[4] = {
2039 /* front, rear, clfe, rear_surr */
2040 0x02, 0x05, 0x04, 0x03
2043 static hda_nid_t alc880_adc_nids[3] = {
2048 /* The datasheet says the node 0x07 is connected from inputs,
2049 * but it shows zero connection in the real implementation on some devices.
2050 * Note: this is a 915GAV bug, fixed on 915GLV
2052 static hda_nid_t alc880_adc_nids_alt[2] = {
2057 #define ALC880_DIGOUT_NID 0x06
2058 #define ALC880_DIGIN_NID 0x0a
2060 static struct hda_input_mux alc880_capture_source = {
2064 { "Front Mic", 0x3 },
2070 /* channel source setting (2/6 channel selection for 3-stack) */
2072 static struct hda_verb alc880_threestack_ch2_init[] = {
2073 /* set line-in to input, mute it */
2074 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2075 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2076 /* set mic-in to input vref 80%, mute it */
2077 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2078 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2083 static struct hda_verb alc880_threestack_ch6_init[] = {
2084 /* set line-in to output, unmute it */
2085 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2086 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2087 /* set mic-in to output, unmute it */
2088 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2089 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2093 static struct hda_channel_mode alc880_threestack_modes[2] = {
2094 { 2, alc880_threestack_ch2_init },
2095 { 6, alc880_threestack_ch6_init },
2098 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2099 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2100 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2101 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2102 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2103 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2104 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2105 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2106 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2107 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2108 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2109 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2110 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2118 .name = "Channel Mode",
2119 .info = alc_ch_mode_info,
2120 .get = alc_ch_mode_get,
2121 .put = alc_ch_mode_put,
2126 /* capture mixer elements */
2127 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2128 struct snd_ctl_elem_info *uinfo)
2130 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2131 struct alc_spec *spec = codec->spec;
2134 mutex_lock(&codec->control_mutex);
2135 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2137 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2138 mutex_unlock(&codec->control_mutex);
2142 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2143 unsigned int size, unsigned int __user *tlv)
2145 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2146 struct alc_spec *spec = codec->spec;
2149 mutex_lock(&codec->control_mutex);
2150 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2152 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2153 mutex_unlock(&codec->control_mutex);
2157 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2158 struct snd_ctl_elem_value *ucontrol);
2160 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2161 struct snd_ctl_elem_value *ucontrol,
2164 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2165 struct alc_spec *spec = codec->spec;
2166 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2169 mutex_lock(&codec->control_mutex);
2170 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2172 err = func(kcontrol, ucontrol);
2173 mutex_unlock(&codec->control_mutex);
2177 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2178 struct snd_ctl_elem_value *ucontrol)
2180 return alc_cap_getput_caller(kcontrol, ucontrol,
2181 snd_hda_mixer_amp_volume_get);
2184 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2185 struct snd_ctl_elem_value *ucontrol)
2187 return alc_cap_getput_caller(kcontrol, ucontrol,
2188 snd_hda_mixer_amp_volume_put);
2191 /* capture mixer elements */
2192 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2194 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2195 struct snd_ctl_elem_value *ucontrol)
2197 return alc_cap_getput_caller(kcontrol, ucontrol,
2198 snd_hda_mixer_amp_switch_get);
2201 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2202 struct snd_ctl_elem_value *ucontrol)
2204 return alc_cap_getput_caller(kcontrol, ucontrol,
2205 snd_hda_mixer_amp_switch_put);
2208 #define _DEFINE_CAPMIX(num) \
2210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2211 .name = "Capture Switch", \
2212 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2214 .info = alc_cap_sw_info, \
2215 .get = alc_cap_sw_get, \
2216 .put = alc_cap_sw_put, \
2219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2220 .name = "Capture Volume", \
2221 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2222 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2223 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2225 .info = alc_cap_vol_info, \
2226 .get = alc_cap_vol_get, \
2227 .put = alc_cap_vol_put, \
2228 .tlv = { .c = alc_cap_vol_tlv }, \
2231 #define _DEFINE_CAPSRC(num) \
2233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2234 /* .name = "Capture Source", */ \
2235 .name = "Input Source", \
2237 .info = alc_mux_enum_info, \
2238 .get = alc_mux_enum_get, \
2239 .put = alc_mux_enum_put, \
2242 #define DEFINE_CAPMIX(num) \
2243 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2244 _DEFINE_CAPMIX(num), \
2245 _DEFINE_CAPSRC(num), \
2249 #define DEFINE_CAPMIX_NOSRC(num) \
2250 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2251 _DEFINE_CAPMIX(num), \
2255 /* up to three ADCs */
2259 DEFINE_CAPMIX_NOSRC(1);
2260 DEFINE_CAPMIX_NOSRC(2);
2261 DEFINE_CAPMIX_NOSRC(3);
2264 * ALC880 5-stack model
2266 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2268 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2269 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2272 /* additional mixers to alc880_three_stack_mixer */
2273 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2274 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2279 /* channel source setting (6/8 channel selection for 5-stack) */
2281 static struct hda_verb alc880_fivestack_ch6_init[] = {
2282 /* set line-in to input, mute it */
2283 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2284 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2289 static struct hda_verb alc880_fivestack_ch8_init[] = {
2290 /* set line-in to output, unmute it */
2291 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2292 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2296 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2297 { 6, alc880_fivestack_ch6_init },
2298 { 8, alc880_fivestack_ch8_init },
2303 * ALC880 6-stack model
2305 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2306 * Side = 0x05 (0x0f)
2307 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2308 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2311 static hda_nid_t alc880_6st_dac_nids[4] = {
2312 /* front, rear, clfe, rear_surr */
2313 0x02, 0x03, 0x04, 0x05
2316 static struct hda_input_mux alc880_6stack_capture_source = {
2320 { "Front Mic", 0x1 },
2326 /* fixed 8-channels */
2327 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2331 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2332 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2333 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2334 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2335 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2336 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2337 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2338 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2339 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2340 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2341 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2342 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2343 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2345 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2348 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2352 .name = "Channel Mode",
2353 .info = alc_ch_mode_info,
2354 .get = alc_ch_mode_get,
2355 .put = alc_ch_mode_put,
2364 * W810 has rear IO for:
2367 * Center/LFE (DAC 04)
2370 * The system also has a pair of internal speakers, and a headphone jack.
2371 * These are both connected to Line2 on the codec, hence to DAC 02.
2373 * There is a variable resistor to control the speaker or headphone
2374 * volume. This is a hardware-only device without a software API.
2376 * Plugging headphones in will disable the internal speakers. This is
2377 * implemented in hardware, not via the driver using jack sense. In
2378 * a similar fashion, plugging into the rear socket marked "front" will
2379 * disable both the speakers and headphones.
2381 * For input, there's a microphone jack, and an "audio in" jack.
2382 * These may not do anything useful with this driver yet, because I
2383 * haven't setup any initialization verbs for these yet...
2386 static hda_nid_t alc880_w810_dac_nids[3] = {
2387 /* front, rear/surround, clfe */
2391 /* fixed 6 channels */
2392 static struct hda_channel_mode alc880_w810_modes[1] = {
2396 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2397 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2398 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2399 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2400 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2401 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2402 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2403 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2404 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2405 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2406 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2414 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2415 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2419 static hda_nid_t alc880_z71v_dac_nids[1] = {
2422 #define ALC880_Z71V_HP_DAC 0x03
2424 /* fixed 2 channels */
2425 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2429 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2430 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2431 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2432 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2433 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2434 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2435 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2443 * ALC880 F1734 model
2445 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2446 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2449 static hda_nid_t alc880_f1734_dac_nids[1] = {
2452 #define ALC880_F1734_HP_DAC 0x02
2454 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2455 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2456 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2457 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2458 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2459 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2460 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2462 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2466 static struct hda_input_mux alc880_f1734_capture_source = {
2478 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2479 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2480 * Mic = 0x18, Line = 0x1a
2483 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2484 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2486 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2487 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2488 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2489 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2490 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2491 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2492 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2493 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2494 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2495 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2496 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2498 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2502 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2503 .name = "Channel Mode",
2504 .info = alc_ch_mode_info,
2505 .get = alc_ch_mode_get,
2506 .put = alc_ch_mode_put,
2512 * ALC880 ASUS W1V model
2514 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2515 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2516 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2519 /* additional mixers to alc880_asus_mixer */
2520 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2521 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2522 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2527 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2528 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2529 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2531 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2532 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2535 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2536 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2541 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2543 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2544 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2545 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2546 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2547 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2548 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2549 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2550 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2551 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2552 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2553 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2554 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2555 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2556 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2557 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2560 .name = "Channel Mode",
2561 .info = alc_ch_mode_info,
2562 .get = alc_ch_mode_get,
2563 .put = alc_ch_mode_put,
2568 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2570 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2571 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2572 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2575 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2576 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2577 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2578 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2582 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2584 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2585 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2586 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2593 * virtual master controls
2597 * slave controls for virtual master
2599 static const char *alc_slave_vols[] = {
2600 "Front Playback Volume",
2601 "Surround Playback Volume",
2602 "Center Playback Volume",
2603 "LFE Playback Volume",
2604 "Side Playback Volume",
2605 "Headphone Playback Volume",
2606 "Speaker Playback Volume",
2607 "Mono Playback Volume",
2608 "Line-Out Playback Volume",
2609 "PCM Playback Volume",
2613 static const char *alc_slave_sws[] = {
2614 "Front Playback Switch",
2615 "Surround Playback Switch",
2616 "Center Playback Switch",
2617 "LFE Playback Switch",
2618 "Side Playback Switch",
2619 "Headphone Playback Switch",
2620 "Speaker Playback Switch",
2621 "Mono Playback Switch",
2622 "IEC958 Playback Switch",
2623 "Line-Out Playback Switch",
2624 "PCM Playback Switch",
2629 * build control elements
2632 #define NID_MAPPING (-1)
2634 #define SUBDEV_SPEAKER_ (0 << 6)
2635 #define SUBDEV_HP_ (1 << 6)
2636 #define SUBDEV_LINE_ (2 << 6)
2637 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2638 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2639 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2641 static void alc_free_kctls(struct hda_codec *codec);
2643 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2644 /* additional beep mixers; the actual parameters are overwritten at build */
2645 static struct snd_kcontrol_new alc_beep_mixer[] = {
2646 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2647 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2652 static int alc_build_controls(struct hda_codec *codec)
2654 struct alc_spec *spec = codec->spec;
2655 struct snd_kcontrol *kctl = NULL;
2656 struct snd_kcontrol_new *knew;
2661 for (i = 0; i < spec->num_mixers; i++) {
2662 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2666 if (spec->cap_mixer) {
2667 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2671 if (spec->multiout.dig_out_nid) {
2672 err = snd_hda_create_spdif_out_ctls(codec,
2673 spec->multiout.dig_out_nid);
2676 if (!spec->no_analog) {
2677 err = snd_hda_create_spdif_share_sw(codec,
2681 spec->multiout.share_spdif = 1;
2684 if (spec->dig_in_nid) {
2685 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2690 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2691 /* create beep controls if needed */
2692 if (spec->beep_amp) {
2693 struct snd_kcontrol_new *knew;
2694 for (knew = alc_beep_mixer; knew->name; knew++) {
2695 struct snd_kcontrol *kctl;
2696 kctl = snd_ctl_new1(knew, codec);
2699 kctl->private_value = spec->beep_amp;
2700 err = snd_hda_ctl_add(codec, 0, kctl);
2707 /* if we have no master control, let's create it */
2708 if (!spec->no_analog &&
2709 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2710 unsigned int vmaster_tlv[4];
2711 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2712 HDA_OUTPUT, vmaster_tlv);
2713 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2714 vmaster_tlv, alc_slave_vols);
2718 if (!spec->no_analog &&
2719 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2720 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2721 NULL, alc_slave_sws);
2726 /* assign Capture Source enums to NID */
2727 if (spec->capsrc_nids || spec->adc_nids) {
2728 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2730 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2731 for (i = 0; kctl && i < kctl->count; i++) {
2732 hda_nid_t *nids = spec->capsrc_nids;
2734 nids = spec->adc_nids;
2735 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2740 if (spec->cap_mixer) {
2741 const char *kname = kctl ? kctl->id.name : NULL;
2742 for (knew = spec->cap_mixer; knew->name; knew++) {
2743 if (kname && strcmp(knew->name, kname) == 0)
2745 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2746 for (i = 0; kctl && i < kctl->count; i++) {
2747 err = snd_hda_add_nid(codec, kctl, i,
2755 /* other nid->control mapping */
2756 for (i = 0; i < spec->num_mixers; i++) {
2757 for (knew = spec->mixers[i]; knew->name; knew++) {
2758 if (knew->iface != NID_MAPPING)
2760 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2763 u = knew->subdevice;
2764 for (j = 0; j < 4; j++, u >>= 8) {
2769 case SUBDEV_SPEAKER_:
2770 nid = spec->autocfg.speaker_pins[nid];
2773 nid = spec->autocfg.line_out_pins[nid];
2776 nid = spec->autocfg.hp_pins[nid];
2781 err = snd_hda_add_nid(codec, kctl, 0, nid);
2785 u = knew->private_value;
2786 for (j = 0; j < 4; j++, u >>= 8) {
2790 err = snd_hda_add_nid(codec, kctl, 0, nid);
2797 alc_free_kctls(codec); /* no longer needed */
2804 * initialize the codec volumes, etc
2808 * generic initialization of ADC, input mixers and output mixers
2810 static struct hda_verb alc880_volume_init_verbs[] = {
2812 * Unmute ADC0-2 and set the default input to mic-in
2814 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2816 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2817 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2818 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2819 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2821 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2823 * Note: PASD motherboards uses the Line In 2 as the input for front
2826 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2836 * Set up output mixers (0x0c - 0x0f)
2838 /* set vol=0 to output mixers */
2839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2842 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2843 /* set up input amps for analog loopback */
2844 /* Amp Indices: DAC = 0, mixer = 1 */
2845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2852 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2858 * 3-stack pin configuration:
2859 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2861 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2863 * preset connection lists of input pins
2864 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2866 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2867 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2868 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2871 * Set pin mode and muting
2873 /* set front pin widgets 0x14 for output */
2874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2875 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2876 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2877 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2878 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2879 /* Mic2 (as headphone out) for HP output */
2880 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2882 /* Line In pin widget for input */
2883 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2885 /* Line2 (as front mic) pin widget for input and vref at 80% */
2886 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2887 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2888 /* CD pin widget for input */
2889 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2895 * 5-stack pin configuration:
2896 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2897 * line-in/side = 0x1a, f-mic = 0x1b
2899 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2901 * preset connection lists of input pins
2902 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2904 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2905 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2908 * Set pin mode and muting
2910 /* set pin widgets 0x14-0x17 for output */
2911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2912 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2913 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2914 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2915 /* unmute pins for output (no gain on this amp) */
2916 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2918 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2919 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2921 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2922 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2924 /* Mic2 (as headphone out) for HP output */
2925 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2926 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2927 /* Line In pin widget for input */
2928 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2930 /* Line2 (as front mic) pin widget for input and vref at 80% */
2931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2932 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2933 /* CD pin widget for input */
2934 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2940 * W810 pin configuration:
2941 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2943 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2944 /* hphone/speaker input selector: front DAC */
2945 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2949 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2950 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2951 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2952 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2955 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2961 * Z71V pin configuration:
2962 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2964 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2965 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2966 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2968 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2971 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2972 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2973 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2979 * 6-stack pin configuration:
2980 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2981 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2983 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2984 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2990 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2991 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2992 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2995 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2996 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2997 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2998 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2999 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3000 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3001 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3002 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3003 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3009 * Uniwill pin configuration:
3010 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3013 static struct hda_verb alc880_uniwill_init_verbs[] = {
3014 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3018 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3020 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3022 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3023 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3028 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3029 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3031 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3032 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3033 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3034 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3035 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3036 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3037 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3038 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3039 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3041 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3042 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3049 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3051 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3052 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3055 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3057 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3058 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3059 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3064 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3067 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3068 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3069 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3070 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3074 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3075 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3080 static struct hda_verb alc880_beep_init_verbs[] = {
3081 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3085 /* auto-toggle front mic */
3086 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3088 unsigned int present;
3091 present = snd_hda_jack_detect(codec, 0x18);
3092 bits = present ? HDA_AMP_MUTE : 0;
3093 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3096 static void alc880_uniwill_setup(struct hda_codec *codec)
3098 struct alc_spec *spec = codec->spec;
3100 spec->autocfg.hp_pins[0] = 0x14;
3101 spec->autocfg.speaker_pins[0] = 0x15;
3102 spec->autocfg.speaker_pins[0] = 0x16;
3105 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3107 alc_automute_amp(codec);
3108 alc880_uniwill_mic_automute(codec);
3111 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3114 /* Looks like the unsol event is incompatible with the standard
3115 * definition. 4bit tag is placed at 28 bit!
3117 switch (res >> 28) {
3118 case ALC880_MIC_EVENT:
3119 alc880_uniwill_mic_automute(codec);
3122 alc_automute_amp_unsol_event(codec, res);
3127 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3129 struct alc_spec *spec = codec->spec;
3131 spec->autocfg.hp_pins[0] = 0x14;
3132 spec->autocfg.speaker_pins[0] = 0x15;
3135 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3137 unsigned int present;
3139 present = snd_hda_codec_read(codec, 0x21, 0,
3140 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3141 present &= HDA_AMP_VOLMASK;
3142 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3143 HDA_AMP_VOLMASK, present);
3144 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3145 HDA_AMP_VOLMASK, present);
3148 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3151 /* Looks like the unsol event is incompatible with the standard
3152 * definition. 4bit tag is placed at 28 bit!
3154 if ((res >> 28) == ALC880_DCVOL_EVENT)
3155 alc880_uniwill_p53_dcvol_automute(codec);
3157 alc_automute_amp_unsol_event(codec, res);
3161 * F1734 pin configuration:
3162 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3164 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3165 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3166 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3167 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3168 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3169 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3171 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3172 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3173 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3176 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3177 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3178 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3179 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3180 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3181 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3182 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3184 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3186 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3187 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3193 * ASUS pin configuration:
3194 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3196 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3197 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3198 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3199 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3200 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3202 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3203 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3204 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3205 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3206 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3208 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3211 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3212 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3213 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3214 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3215 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3219 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3224 /* Enable GPIO mask and set output */
3225 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3226 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3227 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3229 /* Clevo m520g init */
3230 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3231 /* headphone output */
3232 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3235 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3237 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3238 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3240 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3241 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3242 /* Mic1 (rear panel) */
3243 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3244 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3245 /* Mic2 (front panel) */
3246 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3247 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3249 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3251 /* change to EAPD mode */
3252 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3253 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3258 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3259 /* change to EAPD mode */
3260 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3261 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3263 /* Headphone output */
3264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3266 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3267 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3269 /* Line In pin widget for input */
3270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3271 /* CD pin widget for input */
3272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3273 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3276 /* change to EAPD mode */
3277 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3278 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3284 * LG m1 express dual
3287 * Rear Line-In/Out (blue): 0x14
3288 * Build-in Mic-In: 0x15
3290 * HP-Out (green): 0x1b
3291 * Mic-In/Out (red): 0x19
3295 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3296 static hda_nid_t alc880_lg_dac_nids[3] = {
3300 /* seems analog CD is not working */
3301 static struct hda_input_mux alc880_lg_capture_source = {
3306 { "Internal Mic", 0x6 },
3310 /* 2,4,6 channel modes */
3311 static struct hda_verb alc880_lg_ch2_init[] = {
3312 /* set line-in and mic-in to input */
3313 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3314 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3318 static struct hda_verb alc880_lg_ch4_init[] = {
3319 /* set line-in to out and mic-in to input */
3320 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3321 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3325 static struct hda_verb alc880_lg_ch6_init[] = {
3326 /* set line-in and mic-in to output */
3327 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3328 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3332 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3333 { 2, alc880_lg_ch2_init },
3334 { 4, alc880_lg_ch4_init },
3335 { 6, alc880_lg_ch6_init },
3338 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3339 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3340 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3341 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3342 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3343 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3344 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3345 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3351 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3352 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3355 .name = "Channel Mode",
3356 .info = alc_ch_mode_info,
3357 .get = alc_ch_mode_get,
3358 .put = alc_ch_mode_put,
3363 static struct hda_verb alc880_lg_init_verbs[] = {
3364 /* set capture source to mic-in */
3365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3366 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3368 /* mute all amp mixer inputs */
3369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3372 /* line-in to input */
3373 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3374 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3376 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3377 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3379 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3380 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3381 /* mic-in to input */
3382 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3383 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3384 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3386 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3390 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3394 /* toggle speaker-output according to the hp-jack state */
3395 static void alc880_lg_setup(struct hda_codec *codec)
3397 struct alc_spec *spec = codec->spec;
3399 spec->autocfg.hp_pins[0] = 0x1b;
3400 spec->autocfg.speaker_pins[0] = 0x17;
3409 * Built-in Mic-In: 0x19
3415 static struct hda_input_mux alc880_lg_lw_capture_source = {
3419 { "Internal Mic", 0x1 },
3424 #define alc880_lg_lw_modes alc880_threestack_modes
3426 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3427 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3428 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3429 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3430 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3431 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3432 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3433 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3434 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3435 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3436 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3439 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3440 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3442 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3443 .name = "Channel Mode",
3444 .info = alc_ch_mode_info,
3445 .get = alc_ch_mode_get,
3446 .put = alc_ch_mode_put,
3451 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3452 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3453 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3454 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3456 /* set capture source to mic-in */
3457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3458 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3459 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3465 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3466 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3467 /* mic-in to input */
3468 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3469 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3471 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3472 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3478 /* toggle speaker-output according to the hp-jack state */
3479 static void alc880_lg_lw_setup(struct hda_codec *codec)
3481 struct alc_spec *spec = codec->spec;
3483 spec->autocfg.hp_pins[0] = 0x1b;
3484 spec->autocfg.speaker_pins[0] = 0x14;
3487 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3488 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3489 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3492 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3493 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3497 static struct hda_input_mux alc880_medion_rim_capture_source = {
3501 { "Internal Mic", 0x1 },
3505 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3506 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3508 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3511 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3513 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3514 /* Mic2 (as headphone out) for HP output */
3515 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3516 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3517 /* Internal Speaker */
3518 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3519 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3521 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3522 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3524 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3528 /* toggle speaker-output according to the hp-jack state */
3529 static void alc880_medion_rim_automute(struct hda_codec *codec)
3531 struct alc_spec *spec = codec->spec;
3532 alc_automute_amp(codec);
3534 if (spec->jack_present)
3535 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3537 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3540 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3543 /* Looks like the unsol event is incompatible with the standard
3544 * definition. 4bit tag is placed at 28 bit!
3546 if ((res >> 28) == ALC880_HP_EVENT)
3547 alc880_medion_rim_automute(codec);
3550 static void alc880_medion_rim_setup(struct hda_codec *codec)
3552 struct alc_spec *spec = codec->spec;
3554 spec->autocfg.hp_pins[0] = 0x14;
3555 spec->autocfg.speaker_pins[0] = 0x1b;
3558 #ifdef CONFIG_SND_HDA_POWER_SAVE
3559 static struct hda_amp_list alc880_loopbacks[] = {
3560 { 0x0b, HDA_INPUT, 0 },
3561 { 0x0b, HDA_INPUT, 1 },
3562 { 0x0b, HDA_INPUT, 2 },
3563 { 0x0b, HDA_INPUT, 3 },
3564 { 0x0b, HDA_INPUT, 4 },
3568 static struct hda_amp_list alc880_lg_loopbacks[] = {
3569 { 0x0b, HDA_INPUT, 1 },
3570 { 0x0b, HDA_INPUT, 6 },
3571 { 0x0b, HDA_INPUT, 7 },
3580 static int alc_init(struct hda_codec *codec)
3582 struct alc_spec *spec = codec->spec;
3586 alc_auto_init_amp(codec, spec->init_amp);
3588 for (i = 0; i < spec->num_init_verbs; i++)
3589 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3591 if (spec->init_hook)
3592 spec->init_hook(codec);
3594 #ifdef CONFIG_SND_HDA_POWER_SAVE
3595 if (codec->patch_ops.check_power_status)
3596 codec->patch_ops.check_power_status(codec, 0x01);
3601 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3603 struct alc_spec *spec = codec->spec;
3605 if (spec->unsol_event)
3606 spec->unsol_event(codec, res);
3609 #ifdef CONFIG_SND_HDA_POWER_SAVE
3610 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3612 struct alc_spec *spec = codec->spec;
3613 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3618 * Analog playback callbacks
3620 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3621 struct hda_codec *codec,
3622 struct snd_pcm_substream *substream)
3624 struct alc_spec *spec = codec->spec;
3625 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3629 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3630 struct hda_codec *codec,
3631 unsigned int stream_tag,
3632 unsigned int format,
3633 struct snd_pcm_substream *substream)
3635 struct alc_spec *spec = codec->spec;
3636 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3637 stream_tag, format, substream);
3640 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3641 struct hda_codec *codec,
3642 struct snd_pcm_substream *substream)
3644 struct alc_spec *spec = codec->spec;
3645 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3651 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3652 struct hda_codec *codec,
3653 struct snd_pcm_substream *substream)
3655 struct alc_spec *spec = codec->spec;
3656 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3659 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3660 struct hda_codec *codec,
3661 unsigned int stream_tag,
3662 unsigned int format,
3663 struct snd_pcm_substream *substream)
3665 struct alc_spec *spec = codec->spec;
3666 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3667 stream_tag, format, substream);
3670 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3671 struct hda_codec *codec,
3672 struct snd_pcm_substream *substream)
3674 struct alc_spec *spec = codec->spec;
3675 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3678 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3679 struct hda_codec *codec,
3680 struct snd_pcm_substream *substream)
3682 struct alc_spec *spec = codec->spec;
3683 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3689 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3690 struct hda_codec *codec,
3691 unsigned int stream_tag,
3692 unsigned int format,
3693 struct snd_pcm_substream *substream)
3695 struct alc_spec *spec = codec->spec;
3697 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3698 stream_tag, 0, format);
3702 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3703 struct hda_codec *codec,
3704 struct snd_pcm_substream *substream)
3706 struct alc_spec *spec = codec->spec;
3708 snd_hda_codec_cleanup_stream(codec,
3709 spec->adc_nids[substream->number + 1]);
3713 /* analog capture with dynamic dual-adc changes */
3714 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3715 struct hda_codec *codec,
3716 unsigned int stream_tag,
3717 unsigned int format,
3718 struct snd_pcm_substream *substream)
3720 struct alc_spec *spec = codec->spec;
3721 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3722 spec->cur_adc_stream_tag = stream_tag;
3723 spec->cur_adc_format = format;
3724 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3728 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3729 struct hda_codec *codec,
3730 struct snd_pcm_substream *substream)
3732 struct alc_spec *spec = codec->spec;
3733 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3738 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3742 .nid = 0, /* fill later */
3744 .prepare = dualmic_capture_pcm_prepare,
3745 .cleanup = dualmic_capture_pcm_cleanup
3751 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3755 /* NID is set in alc_build_pcms */
3757 .open = alc880_playback_pcm_open,
3758 .prepare = alc880_playback_pcm_prepare,
3759 .cleanup = alc880_playback_pcm_cleanup
3763 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3767 /* NID is set in alc_build_pcms */
3770 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3774 /* NID is set in alc_build_pcms */
3777 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3778 .substreams = 2, /* can be overridden */
3781 /* NID is set in alc_build_pcms */
3783 .prepare = alc880_alt_capture_pcm_prepare,
3784 .cleanup = alc880_alt_capture_pcm_cleanup
3788 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3792 /* NID is set in alc_build_pcms */
3794 .open = alc880_dig_playback_pcm_open,
3795 .close = alc880_dig_playback_pcm_close,
3796 .prepare = alc880_dig_playback_pcm_prepare,
3797 .cleanup = alc880_dig_playback_pcm_cleanup
3801 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3805 /* NID is set in alc_build_pcms */
3808 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3809 static struct hda_pcm_stream alc_pcm_null_stream = {
3815 static int alc_build_pcms(struct hda_codec *codec)
3817 struct alc_spec *spec = codec->spec;
3818 struct hda_pcm *info = spec->pcm_rec;
3821 codec->num_pcms = 1;
3822 codec->pcm_info = info;
3824 if (spec->no_analog)
3827 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3828 "%s Analog", codec->chip_name);
3829 info->name = spec->stream_name_analog;
3831 if (spec->stream_analog_playback) {
3832 if (snd_BUG_ON(!spec->multiout.dac_nids))
3834 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3835 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3837 if (spec->stream_analog_capture) {
3838 if (snd_BUG_ON(!spec->adc_nids))
3840 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3841 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3844 if (spec->channel_mode) {
3845 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3846 for (i = 0; i < spec->num_channel_mode; i++) {
3847 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3848 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3854 /* SPDIF for stream index #1 */
3855 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3856 snprintf(spec->stream_name_digital,
3857 sizeof(spec->stream_name_digital),
3858 "%s Digital", codec->chip_name);
3859 codec->num_pcms = 2;
3860 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3861 info = spec->pcm_rec + 1;
3862 info->name = spec->stream_name_digital;
3863 if (spec->dig_out_type)
3864 info->pcm_type = spec->dig_out_type;
3866 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3867 if (spec->multiout.dig_out_nid &&
3868 spec->stream_digital_playback) {
3869 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3870 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3872 if (spec->dig_in_nid &&
3873 spec->stream_digital_capture) {
3874 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3875 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3877 /* FIXME: do we need this for all Realtek codec models? */
3878 codec->spdif_status_reset = 1;
3881 if (spec->no_analog)
3884 /* If the use of more than one ADC is requested for the current
3885 * model, configure a second analog capture-only PCM.
3887 /* Additional Analaog capture for index #2 */
3888 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3889 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3890 codec->num_pcms = 3;
3891 info = spec->pcm_rec + 2;
3892 info->name = spec->stream_name_analog;
3893 if (spec->alt_dac_nid) {
3894 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3895 *spec->stream_analog_alt_playback;
3896 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3899 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3900 alc_pcm_null_stream;
3901 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3903 if (spec->num_adc_nids > 1) {
3904 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3905 *spec->stream_analog_alt_capture;
3906 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3908 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3909 spec->num_adc_nids - 1;
3911 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3912 alc_pcm_null_stream;
3913 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3920 static inline void alc_shutup(struct hda_codec *codec)
3922 snd_hda_shutup_pins(codec);
3925 static void alc_free_kctls(struct hda_codec *codec)
3927 struct alc_spec *spec = codec->spec;
3929 if (spec->kctls.list) {
3930 struct snd_kcontrol_new *kctl = spec->kctls.list;
3932 for (i = 0; i < spec->kctls.used; i++)
3933 kfree(kctl[i].name);
3935 snd_array_free(&spec->kctls);
3938 static void alc_free(struct hda_codec *codec)
3940 struct alc_spec *spec = codec->spec;
3946 alc_free_kctls(codec);
3948 snd_hda_detach_beep_device(codec);
3951 #ifdef CONFIG_SND_HDA_POWER_SAVE
3952 static void alc_power_eapd(struct hda_codec *codec)
3954 /* We currently only handle front, HP */
3955 switch (codec->vendor_id) {
3957 set_eapd(codec, 0x0f, 0);
3958 set_eapd(codec, 0x10, 0);
3971 set_eapd(codec, 0x14, 0);
3972 set_eapd(codec, 0x15, 0);
3977 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3979 struct alc_spec *spec = codec->spec;
3981 if (spec && spec->power_hook)
3982 spec->power_hook(codec);
3987 #ifdef SND_HDA_NEEDS_RESUME
3988 static int alc_resume(struct hda_codec *codec)
3990 codec->patch_ops.init(codec);
3991 snd_hda_codec_resume_amp(codec);
3992 snd_hda_codec_resume_cache(codec);
3993 #ifdef CONFIG_SND_HDA_POWER_SAVE
3994 if (codec->patch_ops.check_power_status)
3995 codec->patch_ops.check_power_status(codec, 0x01);
4003 static struct hda_codec_ops alc_patch_ops = {
4004 .build_controls = alc_build_controls,
4005 .build_pcms = alc_build_pcms,
4008 .unsol_event = alc_unsol_event,
4009 #ifdef SND_HDA_NEEDS_RESUME
4010 .resume = alc_resume,
4012 #ifdef CONFIG_SND_HDA_POWER_SAVE
4013 .suspend = alc_suspend,
4014 .check_power_status = alc_check_power_status,
4016 .reboot_notify = alc_shutup,
4019 /* replace the codec chip_name with the given string */
4020 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4022 kfree(codec->chip_name);
4023 codec->chip_name = kstrdup(name, GFP_KERNEL);
4024 if (!codec->chip_name) {
4032 * Test configuration for debugging
4034 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4037 #ifdef CONFIG_SND_DEBUG
4038 static hda_nid_t alc880_test_dac_nids[4] = {
4039 0x02, 0x03, 0x04, 0x05
4042 static struct hda_input_mux alc880_test_capture_source = {
4051 { "Surround", 0x6 },
4055 static struct hda_channel_mode alc880_test_modes[4] = {
4062 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4063 struct snd_ctl_elem_info *uinfo)
4065 static char *texts[] = {
4066 "N/A", "Line Out", "HP Out",
4067 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4069 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4071 uinfo->value.enumerated.items = 8;
4072 if (uinfo->value.enumerated.item >= 8)
4073 uinfo->value.enumerated.item = 7;
4074 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4078 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4079 struct snd_ctl_elem_value *ucontrol)
4081 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4082 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4083 unsigned int pin_ctl, item = 0;
4085 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4086 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4087 if (pin_ctl & AC_PINCTL_OUT_EN) {
4088 if (pin_ctl & AC_PINCTL_HP_EN)
4092 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4093 switch (pin_ctl & AC_PINCTL_VREFEN) {
4094 case AC_PINCTL_VREF_HIZ: item = 3; break;
4095 case AC_PINCTL_VREF_50: item = 4; break;
4096 case AC_PINCTL_VREF_GRD: item = 5; break;
4097 case AC_PINCTL_VREF_80: item = 6; break;
4098 case AC_PINCTL_VREF_100: item = 7; break;
4101 ucontrol->value.enumerated.item[0] = item;
4105 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4106 struct snd_ctl_elem_value *ucontrol)
4108 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4109 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4110 static unsigned int ctls[] = {
4111 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4112 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4113 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4114 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4115 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4116 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4118 unsigned int old_ctl, new_ctl;
4120 old_ctl = snd_hda_codec_read(codec, nid, 0,
4121 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4122 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4123 if (old_ctl != new_ctl) {
4125 snd_hda_codec_write_cache(codec, nid, 0,
4126 AC_VERB_SET_PIN_WIDGET_CONTROL,
4128 val = ucontrol->value.enumerated.item[0] >= 3 ?
4130 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4137 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4138 struct snd_ctl_elem_info *uinfo)
4140 static char *texts[] = {
4141 "Front", "Surround", "CLFE", "Side"
4143 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4145 uinfo->value.enumerated.items = 4;
4146 if (uinfo->value.enumerated.item >= 4)
4147 uinfo->value.enumerated.item = 3;
4148 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4152 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4153 struct snd_ctl_elem_value *ucontrol)
4155 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4156 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4159 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4160 ucontrol->value.enumerated.item[0] = sel & 3;
4164 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4165 struct snd_ctl_elem_value *ucontrol)
4167 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4168 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4171 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4172 if (ucontrol->value.enumerated.item[0] != sel) {
4173 sel = ucontrol->value.enumerated.item[0] & 3;
4174 snd_hda_codec_write_cache(codec, nid, 0,
4175 AC_VERB_SET_CONNECT_SEL, sel);
4181 #define PIN_CTL_TEST(xname,nid) { \
4182 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4184 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4185 .info = alc_test_pin_ctl_info, \
4186 .get = alc_test_pin_ctl_get, \
4187 .put = alc_test_pin_ctl_put, \
4188 .private_value = nid \
4191 #define PIN_SRC_TEST(xname,nid) { \
4192 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4194 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4195 .info = alc_test_pin_src_info, \
4196 .get = alc_test_pin_src_get, \
4197 .put = alc_test_pin_src_put, \
4198 .private_value = nid \
4201 static struct snd_kcontrol_new alc880_test_mixer[] = {
4202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4203 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4204 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4205 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4207 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4208 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4209 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4210 PIN_CTL_TEST("Front Pin Mode", 0x14),
4211 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4212 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4213 PIN_CTL_TEST("Side Pin Mode", 0x17),
4214 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4215 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4216 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4217 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4218 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4219 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4220 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4221 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4222 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4223 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4224 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4225 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4226 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4227 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4228 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4229 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4234 .name = "Channel Mode",
4235 .info = alc_ch_mode_info,
4236 .get = alc_ch_mode_get,
4237 .put = alc_ch_mode_put,
4242 static struct hda_verb alc880_test_init_verbs[] = {
4243 /* Unmute inputs of 0x0c - 0x0f */
4244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4249 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4250 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4251 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4252 /* Vol output for 0x0c-0x0f */
4253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4256 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4257 /* Set output pins 0x14-0x17 */
4258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4261 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4262 /* Unmute output pins 0x14-0x17 */
4263 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4265 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4266 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4267 /* Set input pins 0x18-0x1c */
4268 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4269 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4273 /* Mute input pins 0x18-0x1b */
4274 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4275 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4276 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4277 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4280 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4281 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4282 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4283 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4284 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4285 /* Analog input/passthru */
4286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4298 static const char *alc880_models[ALC880_MODEL_LAST] = {
4299 [ALC880_3ST] = "3stack",
4300 [ALC880_TCL_S700] = "tcl",
4301 [ALC880_3ST_DIG] = "3stack-digout",
4302 [ALC880_CLEVO] = "clevo",
4303 [ALC880_5ST] = "5stack",
4304 [ALC880_5ST_DIG] = "5stack-digout",
4305 [ALC880_W810] = "w810",
4306 [ALC880_Z71V] = "z71v",
4307 [ALC880_6ST] = "6stack",
4308 [ALC880_6ST_DIG] = "6stack-digout",
4309 [ALC880_ASUS] = "asus",
4310 [ALC880_ASUS_W1V] = "asus-w1v",
4311 [ALC880_ASUS_DIG] = "asus-dig",
4312 [ALC880_ASUS_DIG2] = "asus-dig2",
4313 [ALC880_UNIWILL_DIG] = "uniwill",
4314 [ALC880_UNIWILL_P53] = "uniwill-p53",
4315 [ALC880_FUJITSU] = "fujitsu",
4316 [ALC880_F1734] = "F1734",
4318 [ALC880_LG_LW] = "lg-lw",
4319 [ALC880_MEDION_RIM] = "medion",
4320 #ifdef CONFIG_SND_DEBUG
4321 [ALC880_TEST] = "test",
4323 [ALC880_AUTO] = "auto",
4326 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4327 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4328 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4329 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4330 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4331 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4332 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4333 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4334 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4335 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4336 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4337 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4338 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4339 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4340 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4341 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4342 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4343 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4344 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4345 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4346 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4347 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4348 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4349 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4350 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4351 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4352 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4353 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4354 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4355 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4356 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4357 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4358 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4359 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4360 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4361 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4362 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4363 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4364 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4365 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4366 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4367 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4368 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4369 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4370 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4371 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4372 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4373 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4374 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4375 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4376 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4377 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4378 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4379 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4380 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4381 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4382 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4383 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4384 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4385 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4386 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4387 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4388 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4389 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4390 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4391 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4392 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4393 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4394 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4396 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4397 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4398 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4403 * ALC880 codec presets
4405 static struct alc_config_preset alc880_presets[] = {
4407 .mixers = { alc880_three_stack_mixer },
4408 .init_verbs = { alc880_volume_init_verbs,
4409 alc880_pin_3stack_init_verbs },
4410 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4411 .dac_nids = alc880_dac_nids,
4412 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4413 .channel_mode = alc880_threestack_modes,
4415 .input_mux = &alc880_capture_source,
4417 [ALC880_3ST_DIG] = {
4418 .mixers = { alc880_three_stack_mixer },
4419 .init_verbs = { alc880_volume_init_verbs,
4420 alc880_pin_3stack_init_verbs },
4421 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4422 .dac_nids = alc880_dac_nids,
4423 .dig_out_nid = ALC880_DIGOUT_NID,
4424 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4425 .channel_mode = alc880_threestack_modes,
4427 .input_mux = &alc880_capture_source,
4429 [ALC880_TCL_S700] = {
4430 .mixers = { alc880_tcl_s700_mixer },
4431 .init_verbs = { alc880_volume_init_verbs,
4432 alc880_pin_tcl_S700_init_verbs,
4433 alc880_gpio2_init_verbs },
4434 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4435 .dac_nids = alc880_dac_nids,
4436 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4437 .num_adc_nids = 1, /* single ADC */
4439 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4440 .channel_mode = alc880_2_jack_modes,
4441 .input_mux = &alc880_capture_source,
4444 .mixers = { alc880_three_stack_mixer,
4445 alc880_five_stack_mixer},
4446 .init_verbs = { alc880_volume_init_verbs,
4447 alc880_pin_5stack_init_verbs },
4448 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4449 .dac_nids = alc880_dac_nids,
4450 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4451 .channel_mode = alc880_fivestack_modes,
4452 .input_mux = &alc880_capture_source,
4454 [ALC880_5ST_DIG] = {
4455 .mixers = { alc880_three_stack_mixer,
4456 alc880_five_stack_mixer },
4457 .init_verbs = { alc880_volume_init_verbs,
4458 alc880_pin_5stack_init_verbs },
4459 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4460 .dac_nids = alc880_dac_nids,
4461 .dig_out_nid = ALC880_DIGOUT_NID,
4462 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4463 .channel_mode = alc880_fivestack_modes,
4464 .input_mux = &alc880_capture_source,
4467 .mixers = { alc880_six_stack_mixer },
4468 .init_verbs = { alc880_volume_init_verbs,
4469 alc880_pin_6stack_init_verbs },
4470 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4471 .dac_nids = alc880_6st_dac_nids,
4472 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4473 .channel_mode = alc880_sixstack_modes,
4474 .input_mux = &alc880_6stack_capture_source,
4476 [ALC880_6ST_DIG] = {
4477 .mixers = { alc880_six_stack_mixer },
4478 .init_verbs = { alc880_volume_init_verbs,
4479 alc880_pin_6stack_init_verbs },
4480 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4481 .dac_nids = alc880_6st_dac_nids,
4482 .dig_out_nid = ALC880_DIGOUT_NID,
4483 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4484 .channel_mode = alc880_sixstack_modes,
4485 .input_mux = &alc880_6stack_capture_source,
4488 .mixers = { alc880_w810_base_mixer },
4489 .init_verbs = { alc880_volume_init_verbs,
4490 alc880_pin_w810_init_verbs,
4491 alc880_gpio2_init_verbs },
4492 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4493 .dac_nids = alc880_w810_dac_nids,
4494 .dig_out_nid = ALC880_DIGOUT_NID,
4495 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4496 .channel_mode = alc880_w810_modes,
4497 .input_mux = &alc880_capture_source,
4500 .mixers = { alc880_z71v_mixer },
4501 .init_verbs = { alc880_volume_init_verbs,
4502 alc880_pin_z71v_init_verbs },
4503 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4504 .dac_nids = alc880_z71v_dac_nids,
4505 .dig_out_nid = ALC880_DIGOUT_NID,
4507 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4508 .channel_mode = alc880_2_jack_modes,
4509 .input_mux = &alc880_capture_source,
4512 .mixers = { alc880_f1734_mixer },
4513 .init_verbs = { alc880_volume_init_verbs,
4514 alc880_pin_f1734_init_verbs },
4515 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4516 .dac_nids = alc880_f1734_dac_nids,
4518 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4519 .channel_mode = alc880_2_jack_modes,
4520 .input_mux = &alc880_f1734_capture_source,
4521 .unsol_event = alc880_uniwill_p53_unsol_event,
4522 .setup = alc880_uniwill_p53_setup,
4523 .init_hook = alc_automute_amp,
4526 .mixers = { alc880_asus_mixer },
4527 .init_verbs = { alc880_volume_init_verbs,
4528 alc880_pin_asus_init_verbs,
4529 alc880_gpio1_init_verbs },
4530 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4531 .dac_nids = alc880_asus_dac_nids,
4532 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4533 .channel_mode = alc880_asus_modes,
4535 .input_mux = &alc880_capture_source,
4537 [ALC880_ASUS_DIG] = {
4538 .mixers = { alc880_asus_mixer },
4539 .init_verbs = { alc880_volume_init_verbs,
4540 alc880_pin_asus_init_verbs,
4541 alc880_gpio1_init_verbs },
4542 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4543 .dac_nids = alc880_asus_dac_nids,
4544 .dig_out_nid = ALC880_DIGOUT_NID,
4545 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4546 .channel_mode = alc880_asus_modes,
4548 .input_mux = &alc880_capture_source,
4550 [ALC880_ASUS_DIG2] = {
4551 .mixers = { alc880_asus_mixer },
4552 .init_verbs = { alc880_volume_init_verbs,
4553 alc880_pin_asus_init_verbs,
4554 alc880_gpio2_init_verbs }, /* use GPIO2 */
4555 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4556 .dac_nids = alc880_asus_dac_nids,
4557 .dig_out_nid = ALC880_DIGOUT_NID,
4558 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4559 .channel_mode = alc880_asus_modes,
4561 .input_mux = &alc880_capture_source,
4563 [ALC880_ASUS_W1V] = {
4564 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4565 .init_verbs = { alc880_volume_init_verbs,
4566 alc880_pin_asus_init_verbs,
4567 alc880_gpio1_init_verbs },
4568 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4569 .dac_nids = alc880_asus_dac_nids,
4570 .dig_out_nid = ALC880_DIGOUT_NID,
4571 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4572 .channel_mode = alc880_asus_modes,
4574 .input_mux = &alc880_capture_source,
4576 [ALC880_UNIWILL_DIG] = {
4577 .mixers = { alc880_asus_mixer },
4578 .init_verbs = { alc880_volume_init_verbs,
4579 alc880_pin_asus_init_verbs },
4580 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4581 .dac_nids = alc880_asus_dac_nids,
4582 .dig_out_nid = ALC880_DIGOUT_NID,
4583 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4584 .channel_mode = alc880_asus_modes,
4586 .input_mux = &alc880_capture_source,
4588 [ALC880_UNIWILL] = {
4589 .mixers = { alc880_uniwill_mixer },
4590 .init_verbs = { alc880_volume_init_verbs,
4591 alc880_uniwill_init_verbs },
4592 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4593 .dac_nids = alc880_asus_dac_nids,
4594 .dig_out_nid = ALC880_DIGOUT_NID,
4595 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4596 .channel_mode = alc880_threestack_modes,
4598 .input_mux = &alc880_capture_source,
4599 .unsol_event = alc880_uniwill_unsol_event,
4600 .setup = alc880_uniwill_setup,
4601 .init_hook = alc880_uniwill_init_hook,
4603 [ALC880_UNIWILL_P53] = {
4604 .mixers = { alc880_uniwill_p53_mixer },
4605 .init_verbs = { alc880_volume_init_verbs,
4606 alc880_uniwill_p53_init_verbs },
4607 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4608 .dac_nids = alc880_asus_dac_nids,
4609 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4610 .channel_mode = alc880_threestack_modes,
4611 .input_mux = &alc880_capture_source,
4612 .unsol_event = alc880_uniwill_p53_unsol_event,
4613 .setup = alc880_uniwill_p53_setup,
4614 .init_hook = alc_automute_amp,
4616 [ALC880_FUJITSU] = {
4617 .mixers = { alc880_fujitsu_mixer },
4618 .init_verbs = { alc880_volume_init_verbs,
4619 alc880_uniwill_p53_init_verbs,
4620 alc880_beep_init_verbs },
4621 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4622 .dac_nids = alc880_dac_nids,
4623 .dig_out_nid = ALC880_DIGOUT_NID,
4624 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4625 .channel_mode = alc880_2_jack_modes,
4626 .input_mux = &alc880_capture_source,
4627 .unsol_event = alc880_uniwill_p53_unsol_event,
4628 .setup = alc880_uniwill_p53_setup,
4629 .init_hook = alc_automute_amp,
4632 .mixers = { alc880_three_stack_mixer },
4633 .init_verbs = { alc880_volume_init_verbs,
4634 alc880_pin_clevo_init_verbs },
4635 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4636 .dac_nids = alc880_dac_nids,
4638 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4639 .channel_mode = alc880_threestack_modes,
4641 .input_mux = &alc880_capture_source,
4644 .mixers = { alc880_lg_mixer },
4645 .init_verbs = { alc880_volume_init_verbs,
4646 alc880_lg_init_verbs },
4647 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4648 .dac_nids = alc880_lg_dac_nids,
4649 .dig_out_nid = ALC880_DIGOUT_NID,
4650 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4651 .channel_mode = alc880_lg_ch_modes,
4653 .input_mux = &alc880_lg_capture_source,
4654 .unsol_event = alc_automute_amp_unsol_event,
4655 .setup = alc880_lg_setup,
4656 .init_hook = alc_automute_amp,
4657 #ifdef CONFIG_SND_HDA_POWER_SAVE
4658 .loopbacks = alc880_lg_loopbacks,
4662 .mixers = { alc880_lg_lw_mixer },
4663 .init_verbs = { alc880_volume_init_verbs,
4664 alc880_lg_lw_init_verbs },
4665 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4666 .dac_nids = alc880_dac_nids,
4667 .dig_out_nid = ALC880_DIGOUT_NID,
4668 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4669 .channel_mode = alc880_lg_lw_modes,
4670 .input_mux = &alc880_lg_lw_capture_source,
4671 .unsol_event = alc_automute_amp_unsol_event,
4672 .setup = alc880_lg_lw_setup,
4673 .init_hook = alc_automute_amp,
4675 [ALC880_MEDION_RIM] = {
4676 .mixers = { alc880_medion_rim_mixer },
4677 .init_verbs = { alc880_volume_init_verbs,
4678 alc880_medion_rim_init_verbs,
4679 alc_gpio2_init_verbs },
4680 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4681 .dac_nids = alc880_dac_nids,
4682 .dig_out_nid = ALC880_DIGOUT_NID,
4683 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4684 .channel_mode = alc880_2_jack_modes,
4685 .input_mux = &alc880_medion_rim_capture_source,
4686 .unsol_event = alc880_medion_rim_unsol_event,
4687 .setup = alc880_medion_rim_setup,
4688 .init_hook = alc880_medion_rim_automute,
4690 #ifdef CONFIG_SND_DEBUG
4692 .mixers = { alc880_test_mixer },
4693 .init_verbs = { alc880_test_init_verbs },
4694 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4695 .dac_nids = alc880_test_dac_nids,
4696 .dig_out_nid = ALC880_DIGOUT_NID,
4697 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4698 .channel_mode = alc880_test_modes,
4699 .input_mux = &alc880_test_capture_source,
4705 * Automatic parse of I/O pins from the BIOS configuration
4710 ALC_CTL_WIDGET_MUTE,
4713 static struct snd_kcontrol_new alc880_control_templates[] = {
4714 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4715 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4716 HDA_BIND_MUTE(NULL, 0, 0, 0),
4719 /* add dynamic controls */
4720 static int add_control(struct alc_spec *spec, int type, const char *name,
4723 struct snd_kcontrol_new *knew;
4725 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4726 knew = snd_array_new(&spec->kctls);
4729 *knew = alc880_control_templates[type];
4730 knew->name = kstrdup(name, GFP_KERNEL);
4733 if (get_amp_nid_(val))
4734 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4735 knew->private_value = val;
4739 static int add_control_with_pfx(struct alc_spec *spec, int type,
4740 const char *pfx, const char *dir,
4741 const char *sfx, unsigned long val)
4744 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4745 return add_control(spec, type, name, val);
4748 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4749 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4750 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4751 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4753 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4754 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4755 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4756 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4757 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4758 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4759 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4760 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4761 #define ALC880_PIN_CD_NID 0x1c
4763 /* fill in the dac_nids table from the parsed pin configuration */
4764 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4765 const struct auto_pin_cfg *cfg)
4771 memset(assigned, 0, sizeof(assigned));
4772 spec->multiout.dac_nids = spec->private_dac_nids;
4774 /* check the pins hardwired to audio widget */
4775 for (i = 0; i < cfg->line_outs; i++) {
4776 nid = cfg->line_out_pins[i];
4777 if (alc880_is_fixed_pin(nid)) {
4778 int idx = alc880_fixed_pin_idx(nid);
4779 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4783 /* left pins can be connect to any audio widget */
4784 for (i = 0; i < cfg->line_outs; i++) {
4785 nid = cfg->line_out_pins[i];
4786 if (alc880_is_fixed_pin(nid))
4788 /* search for an empty channel */
4789 for (j = 0; j < cfg->line_outs; j++) {
4791 spec->multiout.dac_nids[i] =
4792 alc880_idx_to_dac(j);
4798 spec->multiout.num_dacs = cfg->line_outs;
4802 /* add playback controls from the parsed DAC table */
4803 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4804 const struct auto_pin_cfg *cfg)
4806 static const char *chname[4] = {
4807 "Front", "Surround", NULL /*CLFE*/, "Side"
4812 for (i = 0; i < cfg->line_outs; i++) {
4813 if (!spec->multiout.dac_nids[i])
4815 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4818 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4820 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4824 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4826 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4830 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4832 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4836 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4838 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4844 if (cfg->line_outs == 1 &&
4845 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4849 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4850 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4854 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4855 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4864 /* add playback controls for speaker and HP outputs */
4865 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4874 if (alc880_is_fixed_pin(pin)) {
4875 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4876 /* specify the DAC as the extra output */
4877 if (!spec->multiout.hp_nid)
4878 spec->multiout.hp_nid = nid;
4880 spec->multiout.extra_out_nid[0] = nid;
4881 /* control HP volume/switch on the output mixer amp */
4882 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4883 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4884 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4887 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4888 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4891 } else if (alc880_is_multi_pin(pin)) {
4892 /* set manual connection */
4893 /* we have only a switch on HP-out PIN */
4894 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4895 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4902 /* create input playback/capture controls for the given pin */
4903 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4904 const char *ctlname,
4905 int idx, hda_nid_t mix_nid)
4909 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4910 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4913 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4914 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4920 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4922 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4923 return (pincap & AC_PINCAP_IN) != 0;
4926 /* create playback/capture controls for input pins */
4927 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4928 const struct auto_pin_cfg *cfg,
4930 hda_nid_t cap1, hda_nid_t cap2)
4932 struct alc_spec *spec = codec->spec;
4933 struct hda_input_mux *imux = &spec->private_imux[0];
4936 for (i = 0; i < AUTO_PIN_LAST; i++) {
4939 pin = cfg->input_pins[i];
4940 if (!alc_is_input_pin(codec, pin))
4944 idx = get_connection_index(codec, mixer, pin);
4946 err = new_analog_input(spec, pin,
4947 auto_pin_cfg_labels[i],
4956 idx = get_connection_index(codec, cap1, pin);
4957 if (idx < 0 && cap2)
4958 idx = get_connection_index(codec, cap2, pin);
4960 imux->items[imux->num_items].label =
4961 auto_pin_cfg_labels[i];
4962 imux->items[imux->num_items].index = idx;
4969 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4970 const struct auto_pin_cfg *cfg)
4972 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4975 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4976 unsigned int pin_type)
4978 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4981 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4985 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4986 hda_nid_t nid, int pin_type,
4989 alc_set_pin_output(codec, nid, pin_type);
4990 /* need the manual connection? */
4991 if (alc880_is_multi_pin(nid)) {
4992 struct alc_spec *spec = codec->spec;
4993 int idx = alc880_multi_pin_idx(nid);
4994 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4995 AC_VERB_SET_CONNECT_SEL,
4996 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5000 static int get_pin_type(int line_out_type)
5002 if (line_out_type == AUTO_PIN_HP_OUT)
5008 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5010 struct alc_spec *spec = codec->spec;
5013 for (i = 0; i < spec->autocfg.line_outs; i++) {
5014 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5015 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5016 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5020 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5022 struct alc_spec *spec = codec->spec;
5025 pin = spec->autocfg.speaker_pins[0];
5026 if (pin) /* connect to front */
5027 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5028 pin = spec->autocfg.hp_pins[0];
5029 if (pin) /* connect to front */
5030 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5033 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5035 struct alc_spec *spec = codec->spec;
5038 for (i = 0; i < AUTO_PIN_LAST; i++) {
5039 hda_nid_t nid = spec->autocfg.input_pins[i];
5040 if (alc_is_input_pin(codec, nid)) {
5041 alc_set_input_pin(codec, nid, i);
5042 if (nid != ALC880_PIN_CD_NID &&
5043 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5044 snd_hda_codec_write(codec, nid, 0,
5045 AC_VERB_SET_AMP_GAIN_MUTE,
5051 static void alc880_auto_init_input_src(struct hda_codec *codec)
5053 struct alc_spec *spec = codec->spec;
5056 for (c = 0; c < spec->num_adc_nids; c++) {
5057 unsigned int mux_idx;
5058 const struct hda_input_mux *imux;
5059 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5060 imux = &spec->input_mux[mux_idx];
5061 if (!imux->num_items && mux_idx > 0)
5062 imux = &spec->input_mux[0];
5064 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5065 AC_VERB_SET_CONNECT_SEL,
5066 imux->items[0].index);
5070 /* parse the BIOS configuration and set up the alc_spec */
5071 /* return 1 if successful, 0 if the proper config is not found,
5072 * or a negative error code
5074 static int alc880_parse_auto_config(struct hda_codec *codec)
5076 struct alc_spec *spec = codec->spec;
5078 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5080 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5084 if (!spec->autocfg.line_outs)
5085 return 0; /* can't find valid BIOS pin config */
5087 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5090 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5093 err = alc880_auto_create_extra_out(spec,
5094 spec->autocfg.speaker_pins[0],
5098 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5102 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5106 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5108 alc_auto_parse_digital(codec);
5110 if (spec->kctls.list)
5111 add_mixer(spec, spec->kctls.list);
5113 add_verb(spec, alc880_volume_init_verbs);
5115 spec->num_mux_defs = 1;
5116 spec->input_mux = &spec->private_imux[0];
5118 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5123 /* additional initialization for auto-configuration model */
5124 static void alc880_auto_init(struct hda_codec *codec)
5126 struct alc_spec *spec = codec->spec;
5127 alc880_auto_init_multi_out(codec);
5128 alc880_auto_init_extra_out(codec);
5129 alc880_auto_init_analog_input(codec);
5130 alc880_auto_init_input_src(codec);
5131 alc_auto_init_digital(codec);
5132 if (spec->unsol_event)
5133 alc_inithook(codec);
5136 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5137 * one of two digital mic pins, e.g. on ALC272
5139 static void fixup_automic_adc(struct hda_codec *codec)
5141 struct alc_spec *spec = codec->spec;
5144 for (i = 0; i < spec->num_adc_nids; i++) {
5145 hda_nid_t cap = spec->capsrc_nids ?
5146 spec->capsrc_nids[i] : spec->adc_nids[i];
5149 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5152 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5155 spec->int_mic.mux_idx = iidx;
5156 spec->ext_mic.mux_idx = eidx;
5157 if (spec->capsrc_nids)
5158 spec->capsrc_nids += i;
5159 spec->adc_nids += i;
5160 spec->num_adc_nids = 1;
5163 snd_printd(KERN_INFO "hda_codec: %s: "
5164 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5165 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5166 spec->auto_mic = 0; /* disable auto-mic to be sure */
5169 /* select or unmute the given capsrc route */
5170 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5173 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5174 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5177 snd_hda_codec_write_cache(codec, cap, 0,
5178 AC_VERB_SET_CONNECT_SEL, idx);
5182 /* set the default connection to that pin */
5183 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5185 struct alc_spec *spec = codec->spec;
5188 for (i = 0; i < spec->num_adc_nids; i++) {
5189 hda_nid_t cap = spec->capsrc_nids ?
5190 spec->capsrc_nids[i] : spec->adc_nids[i];
5193 idx = get_connection_index(codec, cap, pin);
5196 select_or_unmute_capsrc(codec, cap, idx);
5197 return i; /* return the found index */
5199 return -1; /* not found */
5202 /* choose the ADC/MUX containing the input pin and initialize the setup */
5203 static void fixup_single_adc(struct hda_codec *codec)
5205 struct alc_spec *spec = codec->spec;
5209 /* search for the input pin; there must be only one */
5210 for (i = 0; i < AUTO_PIN_LAST; i++) {
5211 if (spec->autocfg.input_pins[i]) {
5212 pin = spec->autocfg.input_pins[i];
5218 i = init_capsrc_for_pin(codec, pin);
5220 /* use only this ADC */
5221 if (spec->capsrc_nids)
5222 spec->capsrc_nids += i;
5223 spec->adc_nids += i;
5224 spec->num_adc_nids = 1;
5228 /* initialize dual adcs */
5229 static void fixup_dual_adc_switch(struct hda_codec *codec)
5231 struct alc_spec *spec = codec->spec;
5232 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5233 init_capsrc_for_pin(codec, spec->int_mic.pin);
5236 static void set_capture_mixer(struct hda_codec *codec)
5238 struct alc_spec *spec = codec->spec;
5239 static struct snd_kcontrol_new *caps[2][3] = {
5240 { alc_capture_mixer_nosrc1,
5241 alc_capture_mixer_nosrc2,
5242 alc_capture_mixer_nosrc3 },
5243 { alc_capture_mixer1,
5245 alc_capture_mixer3 },
5247 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5249 int num_adcs = spec->num_adc_nids;
5250 if (spec->dual_adc_switch)
5251 fixup_dual_adc_switch(codec);
5252 else if (spec->auto_mic)
5253 fixup_automic_adc(codec);
5254 else if (spec->input_mux) {
5255 if (spec->input_mux->num_items > 1)
5257 else if (spec->input_mux->num_items == 1)
5258 fixup_single_adc(codec);
5260 if (spec->dual_adc_switch)
5262 spec->cap_mixer = caps[mux][num_adcs - 1];
5266 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5267 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5270 struct alc_spec *spec = codec->spec;
5272 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5274 for (n = 0; n < num_nids; n++) {
5276 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5280 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5283 nconns = snd_hda_get_connections(codec, cap, conn,
5287 nconns = snd_hda_get_connections(codec, cap, conn,
5292 if (!fallback_adc) {
5296 for (i = 0; i < AUTO_PIN_LAST; i++) {
5297 hda_nid_t nid = spec->autocfg.input_pins[i];
5300 for (j = 0; j < nconns; j++) {
5307 if (i >= AUTO_PIN_LAST) {
5308 int num_adcs = spec->num_adc_nids;
5309 spec->private_adc_nids[num_adcs] = adc;
5310 spec->private_capsrc_nids[num_adcs] = cap;
5311 spec->num_adc_nids++;
5312 spec->adc_nids = spec->private_adc_nids;
5314 spec->capsrc_nids = spec->private_capsrc_nids;
5317 if (!spec->num_adc_nids) {
5318 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5319 " using fallback 0x%x\n",
5320 codec->chip_name, fallback_adc);
5321 spec->private_adc_nids[0] = fallback_adc;
5322 spec->adc_nids = spec->private_adc_nids;
5323 if (fallback_adc != fallback_cap) {
5324 spec->private_capsrc_nids[0] = fallback_cap;
5325 spec->capsrc_nids = spec->private_adc_nids;
5330 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5331 #define set_beep_amp(spec, nid, idx, dir) \
5332 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5334 static struct snd_pci_quirk beep_white_list[] = {
5335 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5336 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5340 static inline int has_cdefine_beep(struct hda_codec *codec)
5342 struct alc_spec *spec = codec->spec;
5343 const struct snd_pci_quirk *q;
5344 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5347 return spec->cdefine.enable_pcbeep;
5350 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5351 #define has_cdefine_beep(codec) 0
5355 * OK, here we have finally the patch for ALC880
5358 static int patch_alc880(struct hda_codec *codec)
5360 struct alc_spec *spec;
5364 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5370 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5373 if (board_config < 0) {
5374 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5376 board_config = ALC880_AUTO;
5379 if (board_config == ALC880_AUTO) {
5380 /* automatic parse from the BIOS config */
5381 err = alc880_parse_auto_config(codec);
5387 "hda_codec: Cannot set up configuration "
5388 "from BIOS. Using 3-stack mode...\n");
5389 board_config = ALC880_3ST;
5393 err = snd_hda_attach_beep_device(codec, 0x1);
5399 if (board_config != ALC880_AUTO)
5400 setup_preset(codec, &alc880_presets[board_config]);
5402 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5403 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5404 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5406 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5407 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5409 if (!spec->adc_nids && spec->input_mux) {
5410 /* check whether NID 0x07 is valid */
5411 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5413 wcap = get_wcaps_type(wcap);
5414 if (wcap != AC_WID_AUD_IN) {
5415 spec->adc_nids = alc880_adc_nids_alt;
5416 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5418 spec->adc_nids = alc880_adc_nids;
5419 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5422 set_capture_mixer(codec);
5423 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5425 spec->vmaster_nid = 0x0c;
5427 codec->patch_ops = alc_patch_ops;
5428 if (board_config == ALC880_AUTO)
5429 spec->init_hook = alc880_auto_init;
5430 #ifdef CONFIG_SND_HDA_POWER_SAVE
5431 if (!spec->loopback.amplist)
5432 spec->loopback.amplist = alc880_loopbacks;
5443 static hda_nid_t alc260_dac_nids[1] = {
5448 static hda_nid_t alc260_adc_nids[1] = {
5453 static hda_nid_t alc260_adc_nids_alt[1] = {
5458 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5459 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5461 static hda_nid_t alc260_dual_adc_nids[2] = {
5466 #define ALC260_DIGOUT_NID 0x03
5467 #define ALC260_DIGIN_NID 0x06
5469 static struct hda_input_mux alc260_capture_source = {
5473 { "Front Mic", 0x1 },
5479 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5480 * headphone jack and the internal CD lines since these are the only pins at
5481 * which audio can appear. For flexibility, also allow the option of
5482 * recording the mixer output on the second ADC (ADC0 doesn't have a
5483 * connection to the mixer output).
5485 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5489 { "Mic/Line", 0x0 },
5491 { "Headphone", 0x2 },
5497 { "Mic/Line", 0x0 },
5499 { "Headphone", 0x2 },
5506 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5507 * the Fujitsu S702x, but jacks are marked differently.
5509 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5516 { "Headphone", 0x5 },
5525 { "Headphone", 0x6 },
5531 /* Maxdata Favorit 100XS */
5532 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5536 { "Line/Mic", 0x0 },
5543 { "Line/Mic", 0x0 },
5551 * This is just place-holder, so there's something for alc_build_pcms to look
5552 * at when it calculates the maximum number of channels. ALC260 has no mixer
5553 * element which allows changing the channel mode, so the verb list is
5556 static struct hda_channel_mode alc260_modes[1] = {
5561 /* Mixer combinations
5563 * basic: base_output + input + pc_beep + capture
5564 * HP: base_output + input + capture_alt
5565 * HP_3013: hp_3013 + input + capture
5566 * fujitsu: fujitsu + capture
5567 * acer: acer + capture
5570 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5571 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5572 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5573 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5574 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5575 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5576 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5580 static struct snd_kcontrol_new alc260_input_mixer[] = {
5581 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5582 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5583 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5584 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5586 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5587 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5588 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5592 /* update HP, line and mono out pins according to the master switch */
5593 static void alc260_hp_master_update(struct hda_codec *codec,
5594 hda_nid_t hp, hda_nid_t line,
5597 struct alc_spec *spec = codec->spec;
5598 unsigned int val = spec->master_sw ? PIN_HP : 0;
5599 /* change HP and line-out pins */
5600 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5602 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5604 /* mono (speaker) depending on the HP jack sense */
5605 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5606 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5610 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5611 struct snd_ctl_elem_value *ucontrol)
5613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5614 struct alc_spec *spec = codec->spec;
5615 *ucontrol->value.integer.value = spec->master_sw;
5619 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5620 struct snd_ctl_elem_value *ucontrol)
5622 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5623 struct alc_spec *spec = codec->spec;
5624 int val = !!*ucontrol->value.integer.value;
5625 hda_nid_t hp, line, mono;
5627 if (val == spec->master_sw)
5629 spec->master_sw = val;
5630 hp = (kcontrol->private_value >> 16) & 0xff;
5631 line = (kcontrol->private_value >> 8) & 0xff;
5632 mono = kcontrol->private_value & 0xff;
5633 alc260_hp_master_update(codec, hp, line, mono);
5637 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5639 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5640 .name = "Master Playback Switch",
5641 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5642 .info = snd_ctl_boolean_mono_info,
5643 .get = alc260_hp_master_sw_get,
5644 .put = alc260_hp_master_sw_put,
5645 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5647 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5648 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5649 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5650 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5651 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5653 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5657 static struct hda_verb alc260_hp_unsol_verbs[] = {
5658 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5662 static void alc260_hp_automute(struct hda_codec *codec)
5664 struct alc_spec *spec = codec->spec;
5666 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5667 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5670 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5672 if ((res >> 26) == ALC880_HP_EVENT)
5673 alc260_hp_automute(codec);
5676 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5678 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5679 .name = "Master Playback Switch",
5680 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5681 .info = snd_ctl_boolean_mono_info,
5682 .get = alc260_hp_master_sw_get,
5683 .put = alc260_hp_master_sw_put,
5684 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5686 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5687 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5688 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5689 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5690 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5692 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5693 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5697 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5698 .ops = &snd_hda_bind_vol,
5700 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5701 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5702 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5707 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5708 .ops = &snd_hda_bind_sw,
5710 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5711 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5716 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5717 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5718 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5719 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5720 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5724 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5725 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5729 static void alc260_hp_3013_automute(struct hda_codec *codec)
5731 struct alc_spec *spec = codec->spec;
5733 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5734 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5737 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5740 if ((res >> 26) == ALC880_HP_EVENT)
5741 alc260_hp_3013_automute(codec);
5744 static void alc260_hp_3012_automute(struct hda_codec *codec)
5746 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5748 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5750 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5752 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5756 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5759 if ((res >> 26) == ALC880_HP_EVENT)
5760 alc260_hp_3012_automute(codec);
5763 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5764 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5766 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5767 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5768 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5769 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5770 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5771 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5772 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5773 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5774 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5775 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5776 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5780 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5781 * versions of the ALC260 don't act on requests to enable mic bias from NID
5782 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5783 * datasheet doesn't mention this restriction. At this stage it's not clear
5784 * whether this behaviour is intentional or is a hardware bug in chip
5785 * revisions available in early 2006. Therefore for now allow the
5786 * "Headphone Jack Mode" control to span all choices, but if it turns out
5787 * that the lack of mic bias for this NID is intentional we could change the
5788 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5790 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5791 * don't appear to make the mic bias available from the "line" jack, even
5792 * though the NID used for this jack (0x14) can supply it. The theory is
5793 * that perhaps Acer have included blocking capacitors between the ALC260
5794 * and the output jack. If this turns out to be the case for all such
5795 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5796 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5798 * The C20x Tablet series have a mono internal speaker which is controlled
5799 * via the chip's Mono sum widget and pin complex, so include the necessary
5800 * controls for such models. On models without a "mono speaker" the control
5801 * won't do anything.
5803 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5804 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5805 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5806 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5807 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5809 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5811 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5812 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5814 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5815 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5816 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5817 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5818 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5822 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5824 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5825 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5826 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5827 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5828 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5829 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5830 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5834 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5835 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5837 static struct snd_kcontrol_new alc260_will_mixer[] = {
5838 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5839 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5841 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5842 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5843 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5844 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5845 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5846 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5847 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5851 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5852 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5854 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5855 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5856 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5858 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5859 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5860 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5861 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5862 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5863 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5864 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5869 * initialization verbs
5871 static struct hda_verb alc260_init_verbs[] = {
5872 /* Line In pin widget for input */
5873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5874 /* CD pin widget for input */
5875 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5876 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5877 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5878 /* Mic2 (front panel) pin widget for input and vref at 80% */
5879 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5880 /* LINE-2 is used for line-out in rear */
5881 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5882 /* select line-out */
5883 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5885 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5887 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5889 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5890 /* mute capture amp left and right */
5891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5892 /* set connection select to line in (default select for this ADC) */
5893 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5894 /* mute capture amp left and right */
5895 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5896 /* set connection select to line in (default select for this ADC) */
5897 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5898 /* set vol=0 Line-Out mixer amp left and right */
5899 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5900 /* unmute pin widget amp left and right (no gain on this amp) */
5901 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5902 /* set vol=0 HP mixer amp left and right */
5903 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5904 /* unmute pin widget amp left and right (no gain on this amp) */
5905 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5906 /* set vol=0 Mono mixer amp left and right */
5907 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5908 /* unmute pin widget amp left and right (no gain on this amp) */
5909 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5910 /* unmute LINE-2 out pin */
5911 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5912 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5915 /* mute analog inputs */
5916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5921 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5922 /* mute Front out path */
5923 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5925 /* mute Headphone out path */
5926 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5927 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5928 /* mute Mono out path */
5929 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5930 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5934 #if 0 /* should be identical with alc260_init_verbs? */
5935 static struct hda_verb alc260_hp_init_verbs[] = {
5936 /* Headphone and output */
5937 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5939 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5940 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5941 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5942 /* Mic2 (front panel) pin widget for input and vref at 80% */
5943 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5944 /* Line In pin widget for input */
5945 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5946 /* Line-2 pin widget for output */
5947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5948 /* CD pin widget for input */
5949 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5950 /* unmute amp left and right */
5951 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5952 /* set connection select to line in (default select for this ADC) */
5953 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5954 /* unmute Line-Out mixer amp left and right (volume = 0) */
5955 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5956 /* mute pin widget amp left and right (no gain on this amp) */
5957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5958 /* unmute HP mixer amp left and right (volume = 0) */
5959 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5960 /* mute pin widget amp left and right (no gain on this amp) */
5961 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5962 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5965 /* mute analog inputs */
5966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5971 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5972 /* Unmute Front out path */
5973 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5975 /* Unmute Headphone out path */
5976 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5978 /* Unmute Mono out path */
5979 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5980 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5985 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5986 /* Line out and output */
5987 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5989 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5990 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5991 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5992 /* Mic2 (front panel) pin widget for input and vref at 80% */
5993 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5994 /* Line In pin widget for input */
5995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5996 /* Headphone pin widget for output */
5997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5998 /* CD pin widget for input */
5999 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6000 /* unmute amp left and right */
6001 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6002 /* set connection select to line in (default select for this ADC) */
6003 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6004 /* unmute Line-Out mixer amp left and right (volume = 0) */
6005 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6006 /* mute pin widget amp left and right (no gain on this amp) */
6007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6008 /* unmute HP mixer amp left and right (volume = 0) */
6009 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6010 /* mute pin widget amp left and right (no gain on this amp) */
6011 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6012 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6015 /* mute analog inputs */
6016 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6021 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6022 /* Unmute Front out path */
6023 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6025 /* Unmute Headphone out path */
6026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6028 /* Unmute Mono out path */
6029 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6030 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6034 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6035 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6036 * audio = 0x16, internal speaker = 0x10.
6038 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6039 /* Disable all GPIOs */
6040 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6041 /* Internal speaker is connected to headphone pin */
6042 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6043 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6044 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6045 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6046 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6047 /* Ensure all other unused pins are disabled and muted. */
6048 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6049 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6050 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6051 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6052 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6053 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6057 /* Disable digital (SPDIF) pins */
6058 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6059 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6061 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6062 * when acting as an output.
6064 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6066 /* Start with output sum widgets muted and their output gains at min */
6067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6073 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6074 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6077 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6078 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6079 /* Unmute Line1 pin widget output buffer since it starts as an output.
6080 * If the pin mode is changed by the user the pin mode control will
6081 * take care of enabling the pin's input/output buffers as needed.
6082 * Therefore there's no need to enable the input buffer at this
6085 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6086 /* Unmute input buffer of pin widget used for Line-in (no equiv
6089 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6091 /* Mute capture amp left and right */
6092 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6093 /* Set ADC connection select to match default mixer setting - line
6096 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6098 /* Do the same for the second ADC: mute capture input amp and
6099 * set ADC connection to line in (on mic1 pin)
6101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6102 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6104 /* Mute all inputs to mixer widget (even unconnected ones) */
6105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6117 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6118 * similar laptops (adapted from Fujitsu init verbs).
6120 static struct hda_verb alc260_acer_init_verbs[] = {
6121 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6122 * the headphone jack. Turn this on and rely on the standard mute
6123 * methods whenever the user wants to turn these outputs off.
6125 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6126 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6127 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6128 /* Internal speaker/Headphone jack is connected to Line-out pin */
6129 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6130 /* Internal microphone/Mic jack is connected to Mic1 pin */
6131 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6132 /* Line In jack is connected to Line1 pin */
6133 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6134 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6135 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6136 /* Ensure all other unused pins are disabled and muted. */
6137 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6138 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6139 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6140 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6143 /* Disable digital (SPDIF) pins */
6144 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6145 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6147 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6148 * bus when acting as outputs.
6150 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6151 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6153 /* Start with output sum widgets muted and their output gains at min */
6154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6155 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6159 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6161 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6162 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6164 /* Unmute Line-out pin widget amp left and right
6165 * (no equiv mixer ctrl)
6167 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6168 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6169 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6170 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6171 * inputs. If the pin mode is changed by the user the pin mode control
6172 * will take care of enabling the pin's input/output buffers as needed.
6173 * Therefore there's no need to enable the input buffer at this
6176 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6179 /* Mute capture amp left and right */
6180 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6181 /* Set ADC connection select to match default mixer setting - mic
6184 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6186 /* Do similar with the second ADC: mute capture input amp and
6187 * set ADC connection to mic to match ALSA's default state.
6189 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6190 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6192 /* Mute all inputs to mixer widget (even unconnected ones) */
6193 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6194 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6196 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6205 /* Initialisation sequence for Maxdata Favorit 100XS
6206 * (adapted from Acer init verbs).
6208 static struct hda_verb alc260_favorit100_init_verbs[] = {
6209 /* GPIO 0 enables the output jack.
6210 * Turn this on and rely on the standard mute
6211 * methods whenever the user wants to turn these outputs off.
6213 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6214 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6215 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6216 /* Line/Mic input jack is connected to Mic1 pin */
6217 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6218 /* Ensure all other unused pins are disabled and muted. */
6219 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6220 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6221 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6222 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6223 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6224 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6225 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6226 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6229 /* Disable digital (SPDIF) pins */
6230 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6231 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6233 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6234 * bus when acting as outputs.
6236 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6237 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6239 /* Start with output sum widgets muted and their output gains at min */
6240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6246 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6247 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6248 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6250 /* Unmute Line-out pin widget amp left and right
6251 * (no equiv mixer ctrl)
6253 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6254 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6255 * inputs. If the pin mode is changed by the user the pin mode control
6256 * will take care of enabling the pin's input/output buffers as needed.
6257 * Therefore there's no need to enable the input buffer at this
6260 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6262 /* Mute capture amp left and right */
6263 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6264 /* Set ADC connection select to match default mixer setting - mic
6267 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6269 /* Do similar with the second ADC: mute capture input amp and
6270 * set ADC connection to mic to match ALSA's default state.
6272 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6273 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6275 /* Mute all inputs to mixer widget (even unconnected ones) */
6276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6288 static struct hda_verb alc260_will_verbs[] = {
6289 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6290 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6291 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6292 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6293 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6294 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6298 static struct hda_verb alc260_replacer_672v_verbs[] = {
6299 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6300 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6301 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6303 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6304 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6305 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6307 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6311 /* toggle speaker-output according to the hp-jack state */
6312 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6314 unsigned int present;
6316 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6317 present = snd_hda_jack_detect(codec, 0x0f);
6319 snd_hda_codec_write_cache(codec, 0x01, 0,
6320 AC_VERB_SET_GPIO_DATA, 1);
6321 snd_hda_codec_write_cache(codec, 0x0f, 0,
6322 AC_VERB_SET_PIN_WIDGET_CONTROL,
6325 snd_hda_codec_write_cache(codec, 0x01, 0,
6326 AC_VERB_SET_GPIO_DATA, 0);
6327 snd_hda_codec_write_cache(codec, 0x0f, 0,
6328 AC_VERB_SET_PIN_WIDGET_CONTROL,
6333 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6336 if ((res >> 26) == ALC880_HP_EVENT)
6337 alc260_replacer_672v_automute(codec);
6340 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6341 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6342 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6343 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6344 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6345 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6347 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6348 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6349 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6350 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6354 /* Test configuration for debugging, modelled after the ALC880 test
6357 #ifdef CONFIG_SND_DEBUG
6358 static hda_nid_t alc260_test_dac_nids[1] = {
6361 static hda_nid_t alc260_test_adc_nids[2] = {
6364 /* For testing the ALC260, each input MUX needs its own definition since
6365 * the signal assignments are different. This assumes that the first ADC
6368 static struct hda_input_mux alc260_test_capture_sources[2] = {
6372 { "MIC1 pin", 0x0 },
6373 { "MIC2 pin", 0x1 },
6374 { "LINE1 pin", 0x2 },
6375 { "LINE2 pin", 0x3 },
6377 { "LINE-OUT pin", 0x5 },
6378 { "HP-OUT pin", 0x6 },
6384 { "MIC1 pin", 0x0 },
6385 { "MIC2 pin", 0x1 },
6386 { "LINE1 pin", 0x2 },
6387 { "LINE2 pin", 0x3 },
6390 { "LINE-OUT pin", 0x6 },
6391 { "HP-OUT pin", 0x7 },
6395 static struct snd_kcontrol_new alc260_test_mixer[] = {
6396 /* Output driver widgets */
6397 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6398 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6399 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6400 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6401 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6402 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6404 /* Modes for retasking pin widgets
6405 * Note: the ALC260 doesn't seem to act on requests to enable mic
6406 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6407 * mention this restriction. At this stage it's not clear whether
6408 * this behaviour is intentional or is a hardware bug in chip
6409 * revisions available at least up until early 2006. Therefore for
6410 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6411 * choices, but if it turns out that the lack of mic bias for these
6412 * NIDs is intentional we could change their modes from
6413 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6415 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6416 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6417 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6418 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6419 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6420 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6422 /* Loopback mixer controls */
6423 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6424 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6425 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6426 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6427 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6428 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6429 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6430 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6431 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6432 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6433 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6434 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6435 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6436 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6438 /* Controls for GPIO pins, assuming they are configured as outputs */
6439 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6440 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6441 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6442 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6444 /* Switches to allow the digital IO pins to be enabled. The datasheet
6445 * is ambigious as to which NID is which; testing on laptops which
6446 * make this output available should provide clarification.
6448 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6449 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6451 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6452 * this output to turn on an external amplifier.
6454 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6455 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6459 static struct hda_verb alc260_test_init_verbs[] = {
6460 /* Enable all GPIOs as outputs with an initial value of 0 */
6461 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6462 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6463 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6465 /* Enable retasking pins as output, initially without power amp */
6466 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6467 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6470 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6471 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6473 /* Disable digital (SPDIF) pins initially, but users can enable
6474 * them via a mixer switch. In the case of SPDIF-out, this initverb
6475 * payload also sets the generation to 0, output to be in "consumer"
6476 * PCM format, copyright asserted, no pre-emphasis and no validity
6479 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6480 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6482 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6483 * OUT1 sum bus when acting as an output.
6485 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6486 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6487 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6488 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6490 /* Start with output sum widgets muted and their output gains at min */
6491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6494 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6497 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6499 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6501 /* Unmute retasking pin widget output buffers since the default
6502 * state appears to be output. As the pin mode is changed by the
6503 * user the pin mode control will take care of enabling the pin's
6504 * input/output buffers as needed.
6506 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6510 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6511 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6512 /* Also unmute the mono-out pin widget */
6513 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6515 /* Mute capture amp left and right */
6516 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6517 /* Set ADC connection select to match default mixer setting (mic1
6520 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6522 /* Do the same for the second ADC: mute capture input amp and
6523 * set ADC connection to mic1 pin
6525 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6526 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6528 /* Mute all inputs to mixer widget (even unconnected ones) */
6529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6536 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6542 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6543 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6545 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6546 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6549 * for BIOS auto-configuration
6552 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6553 const char *pfx, int *vol_bits)
6556 unsigned long vol_val, sw_val;
6559 if (nid >= 0x0f && nid < 0x11) {
6560 nid_vol = nid - 0x7;
6561 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6562 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6563 } else if (nid == 0x11) {
6564 nid_vol = nid - 0x7;
6565 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6566 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6567 } else if (nid >= 0x12 && nid <= 0x15) {
6569 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6570 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6574 if (!(*vol_bits & (1 << nid_vol))) {
6575 /* first control for the volume widget */
6576 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6579 *vol_bits |= (1 << nid_vol);
6581 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6587 /* add playback controls from the parsed DAC table */
6588 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6589 const struct auto_pin_cfg *cfg)
6595 spec->multiout.num_dacs = 1;
6596 spec->multiout.dac_nids = spec->private_dac_nids;
6597 spec->multiout.dac_nids[0] = 0x02;
6599 nid = cfg->line_out_pins[0];
6602 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6604 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6608 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6613 nid = cfg->speaker_pins[0];
6615 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6620 nid = cfg->hp_pins[0];
6622 err = alc260_add_playback_controls(spec, nid, "Headphone",
6630 /* create playback/capture controls for input pins */
6631 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6632 const struct auto_pin_cfg *cfg)
6634 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6637 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6638 hda_nid_t nid, int pin_type,
6641 alc_set_pin_output(codec, nid, pin_type);
6642 /* need the manual connection? */
6644 int idx = nid - 0x12;
6645 snd_hda_codec_write(codec, idx + 0x0b, 0,
6646 AC_VERB_SET_CONNECT_SEL, sel_idx);
6650 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6652 struct alc_spec *spec = codec->spec;
6655 nid = spec->autocfg.line_out_pins[0];
6657 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6658 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6661 nid = spec->autocfg.speaker_pins[0];
6663 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6665 nid = spec->autocfg.hp_pins[0];
6667 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6670 #define ALC260_PIN_CD_NID 0x16
6671 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6673 struct alc_spec *spec = codec->spec;
6676 for (i = 0; i < AUTO_PIN_LAST; i++) {
6677 hda_nid_t nid = spec->autocfg.input_pins[i];
6679 alc_set_input_pin(codec, nid, i);
6680 if (nid != ALC260_PIN_CD_NID &&
6681 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6682 snd_hda_codec_write(codec, nid, 0,
6683 AC_VERB_SET_AMP_GAIN_MUTE,
6689 #define alc260_auto_init_input_src alc880_auto_init_input_src
6692 * generic initialization of ADC, input mixers and output mixers
6694 static struct hda_verb alc260_volume_init_verbs[] = {
6696 * Unmute ADC0-1 and set the default input to mic-in
6698 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6699 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6700 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6701 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6703 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6705 * Note: PASD motherboards uses the Line In 2 as the input for
6706 * front panel mic (mic 2)
6708 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6709 /* mute analog inputs */
6710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6717 * Set up output mixers (0x08 - 0x0a)
6719 /* set vol=0 to output mixers */
6720 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6721 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6722 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6723 /* set up input amps for analog loopback */
6724 /* Amp Indices: DAC = 0, mixer = 1 */
6725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6728 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6729 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6730 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6735 static int alc260_parse_auto_config(struct hda_codec *codec)
6737 struct alc_spec *spec = codec->spec;
6739 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6741 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6745 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6748 if (!spec->kctls.list)
6749 return 0; /* can't find valid BIOS pin config */
6750 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6754 spec->multiout.max_channels = 2;
6756 if (spec->autocfg.dig_outs)
6757 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6758 if (spec->kctls.list)
6759 add_mixer(spec, spec->kctls.list);
6761 add_verb(spec, alc260_volume_init_verbs);
6763 spec->num_mux_defs = 1;
6764 spec->input_mux = &spec->private_imux[0];
6766 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6771 /* additional initialization for auto-configuration model */
6772 static void alc260_auto_init(struct hda_codec *codec)
6774 struct alc_spec *spec = codec->spec;
6775 alc260_auto_init_multi_out(codec);
6776 alc260_auto_init_analog_input(codec);
6777 alc260_auto_init_input_src(codec);
6778 alc_auto_init_digital(codec);
6779 if (spec->unsol_event)
6780 alc_inithook(codec);
6783 #ifdef CONFIG_SND_HDA_POWER_SAVE
6784 static struct hda_amp_list alc260_loopbacks[] = {
6785 { 0x07, HDA_INPUT, 0 },
6786 { 0x07, HDA_INPUT, 1 },
6787 { 0x07, HDA_INPUT, 2 },
6788 { 0x07, HDA_INPUT, 3 },
6789 { 0x07, HDA_INPUT, 4 },
6795 * ALC260 configurations
6797 static const char *alc260_models[ALC260_MODEL_LAST] = {
6798 [ALC260_BASIC] = "basic",
6800 [ALC260_HP_3013] = "hp-3013",
6801 [ALC260_HP_DC7600] = "hp-dc7600",
6802 [ALC260_FUJITSU_S702X] = "fujitsu",
6803 [ALC260_ACER] = "acer",
6804 [ALC260_WILL] = "will",
6805 [ALC260_REPLACER_672V] = "replacer",
6806 [ALC260_FAVORIT100] = "favorit100",
6807 #ifdef CONFIG_SND_DEBUG
6808 [ALC260_TEST] = "test",
6810 [ALC260_AUTO] = "auto",
6813 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6814 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6815 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6816 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6817 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6818 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6819 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6820 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6821 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6822 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6823 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6824 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6825 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6826 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6827 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6828 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6829 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6830 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6831 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6832 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6833 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6837 static struct alc_config_preset alc260_presets[] = {
6839 .mixers = { alc260_base_output_mixer,
6840 alc260_input_mixer },
6841 .init_verbs = { alc260_init_verbs },
6842 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6843 .dac_nids = alc260_dac_nids,
6844 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6845 .adc_nids = alc260_dual_adc_nids,
6846 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6847 .channel_mode = alc260_modes,
6848 .input_mux = &alc260_capture_source,
6851 .mixers = { alc260_hp_output_mixer,
6852 alc260_input_mixer },
6853 .init_verbs = { alc260_init_verbs,
6854 alc260_hp_unsol_verbs },
6855 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6856 .dac_nids = alc260_dac_nids,
6857 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6858 .adc_nids = alc260_adc_nids_alt,
6859 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6860 .channel_mode = alc260_modes,
6861 .input_mux = &alc260_capture_source,
6862 .unsol_event = alc260_hp_unsol_event,
6863 .init_hook = alc260_hp_automute,
6865 [ALC260_HP_DC7600] = {
6866 .mixers = { alc260_hp_dc7600_mixer,
6867 alc260_input_mixer },
6868 .init_verbs = { alc260_init_verbs,
6869 alc260_hp_dc7600_verbs },
6870 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6871 .dac_nids = alc260_dac_nids,
6872 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6873 .adc_nids = alc260_adc_nids_alt,
6874 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6875 .channel_mode = alc260_modes,
6876 .input_mux = &alc260_capture_source,
6877 .unsol_event = alc260_hp_3012_unsol_event,
6878 .init_hook = alc260_hp_3012_automute,
6880 [ALC260_HP_3013] = {
6881 .mixers = { alc260_hp_3013_mixer,
6882 alc260_input_mixer },
6883 .init_verbs = { alc260_hp_3013_init_verbs,
6884 alc260_hp_3013_unsol_verbs },
6885 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6886 .dac_nids = alc260_dac_nids,
6887 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6888 .adc_nids = alc260_adc_nids_alt,
6889 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6890 .channel_mode = alc260_modes,
6891 .input_mux = &alc260_capture_source,
6892 .unsol_event = alc260_hp_3013_unsol_event,
6893 .init_hook = alc260_hp_3013_automute,
6895 [ALC260_FUJITSU_S702X] = {
6896 .mixers = { alc260_fujitsu_mixer },
6897 .init_verbs = { alc260_fujitsu_init_verbs },
6898 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6899 .dac_nids = alc260_dac_nids,
6900 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6901 .adc_nids = alc260_dual_adc_nids,
6902 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6903 .channel_mode = alc260_modes,
6904 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6905 .input_mux = alc260_fujitsu_capture_sources,
6908 .mixers = { alc260_acer_mixer },
6909 .init_verbs = { alc260_acer_init_verbs },
6910 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6911 .dac_nids = alc260_dac_nids,
6912 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6913 .adc_nids = alc260_dual_adc_nids,
6914 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6915 .channel_mode = alc260_modes,
6916 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6917 .input_mux = alc260_acer_capture_sources,
6919 [ALC260_FAVORIT100] = {
6920 .mixers = { alc260_favorit100_mixer },
6921 .init_verbs = { alc260_favorit100_init_verbs },
6922 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6923 .dac_nids = alc260_dac_nids,
6924 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6925 .adc_nids = alc260_dual_adc_nids,
6926 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6927 .channel_mode = alc260_modes,
6928 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6929 .input_mux = alc260_favorit100_capture_sources,
6932 .mixers = { alc260_will_mixer },
6933 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6934 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6935 .dac_nids = alc260_dac_nids,
6936 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6937 .adc_nids = alc260_adc_nids,
6938 .dig_out_nid = ALC260_DIGOUT_NID,
6939 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6940 .channel_mode = alc260_modes,
6941 .input_mux = &alc260_capture_source,
6943 [ALC260_REPLACER_672V] = {
6944 .mixers = { alc260_replacer_672v_mixer },
6945 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6946 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6947 .dac_nids = alc260_dac_nids,
6948 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6949 .adc_nids = alc260_adc_nids,
6950 .dig_out_nid = ALC260_DIGOUT_NID,
6951 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6952 .channel_mode = alc260_modes,
6953 .input_mux = &alc260_capture_source,
6954 .unsol_event = alc260_replacer_672v_unsol_event,
6955 .init_hook = alc260_replacer_672v_automute,
6957 #ifdef CONFIG_SND_DEBUG
6959 .mixers = { alc260_test_mixer },
6960 .init_verbs = { alc260_test_init_verbs },
6961 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6962 .dac_nids = alc260_test_dac_nids,
6963 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6964 .adc_nids = alc260_test_adc_nids,
6965 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6966 .channel_mode = alc260_modes,
6967 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6968 .input_mux = alc260_test_capture_sources,
6973 static int patch_alc260(struct hda_codec *codec)
6975 struct alc_spec *spec;
6976 int err, board_config;
6978 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6984 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6987 if (board_config < 0) {
6988 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6990 board_config = ALC260_AUTO;
6993 if (board_config == ALC260_AUTO) {
6994 /* automatic parse from the BIOS config */
6995 err = alc260_parse_auto_config(codec);
7001 "hda_codec: Cannot set up configuration "
7002 "from BIOS. Using base mode...\n");
7003 board_config = ALC260_BASIC;
7007 err = snd_hda_attach_beep_device(codec, 0x1);
7013 if (board_config != ALC260_AUTO)
7014 setup_preset(codec, &alc260_presets[board_config]);
7016 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7017 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7019 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7020 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7022 if (!spec->adc_nids && spec->input_mux) {
7023 /* check whether NID 0x04 is valid */
7024 unsigned int wcap = get_wcaps(codec, 0x04);
7025 wcap = get_wcaps_type(wcap);
7027 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7028 spec->adc_nids = alc260_adc_nids_alt;
7029 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7031 spec->adc_nids = alc260_adc_nids;
7032 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7035 set_capture_mixer(codec);
7036 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7038 spec->vmaster_nid = 0x08;
7040 codec->patch_ops = alc_patch_ops;
7041 if (board_config == ALC260_AUTO)
7042 spec->init_hook = alc260_auto_init;
7043 #ifdef CONFIG_SND_HDA_POWER_SAVE
7044 if (!spec->loopback.amplist)
7045 spec->loopback.amplist = alc260_loopbacks;
7053 * ALC882/883/885/888/889 support
7055 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7056 * configuration. Each pin widget can choose any input DACs and a mixer.
7057 * Each ADC is connected from a mixer of all inputs. This makes possible
7058 * 6-channel independent captures.
7060 * In addition, an independent DAC for the multi-playback (not used in this
7063 #define ALC882_DIGOUT_NID 0x06
7064 #define ALC882_DIGIN_NID 0x0a
7065 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7066 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7067 #define ALC1200_DIGOUT_NID 0x10
7070 static struct hda_channel_mode alc882_ch_modes[1] = {
7075 static hda_nid_t alc882_dac_nids[4] = {
7076 /* front, rear, clfe, rear_surr */
7077 0x02, 0x03, 0x04, 0x05
7079 #define alc883_dac_nids alc882_dac_nids
7082 #define alc882_adc_nids alc880_adc_nids
7083 #define alc882_adc_nids_alt alc880_adc_nids_alt
7084 #define alc883_adc_nids alc882_adc_nids_alt
7085 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7086 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7087 #define alc889_adc_nids alc880_adc_nids
7089 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7090 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7091 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7092 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7093 #define alc889_capsrc_nids alc882_capsrc_nids
7096 /* FIXME: should be a matrix-type input source selection */
7098 static struct hda_input_mux alc882_capture_source = {
7102 { "Front Mic", 0x1 },
7108 #define alc883_capture_source alc882_capture_source
7110 static struct hda_input_mux alc889_capture_source = {
7113 { "Front Mic", 0x0 },
7119 static struct hda_input_mux mb5_capture_source = {
7128 static struct hda_input_mux macmini3_capture_source = {
7136 static struct hda_input_mux alc883_3stack_6ch_intel = {
7140 { "Front Mic", 0x0 },
7146 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7154 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7164 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7172 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7176 { "Front Mic", 0x1 },
7181 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7189 static struct hda_input_mux alc889A_mb31_capture_source = {
7193 /* Front Mic (0x01) unused */
7195 /* Line 2 (0x03) unused */
7196 /* CD (0x04) unused? */
7200 static struct hda_input_mux alc889A_imac91_capture_source = {
7204 { "Line", 0x2 }, /* Not sure! */
7211 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7218 static struct hda_verb alc882_3ST_ch2_init[] = {
7219 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7220 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7221 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7222 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7229 static struct hda_verb alc882_3ST_ch4_init[] = {
7230 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7231 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7232 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7233 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7234 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7241 static struct hda_verb alc882_3ST_ch6_init[] = {
7242 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7243 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7244 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7245 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7246 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7247 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7251 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7252 { 2, alc882_3ST_ch2_init },
7253 { 4, alc882_3ST_ch4_init },
7254 { 6, alc882_3ST_ch6_init },
7257 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7262 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7263 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7264 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7265 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7266 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7267 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7274 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7275 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7276 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7277 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7278 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7279 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7280 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7287 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7288 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7289 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7290 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7291 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7292 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7293 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7294 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7298 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7299 { 2, alc883_3ST_ch2_clevo_init },
7300 { 4, alc883_3ST_ch4_clevo_init },
7301 { 6, alc883_3ST_ch6_clevo_init },
7308 static struct hda_verb alc882_sixstack_ch6_init[] = {
7309 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7310 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7311 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7312 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7319 static struct hda_verb alc882_sixstack_ch8_init[] = {
7320 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7321 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7322 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7323 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7327 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7328 { 6, alc882_sixstack_ch6_init },
7329 { 8, alc882_sixstack_ch8_init },
7333 /* Macbook Air 2,1 */
7335 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7340 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7346 static struct hda_verb alc885_mbp_ch2_init[] = {
7347 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7348 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7349 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7356 static struct hda_verb alc885_mbp_ch4_init[] = {
7357 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7358 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7359 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7360 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7361 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7365 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7366 { 2, alc885_mbp_ch2_init },
7367 { 4, alc885_mbp_ch4_init },
7372 * Speakers/Woofer/HP = Front
7375 static struct hda_verb alc885_mb5_ch2_init[] = {
7376 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7377 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7383 * Speakers/HP = Front
7387 static struct hda_verb alc885_mb5_ch6_init[] = {
7388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7390 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7394 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7395 { 2, alc885_mb5_ch2_init },
7396 { 6, alc885_mb5_ch6_init },
7399 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7404 static struct hda_verb alc883_4ST_ch2_init[] = {
7405 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7406 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7407 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7408 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7409 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7410 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7417 static struct hda_verb alc883_4ST_ch4_init[] = {
7418 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7419 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7420 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7421 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7422 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7423 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7424 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7431 static struct hda_verb alc883_4ST_ch6_init[] = {
7432 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7433 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7434 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7435 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7436 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7437 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7438 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7439 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7446 static struct hda_verb alc883_4ST_ch8_init[] = {
7447 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7448 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7449 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7450 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7451 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7452 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7453 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7454 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7455 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7459 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7460 { 2, alc883_4ST_ch2_init },
7461 { 4, alc883_4ST_ch4_init },
7462 { 6, alc883_4ST_ch6_init },
7463 { 8, alc883_4ST_ch8_init },
7470 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7471 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7472 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7473 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7481 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7482 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7483 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7484 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7485 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7486 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7493 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7494 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7495 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7496 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7497 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7498 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7499 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7503 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7504 { 2, alc883_3ST_ch2_intel_init },
7505 { 4, alc883_3ST_ch4_intel_init },
7506 { 6, alc883_3ST_ch6_intel_init },
7512 static struct hda_verb alc889_ch2_intel_init[] = {
7513 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7514 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7515 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7516 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7517 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7518 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7525 static struct hda_verb alc889_ch6_intel_init[] = {
7526 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7527 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7528 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7529 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7530 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7531 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7538 static struct hda_verb alc889_ch8_intel_init[] = {
7539 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7540 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7541 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7542 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7543 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7544 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7545 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7549 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7550 { 2, alc889_ch2_intel_init },
7551 { 6, alc889_ch6_intel_init },
7552 { 8, alc889_ch8_intel_init },
7558 static struct hda_verb alc883_sixstack_ch6_init[] = {
7559 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7560 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7561 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7562 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7569 static struct hda_verb alc883_sixstack_ch8_init[] = {
7570 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7571 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7572 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7573 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7577 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7578 { 6, alc883_sixstack_ch6_init },
7579 { 8, alc883_sixstack_ch8_init },
7583 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7584 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7586 static struct snd_kcontrol_new alc882_base_mixer[] = {
7587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7588 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7590 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7591 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7592 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7593 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7594 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7596 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7597 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7598 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7599 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7600 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7601 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7603 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7604 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7605 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7607 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7611 /* Macbook Air 2,1 same control for HP and internal Speaker */
7613 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7614 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7615 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7620 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7621 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7622 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7623 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7624 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7625 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7627 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7629 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7635 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7636 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7637 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7638 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7639 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7640 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7641 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7643 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7645 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7647 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7648 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7649 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7653 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7654 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7655 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7656 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7657 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7658 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7659 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7661 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7663 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7664 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7668 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7669 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7670 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7675 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7676 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7677 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7680 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7681 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7688 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7689 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7690 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7692 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7693 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7694 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7695 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7698 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7700 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7701 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7705 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7706 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7708 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7709 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7710 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7711 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7712 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7713 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7714 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7715 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7716 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7717 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7718 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7725 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7726 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7727 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7728 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7731 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7732 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7734 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7735 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7739 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7742 .name = "Channel Mode",
7743 .info = alc_ch_mode_info,
7744 .get = alc_ch_mode_get,
7745 .put = alc_ch_mode_put,
7750 static struct hda_verb alc882_base_init_verbs[] = {
7751 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7758 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7759 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7761 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7762 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7764 /* Front Pin: output 0 (0x0c) */
7765 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7766 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7767 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7768 /* Rear Pin: output 1 (0x0d) */
7769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7771 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7772 /* CLFE Pin: output 2 (0x0e) */
7773 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7775 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7776 /* Side Pin: output 3 (0x0f) */
7777 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7778 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7779 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7780 /* Mic (rear) pin: input vref at 80% */
7781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7783 /* Front Mic pin: input vref at 80% */
7784 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7785 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7786 /* Line In pin: input */
7787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7788 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7789 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7790 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7791 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7792 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7793 /* CD pin widget for input */
7794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7796 /* FIXME: use matrix-type input source selection */
7797 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7799 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7801 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7802 /* ADC2: mute amp left and right */
7803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7804 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7805 /* ADC3: mute amp left and right */
7806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7807 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7812 static struct hda_verb alc882_adc1_init_verbs[] = {
7813 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7814 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7815 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7818 /* ADC1: mute amp left and right */
7819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7820 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7824 static struct hda_verb alc882_eapd_verbs[] = {
7825 /* change to EAPD mode */
7826 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7827 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7831 static struct hda_verb alc889_eapd_verbs[] = {
7832 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7833 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7837 static struct hda_verb alc_hp15_unsol_verbs[] = {
7838 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7843 static struct hda_verb alc885_init_verbs[] = {
7844 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7849 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7851 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7854 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7855 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7857 /* Front HP Pin: output 0 (0x0c) */
7858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7861 /* Front Pin: output 0 (0x0c) */
7862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7864 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7865 /* Rear Pin: output 1 (0x0d) */
7866 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7867 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7868 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7869 /* CLFE Pin: output 2 (0x0e) */
7870 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7871 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7872 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7873 /* Side Pin: output 3 (0x0f) */
7874 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7875 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7876 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7877 /* Mic (rear) pin: input vref at 80% */
7878 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7879 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7880 /* Front Mic pin: input vref at 80% */
7881 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7883 /* Line In pin: input */
7884 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7887 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7889 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7894 /* ADC2: mute amp left and right */
7895 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7896 /* ADC3: mute amp left and right */
7897 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7902 static struct hda_verb alc885_init_input_verbs[] = {
7903 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7910 /* Unmute Selector 24h and set the default input to front mic */
7911 static struct hda_verb alc889_init_input_verbs[] = {
7912 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7913 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7918 #define alc883_init_verbs alc882_base_init_verbs
7921 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7922 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7923 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7925 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7926 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7927 /* FIXME: this looks suspicious...
7928 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7929 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7934 static struct hda_verb alc882_macpro_init_verbs[] = {
7935 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7939 /* Front Pin: output 0 (0x0c) */
7940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7941 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7943 /* Front Mic pin: input vref at 80% */
7944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7946 /* Speaker: output */
7947 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7948 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7949 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7950 /* Headphone output (output 0 - 0x0c) */
7951 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7952 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7953 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7955 /* FIXME: use matrix-type input source selection */
7956 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7957 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7958 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7959 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7960 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7961 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7972 /* ADC1: mute amp left and right */
7973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7974 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7975 /* ADC2: mute amp left and right */
7976 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7977 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7978 /* ADC3: mute amp left and right */
7979 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7980 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7986 static struct hda_verb alc885_mb5_init_verbs[] = {
7988 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7989 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7990 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7991 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7993 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7996 /* Surround mixer */
7997 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7999 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8001 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8005 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8006 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8008 /* Front Pin (0x0c) */
8009 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8010 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8011 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8012 /* LFE Pin (0x0e) */
8013 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8014 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8015 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8017 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8018 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8019 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8020 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8021 /* Front Mic pin: input vref at 80% */
8022 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8023 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8035 static struct hda_verb alc885_macmini3_init_verbs[] = {
8037 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8038 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8039 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8040 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8045 /* Surround mixer */
8046 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8051 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8052 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8054 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8055 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8056 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8057 /* Front Pin (0x0c) */
8058 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8060 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8061 /* LFE Pin (0x0e) */
8062 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8063 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8064 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8066 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8067 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8068 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8069 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8075 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8082 static struct hda_verb alc885_mba21_init_verbs[] = {
8083 /*Internal and HP Speaker Mixer*/
8084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8087 /*Internal Speaker Pin (0x0c)*/
8088 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8089 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8090 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8091 /* HP Pin: output 0 (0x0e) */
8092 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8094 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8095 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8096 /* Line in (is hp when jack connected)*/
8097 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8098 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8104 /* Macbook Pro rev3 */
8105 static struct hda_verb alc885_mbp3_init_verbs[] = {
8106 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8111 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8113 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8116 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8117 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8118 /* Front Pin: output 0 (0x0c) */
8119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8120 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8121 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8122 /* HP Pin: output 0 (0x0e) */
8123 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8125 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8126 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8127 /* Mic (rear) pin: input vref at 80% */
8128 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8129 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8130 /* Front Mic pin: input vref at 80% */
8131 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8132 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8133 /* Line In pin: use output 1 when in LineOut mode */
8134 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8135 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8136 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8138 /* FIXME: use matrix-type input source selection */
8139 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8140 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8141 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8143 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8144 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8149 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8155 /* ADC1: mute amp left and right */
8156 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8157 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8158 /* ADC2: mute amp left and right */
8159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8160 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8161 /* ADC3: mute amp left and right */
8162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8163 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8169 static struct hda_verb alc885_imac91_init_verbs[] = {
8170 /* Internal Speaker Pin (0x0c) */
8171 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8172 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8173 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8174 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8175 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8176 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8180 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8181 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8184 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8185 /* Front Mic pin: input vref at 80% */
8186 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8191 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8192 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8193 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8196 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8199 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8200 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8201 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8202 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8203 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8204 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8205 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8206 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8211 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8213 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8214 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8216 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8217 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8219 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8223 /* iMac 24 mixer. */
8224 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8225 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8226 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8230 /* iMac 24 init verbs. */
8231 static struct hda_verb alc885_imac24_init_verbs[] = {
8232 /* Internal speakers: output 0 (0x0c) */
8233 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8234 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8235 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8236 /* Internal speakers: output 0 (0x0c) */
8237 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8238 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8239 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8240 /* Headphone: output 0 (0x0c) */
8241 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8242 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8243 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8244 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8245 /* Front Mic: input vref at 80% */
8246 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8247 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8251 /* Toggle speaker-output according to the hp-jack state */
8252 static void alc885_imac24_setup(struct hda_codec *codec)
8254 struct alc_spec *spec = codec->spec;
8256 spec->autocfg.hp_pins[0] = 0x14;
8257 spec->autocfg.speaker_pins[0] = 0x18;
8258 spec->autocfg.speaker_pins[1] = 0x1a;
8261 #define alc885_mb5_setup alc885_imac24_setup
8262 #define alc885_macmini3_setup alc885_imac24_setup
8264 /* Macbook Air 2,1 */
8265 static void alc885_mba21_setup(struct hda_codec *codec)
8267 struct alc_spec *spec = codec->spec;
8269 spec->autocfg.hp_pins[0] = 0x14;
8270 spec->autocfg.speaker_pins[0] = 0x18;
8275 static void alc885_mbp3_setup(struct hda_codec *codec)
8277 struct alc_spec *spec = codec->spec;
8279 spec->autocfg.hp_pins[0] = 0x15;
8280 spec->autocfg.speaker_pins[0] = 0x14;
8283 static void alc885_imac91_setup(struct hda_codec *codec)
8285 struct alc_spec *spec = codec->spec;
8287 spec->autocfg.hp_pins[0] = 0x14;
8288 spec->autocfg.speaker_pins[0] = 0x18;
8289 spec->autocfg.speaker_pins[1] = 0x1a;
8292 static struct hda_verb alc882_targa_verbs[] = {
8293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8296 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8297 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8299 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8300 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8301 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8303 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8307 /* toggle speaker-output according to the hp-jack state */
8308 static void alc882_targa_automute(struct hda_codec *codec)
8310 struct alc_spec *spec = codec->spec;
8311 alc_automute_amp(codec);
8312 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8313 spec->jack_present ? 1 : 3);
8316 static void alc882_targa_setup(struct hda_codec *codec)
8318 struct alc_spec *spec = codec->spec;
8320 spec->autocfg.hp_pins[0] = 0x14;
8321 spec->autocfg.speaker_pins[0] = 0x1b;
8324 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8326 if ((res >> 26) == ALC880_HP_EVENT)
8327 alc882_targa_automute(codec);
8330 static struct hda_verb alc882_asus_a7j_verbs[] = {
8331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8336 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8338 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8340 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8342 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8343 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8344 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8348 static struct hda_verb alc882_asus_a7m_verbs[] = {
8349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8354 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8356 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8358 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8360 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8361 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8362 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8366 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8368 unsigned int gpiostate, gpiomask, gpiodir;
8370 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8371 AC_VERB_GET_GPIO_DATA, 0);
8374 gpiostate |= (1 << pin);
8376 gpiostate &= ~(1 << pin);
8378 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8379 AC_VERB_GET_GPIO_MASK, 0);
8380 gpiomask |= (1 << pin);
8382 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8383 AC_VERB_GET_GPIO_DIRECTION, 0);
8384 gpiodir |= (1 << pin);
8387 snd_hda_codec_write(codec, codec->afg, 0,
8388 AC_VERB_SET_GPIO_MASK, gpiomask);
8389 snd_hda_codec_write(codec, codec->afg, 0,
8390 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8394 snd_hda_codec_write(codec, codec->afg, 0,
8395 AC_VERB_SET_GPIO_DATA, gpiostate);
8398 /* set up GPIO at initialization */
8399 static void alc885_macpro_init_hook(struct hda_codec *codec)
8401 alc882_gpio_mute(codec, 0, 0);
8402 alc882_gpio_mute(codec, 1, 0);
8405 /* set up GPIO and update auto-muting at initialization */
8406 static void alc885_imac24_init_hook(struct hda_codec *codec)
8408 alc885_macpro_init_hook(codec);
8409 alc_automute_amp(codec);
8413 * generic initialization of ADC, input mixers and output mixers
8415 static struct hda_verb alc883_auto_init_verbs[] = {
8417 * Unmute ADC0-2 and set the default input to mic-in
8419 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8421 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8422 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8425 * Set up output mixers (0x0c - 0x0f)
8427 /* set vol=0 to output mixers */
8428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8429 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8431 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8432 /* set up input amps for analog loopback */
8433 /* Amp Indices: DAC = 0, mixer = 1 */
8434 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8435 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8436 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8437 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8438 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8439 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8441 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8442 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8443 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8445 /* FIXME: use matrix-type input source selection */
8446 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8454 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8455 static struct hda_verb alc889A_mb31_ch2_init[] = {
8456 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8457 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8458 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8459 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8463 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8464 static struct hda_verb alc889A_mb31_ch4_init[] = {
8465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8466 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8467 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8468 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8472 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8473 static struct hda_verb alc889A_mb31_ch5_init[] = {
8474 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8475 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8477 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8481 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8482 static struct hda_verb alc889A_mb31_ch6_init[] = {
8483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8484 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8485 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8486 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8490 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8491 { 2, alc889A_mb31_ch2_init },
8492 { 4, alc889A_mb31_ch4_init },
8493 { 5, alc889A_mb31_ch5_init },
8494 { 6, alc889A_mb31_ch6_init },
8497 static struct hda_verb alc883_medion_eapd_verbs[] = {
8498 /* eanable EAPD on medion laptop */
8499 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8500 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8504 #define alc883_base_mixer alc882_base_mixer
8506 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8507 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8508 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8509 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8510 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8511 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8512 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8513 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8515 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8517 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8518 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8519 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8523 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8524 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8525 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8526 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8527 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8528 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8529 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8531 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8532 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8533 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8537 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8538 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8539 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8540 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8541 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8542 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8543 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8544 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8545 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8546 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8547 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8551 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8552 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8553 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8554 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8555 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8556 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8557 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8558 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8559 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8560 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8562 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8563 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8568 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8569 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8570 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8571 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8572 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8573 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8574 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8575 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8576 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8577 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8578 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8579 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8580 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8581 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8583 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8585 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8586 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8587 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8591 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8592 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8593 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8594 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8595 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8596 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8598 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8599 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8600 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8601 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8602 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8603 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8604 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8605 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8607 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8609 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8610 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8611 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8615 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8617 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8618 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8619 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8620 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8622 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8623 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8624 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8625 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8626 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8628 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8629 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8630 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8631 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8633 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8634 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8635 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8639 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8640 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8641 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8642 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8643 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8644 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8645 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8646 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8647 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8648 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8649 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8650 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8651 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8652 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8654 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8656 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8657 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8658 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8662 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8666 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8667 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8668 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8669 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8670 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8671 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8672 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8673 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8674 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8678 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8683 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8684 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8685 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8686 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8687 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8688 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8689 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8693 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8694 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8695 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8699 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8700 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8701 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8702 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8703 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8704 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8708 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8709 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8710 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8711 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8712 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8715 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8720 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8721 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8722 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8723 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8724 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8725 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8726 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8727 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8728 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8729 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8733 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8734 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8735 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8736 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8737 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8738 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8739 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8740 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8741 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8742 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8746 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8747 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8748 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8749 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8750 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8751 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8752 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8756 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8757 /* Unmute front mixer */
8758 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8759 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8761 /* Set speaker pin to front mixer */
8762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8764 /* Init headphone pin */
8765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8766 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8767 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8768 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8773 /* toggle speaker-output according to the hp-jack state */
8774 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8776 struct alc_spec *spec = codec->spec;
8778 spec->autocfg.hp_pins[0] = 0x1a;
8779 spec->autocfg.speaker_pins[0] = 0x15;
8782 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8785 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8786 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8787 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8789 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8790 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8794 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8795 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8796 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8797 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8798 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8799 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8800 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8807 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8808 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8809 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8810 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8811 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8812 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8813 0x0d, 1, 0x0, HDA_OUTPUT),
8814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8817 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8818 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8824 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8827 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8828 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8832 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8834 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8835 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8836 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8837 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8838 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8840 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8841 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8842 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8843 /* Output switches */
8844 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8845 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8846 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8848 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8849 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8852 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8853 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8854 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8858 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8860 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8864 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8868 static struct hda_bind_ctls alc883_bind_cap_vol = {
8869 .ops = &snd_hda_bind_vol,
8871 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8872 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8877 static struct hda_bind_ctls alc883_bind_cap_switch = {
8878 .ops = &snd_hda_bind_sw,
8880 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8881 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8886 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8887 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8890 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8891 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8898 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8899 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8900 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8903 /* .name = "Capture Source", */
8904 .name = "Input Source",
8906 .info = alc_mux_enum_info,
8907 .get = alc_mux_enum_get,
8908 .put = alc_mux_enum_put,
8913 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8915 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8916 .name = "Channel Mode",
8917 .info = alc_ch_mode_info,
8918 .get = alc_ch_mode_get,
8919 .put = alc_ch_mode_put,
8924 /* toggle speaker-output according to the hp-jack state */
8925 static void alc883_mitac_setup(struct hda_codec *codec)
8927 struct alc_spec *spec = codec->spec;
8929 spec->autocfg.hp_pins[0] = 0x15;
8930 spec->autocfg.speaker_pins[0] = 0x14;
8931 spec->autocfg.speaker_pins[1] = 0x17;
8934 /* auto-toggle front mic */
8936 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8938 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8940 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8944 static struct hda_verb alc883_mitac_verbs[] = {
8946 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8949 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8950 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8952 /* enable unsolicited event */
8953 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8954 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8959 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8961 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8962 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8964 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8966 /* enable unsolicited event */
8968 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8969 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8975 static struct hda_verb alc883_clevo_m720_verbs[] = {
8977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8980 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8983 /* enable unsolicited event */
8984 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8985 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8990 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8992 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8995 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8998 /* enable unsolicited event */
8999 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9004 static struct hda_verb alc883_targa_verbs[] = {
9005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9008 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9009 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9011 /* Connect Line-Out side jack (SPDIF) to Side */
9012 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9014 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9015 /* Connect Mic jack to CLFE */
9016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9018 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9019 /* Connect Line-in jack to Surround */
9020 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9022 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9023 /* Connect HP out jack to Front */
9024 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9026 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9028 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9033 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9034 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9035 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9036 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9040 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9041 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9042 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9043 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9044 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9048 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9051 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9052 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9053 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9057 static struct hda_verb alc883_haier_w66_verbs[] = {
9058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9063 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9064 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9065 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9070 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9075 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9076 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9077 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9078 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9082 static struct hda_verb alc888_6st_dell_verbs[] = {
9083 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9087 static struct hda_verb alc883_vaiott_verbs[] = {
9089 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9092 /* enable unsolicited event */
9093 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9098 static void alc888_3st_hp_setup(struct hda_codec *codec)
9100 struct alc_spec *spec = codec->spec;
9102 spec->autocfg.hp_pins[0] = 0x1b;
9103 spec->autocfg.speaker_pins[0] = 0x14;
9104 spec->autocfg.speaker_pins[1] = 0x16;
9105 spec->autocfg.speaker_pins[2] = 0x18;
9108 static struct hda_verb alc888_3st_hp_verbs[] = {
9109 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9110 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9111 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9112 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9119 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9120 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9121 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9122 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9123 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9130 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9131 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9132 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9133 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9134 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9135 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9142 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9145 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9146 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9147 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9148 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9152 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9153 { 2, alc888_3st_hp_2ch_init },
9154 { 4, alc888_3st_hp_4ch_init },
9155 { 6, alc888_3st_hp_6ch_init },
9158 /* toggle front-jack and RCA according to the hp-jack state */
9159 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9161 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9163 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9164 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9165 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9166 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9169 /* toggle RCA according to the front-jack state */
9170 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9172 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9174 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9175 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9178 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9181 if ((res >> 26) == ALC880_HP_EVENT)
9182 alc888_lenovo_ms7195_front_automute(codec);
9183 if ((res >> 26) == ALC880_FRONT_EVENT)
9184 alc888_lenovo_ms7195_rca_automute(codec);
9187 static struct hda_verb alc883_medion_md2_verbs[] = {
9188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9193 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9197 /* toggle speaker-output according to the hp-jack state */
9198 static void alc883_medion_md2_setup(struct hda_codec *codec)
9200 struct alc_spec *spec = codec->spec;
9202 spec->autocfg.hp_pins[0] = 0x14;
9203 spec->autocfg.speaker_pins[0] = 0x15;
9206 /* toggle speaker-output according to the hp-jack state */
9207 #define alc883_targa_init_hook alc882_targa_init_hook
9208 #define alc883_targa_unsol_event alc882_targa_unsol_event
9210 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9212 unsigned int present;
9214 present = snd_hda_jack_detect(codec, 0x18);
9215 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9216 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9219 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9221 struct alc_spec *spec = codec->spec;
9223 spec->autocfg.hp_pins[0] = 0x15;
9224 spec->autocfg.speaker_pins[0] = 0x14;
9227 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9229 alc_automute_amp(codec);
9230 alc883_clevo_m720_mic_automute(codec);
9233 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9236 switch (res >> 26) {
9237 case ALC880_MIC_EVENT:
9238 alc883_clevo_m720_mic_automute(codec);
9241 alc_automute_amp_unsol_event(codec, res);
9246 /* toggle speaker-output according to the hp-jack state */
9247 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9249 struct alc_spec *spec = codec->spec;
9251 spec->autocfg.hp_pins[0] = 0x14;
9252 spec->autocfg.speaker_pins[0] = 0x15;
9255 static void alc883_haier_w66_setup(struct hda_codec *codec)
9257 struct alc_spec *spec = codec->spec;
9259 spec->autocfg.hp_pins[0] = 0x1b;
9260 spec->autocfg.speaker_pins[0] = 0x14;
9263 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9265 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9267 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9268 HDA_AMP_MUTE, bits);
9271 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9273 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9275 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9276 HDA_AMP_MUTE, bits);
9277 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9278 HDA_AMP_MUTE, bits);
9281 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9284 if ((res >> 26) == ALC880_HP_EVENT)
9285 alc883_lenovo_101e_all_automute(codec);
9286 if ((res >> 26) == ALC880_FRONT_EVENT)
9287 alc883_lenovo_101e_ispeaker_automute(codec);
9290 /* toggle speaker-output according to the hp-jack state */
9291 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9293 struct alc_spec *spec = codec->spec;
9295 spec->autocfg.hp_pins[0] = 0x14;
9296 spec->autocfg.speaker_pins[0] = 0x15;
9297 spec->autocfg.speaker_pins[1] = 0x16;
9300 static struct hda_verb alc883_acer_eapd_verbs[] = {
9301 /* HP Pin: output 0 (0x0c) */
9302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9304 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9305 /* Front Pin: output 0 (0x0c) */
9306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9308 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9309 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9310 /* eanable EAPD on medion laptop */
9311 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9312 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9313 /* enable unsolicited event */
9314 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9318 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9320 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9325 static void alc888_6st_dell_setup(struct hda_codec *codec)
9327 struct alc_spec *spec = codec->spec;
9329 spec->autocfg.hp_pins[0] = 0x1b;
9330 spec->autocfg.speaker_pins[0] = 0x14;
9331 spec->autocfg.speaker_pins[1] = 0x15;
9332 spec->autocfg.speaker_pins[2] = 0x16;
9333 spec->autocfg.speaker_pins[3] = 0x17;
9336 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9338 struct alc_spec *spec = codec->spec;
9340 spec->autocfg.hp_pins[0] = 0x1b;
9341 spec->autocfg.speaker_pins[0] = 0x14;
9342 spec->autocfg.speaker_pins[1] = 0x15;
9343 spec->autocfg.speaker_pins[2] = 0x16;
9344 spec->autocfg.speaker_pins[3] = 0x17;
9345 spec->autocfg.speaker_pins[4] = 0x1a;
9348 static void alc883_vaiott_setup(struct hda_codec *codec)
9350 struct alc_spec *spec = codec->spec;
9352 spec->autocfg.hp_pins[0] = 0x15;
9353 spec->autocfg.speaker_pins[0] = 0x14;
9354 spec->autocfg.speaker_pins[1] = 0x17;
9357 static struct hda_verb alc888_asus_m90v_verbs[] = {
9358 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9361 /* enable unsolicited event */
9362 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9363 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9367 static void alc883_mode2_setup(struct hda_codec *codec)
9369 struct alc_spec *spec = codec->spec;
9371 spec->autocfg.hp_pins[0] = 0x1b;
9372 spec->autocfg.speaker_pins[0] = 0x14;
9373 spec->autocfg.speaker_pins[1] = 0x15;
9374 spec->autocfg.speaker_pins[2] = 0x16;
9375 spec->ext_mic.pin = 0x18;
9376 spec->int_mic.pin = 0x19;
9377 spec->ext_mic.mux_idx = 0;
9378 spec->int_mic.mux_idx = 1;
9382 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9386 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9387 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9388 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9389 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9390 /* enable unsolicited event */
9391 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9395 static void alc883_eee1601_inithook(struct hda_codec *codec)
9397 struct alc_spec *spec = codec->spec;
9399 spec->autocfg.hp_pins[0] = 0x14;
9400 spec->autocfg.speaker_pins[0] = 0x1b;
9401 alc_automute_pin(codec);
9404 static struct hda_verb alc889A_mb31_verbs[] = {
9405 /* Init rear pin (used as headphone output) */
9406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9407 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9409 /* Init line pin (used as output in 4ch and 6ch mode) */
9410 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9411 /* Init line 2 pin (used as headphone out by default) */
9412 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9413 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9417 /* Mute speakers according to the headphone jack state */
9418 static void alc889A_mb31_automute(struct hda_codec *codec)
9420 unsigned int present;
9422 /* Mute only in 2ch or 4ch mode */
9423 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9425 present = snd_hda_jack_detect(codec, 0x15);
9426 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9427 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9428 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9429 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9433 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9435 if ((res >> 26) == ALC880_HP_EVENT)
9436 alc889A_mb31_automute(codec);
9440 #ifdef CONFIG_SND_HDA_POWER_SAVE
9441 #define alc882_loopbacks alc880_loopbacks
9444 /* pcm configuration: identical with ALC880 */
9445 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9446 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9447 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9448 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9450 static hda_nid_t alc883_slave_dig_outs[] = {
9451 ALC1200_DIGOUT_NID, 0,
9454 static hda_nid_t alc1200_slave_dig_outs[] = {
9455 ALC883_DIGOUT_NID, 0,
9459 * configuration and preset
9461 static const char *alc882_models[ALC882_MODEL_LAST] = {
9462 [ALC882_3ST_DIG] = "3stack-dig",
9463 [ALC882_6ST_DIG] = "6stack-dig",
9464 [ALC882_ARIMA] = "arima",
9465 [ALC882_W2JC] = "w2jc",
9466 [ALC882_TARGA] = "targa",
9467 [ALC882_ASUS_A7J] = "asus-a7j",
9468 [ALC882_ASUS_A7M] = "asus-a7m",
9469 [ALC885_MACPRO] = "macpro",
9470 [ALC885_MB5] = "mb5",
9471 [ALC885_MACMINI3] = "macmini3",
9472 [ALC885_MBA21] = "mba21",
9473 [ALC885_MBP3] = "mbp3",
9474 [ALC885_IMAC24] = "imac24",
9475 [ALC885_IMAC91] = "imac91",
9476 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9477 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9478 [ALC883_3ST_6ch] = "3stack-6ch",
9479 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9480 [ALC883_TARGA_DIG] = "targa-dig",
9481 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9482 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9483 [ALC883_ACER] = "acer",
9484 [ALC883_ACER_ASPIRE] = "acer-aspire",
9485 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9486 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9487 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9488 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9489 [ALC883_MEDION] = "medion",
9490 [ALC883_MEDION_MD2] = "medion-md2",
9491 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9492 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9493 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9494 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9495 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9496 [ALC888_LENOVO_SKY] = "lenovo-sky",
9497 [ALC883_HAIER_W66] = "haier-w66",
9498 [ALC888_3ST_HP] = "3stack-hp",
9499 [ALC888_6ST_DELL] = "6stack-dell",
9500 [ALC883_MITAC] = "mitac",
9501 [ALC883_CLEVO_M540R] = "clevo-m540r",
9502 [ALC883_CLEVO_M720] = "clevo-m720",
9503 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9504 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9505 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9506 [ALC889A_INTEL] = "intel-alc889a",
9507 [ALC889_INTEL] = "intel-x58",
9508 [ALC1200_ASUS_P5Q] = "asus-p5q",
9509 [ALC889A_MB31] = "mb31",
9510 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9511 [ALC882_AUTO] = "auto",
9514 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9515 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9517 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9518 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9519 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9520 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9521 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9522 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9523 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9524 ALC888_ACER_ASPIRE_4930G),
9525 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9526 ALC888_ACER_ASPIRE_4930G),
9527 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9528 ALC888_ACER_ASPIRE_8930G),
9529 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9530 ALC888_ACER_ASPIRE_8930G),
9531 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9532 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9533 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9534 ALC888_ACER_ASPIRE_6530G),
9535 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9536 ALC888_ACER_ASPIRE_6530G),
9537 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9538 ALC888_ACER_ASPIRE_7730G),
9539 /* default Acer -- disabled as it causes more problems.
9540 * model=auto should work fine now
9542 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9544 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9546 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9547 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9548 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9549 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9550 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9551 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9553 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9554 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9555 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9556 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9557 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9558 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9559 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9560 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9561 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9562 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9563 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9565 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9566 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9567 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9568 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9569 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9570 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9571 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9572 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9573 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9575 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9576 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9577 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9578 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9579 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9580 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9581 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9582 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9583 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9584 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9585 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9586 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9587 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9588 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9589 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9590 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9591 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9592 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9593 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9594 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9595 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9596 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9597 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9598 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9599 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9600 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9601 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9602 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9603 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9604 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9605 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9607 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9608 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9609 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9610 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9611 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9612 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9613 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9614 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9615 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9616 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9617 ALC883_FUJITSU_PI2515),
9618 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9619 ALC888_FUJITSU_XA3530),
9620 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9621 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9622 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9623 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9624 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9625 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9626 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9627 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9628 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9630 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9631 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9632 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9633 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9634 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9635 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9636 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9641 /* codec SSID table for Intel Mac */
9642 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9643 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9644 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9645 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9646 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9647 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9648 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9649 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9650 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9651 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9652 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9653 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9654 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9655 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9656 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9657 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9658 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9659 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9660 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9661 * so apparently no perfect solution yet
9663 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9664 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9665 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9669 static struct alc_config_preset alc882_presets[] = {
9670 [ALC882_3ST_DIG] = {
9671 .mixers = { alc882_base_mixer },
9672 .init_verbs = { alc882_base_init_verbs,
9673 alc882_adc1_init_verbs },
9674 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9675 .dac_nids = alc882_dac_nids,
9676 .dig_out_nid = ALC882_DIGOUT_NID,
9677 .dig_in_nid = ALC882_DIGIN_NID,
9678 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9679 .channel_mode = alc882_ch_modes,
9681 .input_mux = &alc882_capture_source,
9683 [ALC882_6ST_DIG] = {
9684 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9685 .init_verbs = { alc882_base_init_verbs,
9686 alc882_adc1_init_verbs },
9687 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9688 .dac_nids = alc882_dac_nids,
9689 .dig_out_nid = ALC882_DIGOUT_NID,
9690 .dig_in_nid = ALC882_DIGIN_NID,
9691 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9692 .channel_mode = alc882_sixstack_modes,
9693 .input_mux = &alc882_capture_source,
9696 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9697 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9698 alc882_eapd_verbs },
9699 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9700 .dac_nids = alc882_dac_nids,
9701 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9702 .channel_mode = alc882_sixstack_modes,
9703 .input_mux = &alc882_capture_source,
9706 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9707 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9708 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9709 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9710 .dac_nids = alc882_dac_nids,
9711 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9712 .channel_mode = alc880_threestack_modes,
9714 .input_mux = &alc882_capture_source,
9715 .dig_out_nid = ALC882_DIGOUT_NID,
9718 .mixers = { alc885_mba21_mixer },
9719 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9721 .dac_nids = alc882_dac_nids,
9722 .channel_mode = alc885_mba21_ch_modes,
9723 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9724 .input_mux = &alc882_capture_source,
9725 .unsol_event = alc_automute_amp_unsol_event,
9726 .setup = alc885_mba21_setup,
9727 .init_hook = alc_automute_amp,
9730 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9731 .init_verbs = { alc885_mbp3_init_verbs,
9732 alc880_gpio1_init_verbs },
9734 .dac_nids = alc882_dac_nids,
9736 .channel_mode = alc885_mbp_4ch_modes,
9737 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9738 .input_mux = &alc882_capture_source,
9739 .dig_out_nid = ALC882_DIGOUT_NID,
9740 .dig_in_nid = ALC882_DIGIN_NID,
9741 .unsol_event = alc_automute_amp_unsol_event,
9742 .setup = alc885_mbp3_setup,
9743 .init_hook = alc_automute_amp,
9746 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9747 .init_verbs = { alc885_mb5_init_verbs,
9748 alc880_gpio1_init_verbs },
9749 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9750 .dac_nids = alc882_dac_nids,
9751 .channel_mode = alc885_mb5_6ch_modes,
9752 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9753 .input_mux = &mb5_capture_source,
9754 .dig_out_nid = ALC882_DIGOUT_NID,
9755 .dig_in_nid = ALC882_DIGIN_NID,
9756 .unsol_event = alc_automute_amp_unsol_event,
9757 .setup = alc885_mb5_setup,
9758 .init_hook = alc_automute_amp,
9760 [ALC885_MACMINI3] = {
9761 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9762 .init_verbs = { alc885_macmini3_init_verbs,
9763 alc880_gpio1_init_verbs },
9764 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9765 .dac_nids = alc882_dac_nids,
9766 .channel_mode = alc885_macmini3_6ch_modes,
9767 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9768 .input_mux = &macmini3_capture_source,
9769 .dig_out_nid = ALC882_DIGOUT_NID,
9770 .dig_in_nid = ALC882_DIGIN_NID,
9771 .unsol_event = alc_automute_amp_unsol_event,
9772 .setup = alc885_macmini3_setup,
9773 .init_hook = alc_automute_amp,
9776 .mixers = { alc882_macpro_mixer },
9777 .init_verbs = { alc882_macpro_init_verbs },
9778 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9779 .dac_nids = alc882_dac_nids,
9780 .dig_out_nid = ALC882_DIGOUT_NID,
9781 .dig_in_nid = ALC882_DIGIN_NID,
9782 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9783 .channel_mode = alc882_ch_modes,
9784 .input_mux = &alc882_capture_source,
9785 .init_hook = alc885_macpro_init_hook,
9788 .mixers = { alc885_imac24_mixer },
9789 .init_verbs = { alc885_imac24_init_verbs },
9790 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9791 .dac_nids = alc882_dac_nids,
9792 .dig_out_nid = ALC882_DIGOUT_NID,
9793 .dig_in_nid = ALC882_DIGIN_NID,
9794 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9795 .channel_mode = alc882_ch_modes,
9796 .input_mux = &alc882_capture_source,
9797 .unsol_event = alc_automute_amp_unsol_event,
9798 .setup = alc885_imac24_setup,
9799 .init_hook = alc885_imac24_init_hook,
9802 .mixers = {alc885_imac91_mixer},
9803 .init_verbs = { alc885_imac91_init_verbs,
9804 alc880_gpio1_init_verbs },
9805 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9806 .dac_nids = alc882_dac_nids,
9807 .channel_mode = alc885_mba21_ch_modes,
9808 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9809 .input_mux = &alc889A_imac91_capture_source,
9810 .dig_out_nid = ALC882_DIGOUT_NID,
9811 .dig_in_nid = ALC882_DIGIN_NID,
9812 .unsol_event = alc_automute_amp_unsol_event,
9813 .setup = alc885_imac91_setup,
9814 .init_hook = alc_automute_amp,
9817 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9818 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9819 alc880_gpio3_init_verbs, alc882_targa_verbs},
9820 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9821 .dac_nids = alc882_dac_nids,
9822 .dig_out_nid = ALC882_DIGOUT_NID,
9823 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9824 .adc_nids = alc882_adc_nids,
9825 .capsrc_nids = alc882_capsrc_nids,
9826 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9827 .channel_mode = alc882_3ST_6ch_modes,
9829 .input_mux = &alc882_capture_source,
9830 .unsol_event = alc882_targa_unsol_event,
9831 .setup = alc882_targa_setup,
9832 .init_hook = alc882_targa_automute,
9834 [ALC882_ASUS_A7J] = {
9835 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9836 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9837 alc882_asus_a7j_verbs},
9838 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9839 .dac_nids = alc882_dac_nids,
9840 .dig_out_nid = ALC882_DIGOUT_NID,
9841 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9842 .adc_nids = alc882_adc_nids,
9843 .capsrc_nids = alc882_capsrc_nids,
9844 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9845 .channel_mode = alc882_3ST_6ch_modes,
9847 .input_mux = &alc882_capture_source,
9849 [ALC882_ASUS_A7M] = {
9850 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9851 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9852 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9853 alc882_asus_a7m_verbs },
9854 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9855 .dac_nids = alc882_dac_nids,
9856 .dig_out_nid = ALC882_DIGOUT_NID,
9857 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9858 .channel_mode = alc880_threestack_modes,
9860 .input_mux = &alc882_capture_source,
9862 [ALC883_3ST_2ch_DIG] = {
9863 .mixers = { alc883_3ST_2ch_mixer },
9864 .init_verbs = { alc883_init_verbs },
9865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9866 .dac_nids = alc883_dac_nids,
9867 .dig_out_nid = ALC883_DIGOUT_NID,
9868 .dig_in_nid = ALC883_DIGIN_NID,
9869 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9870 .channel_mode = alc883_3ST_2ch_modes,
9871 .input_mux = &alc883_capture_source,
9873 [ALC883_3ST_6ch_DIG] = {
9874 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9875 .init_verbs = { alc883_init_verbs },
9876 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9877 .dac_nids = alc883_dac_nids,
9878 .dig_out_nid = ALC883_DIGOUT_NID,
9879 .dig_in_nid = ALC883_DIGIN_NID,
9880 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9881 .channel_mode = alc883_3ST_6ch_modes,
9883 .input_mux = &alc883_capture_source,
9885 [ALC883_3ST_6ch] = {
9886 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9887 .init_verbs = { alc883_init_verbs },
9888 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9889 .dac_nids = alc883_dac_nids,
9890 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9891 .channel_mode = alc883_3ST_6ch_modes,
9893 .input_mux = &alc883_capture_source,
9895 [ALC883_3ST_6ch_INTEL] = {
9896 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9897 .init_verbs = { alc883_init_verbs },
9898 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9899 .dac_nids = alc883_dac_nids,
9900 .dig_out_nid = ALC883_DIGOUT_NID,
9901 .dig_in_nid = ALC883_DIGIN_NID,
9902 .slave_dig_outs = alc883_slave_dig_outs,
9903 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9904 .channel_mode = alc883_3ST_6ch_intel_modes,
9906 .input_mux = &alc883_3stack_6ch_intel,
9909 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9910 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9911 alc_hp15_unsol_verbs },
9912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9913 .dac_nids = alc883_dac_nids,
9914 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9915 .adc_nids = alc889_adc_nids,
9916 .dig_out_nid = ALC883_DIGOUT_NID,
9917 .dig_in_nid = ALC883_DIGIN_NID,
9918 .slave_dig_outs = alc883_slave_dig_outs,
9919 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9920 .channel_mode = alc889_8ch_intel_modes,
9921 .capsrc_nids = alc889_capsrc_nids,
9922 .input_mux = &alc889_capture_source,
9923 .setup = alc889_automute_setup,
9924 .init_hook = alc_automute_amp,
9925 .unsol_event = alc_automute_amp_unsol_event,
9929 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9930 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9931 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9932 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9933 .dac_nids = alc883_dac_nids,
9934 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9935 .adc_nids = alc889_adc_nids,
9936 .dig_out_nid = ALC883_DIGOUT_NID,
9937 .dig_in_nid = ALC883_DIGIN_NID,
9938 .slave_dig_outs = alc883_slave_dig_outs,
9939 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9940 .channel_mode = alc889_8ch_intel_modes,
9941 .capsrc_nids = alc889_capsrc_nids,
9942 .input_mux = &alc889_capture_source,
9943 .setup = alc889_automute_setup,
9944 .init_hook = alc889_intel_init_hook,
9945 .unsol_event = alc_automute_amp_unsol_event,
9948 [ALC883_6ST_DIG] = {
9949 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9950 .init_verbs = { alc883_init_verbs },
9951 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9952 .dac_nids = alc883_dac_nids,
9953 .dig_out_nid = ALC883_DIGOUT_NID,
9954 .dig_in_nid = ALC883_DIGIN_NID,
9955 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9956 .channel_mode = alc883_sixstack_modes,
9957 .input_mux = &alc883_capture_source,
9959 [ALC883_TARGA_DIG] = {
9960 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9961 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9962 alc883_targa_verbs},
9963 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9964 .dac_nids = alc883_dac_nids,
9965 .dig_out_nid = ALC883_DIGOUT_NID,
9966 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9967 .channel_mode = alc883_3ST_6ch_modes,
9969 .input_mux = &alc883_capture_source,
9970 .unsol_event = alc883_targa_unsol_event,
9971 .setup = alc882_targa_setup,
9972 .init_hook = alc882_targa_automute,
9974 [ALC883_TARGA_2ch_DIG] = {
9975 .mixers = { alc883_targa_2ch_mixer},
9976 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9977 alc883_targa_verbs},
9978 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9979 .dac_nids = alc883_dac_nids,
9980 .adc_nids = alc883_adc_nids_alt,
9981 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9982 .capsrc_nids = alc883_capsrc_nids,
9983 .dig_out_nid = ALC883_DIGOUT_NID,
9984 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9985 .channel_mode = alc883_3ST_2ch_modes,
9986 .input_mux = &alc883_capture_source,
9987 .unsol_event = alc883_targa_unsol_event,
9988 .setup = alc882_targa_setup,
9989 .init_hook = alc882_targa_automute,
9991 [ALC883_TARGA_8ch_DIG] = {
9992 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9993 alc883_chmode_mixer },
9994 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9995 alc883_targa_verbs },
9996 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9997 .dac_nids = alc883_dac_nids,
9998 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9999 .adc_nids = alc883_adc_nids_rev,
10000 .capsrc_nids = alc883_capsrc_nids_rev,
10001 .dig_out_nid = ALC883_DIGOUT_NID,
10002 .dig_in_nid = ALC883_DIGIN_NID,
10003 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10004 .channel_mode = alc883_4ST_8ch_modes,
10006 .input_mux = &alc883_capture_source,
10007 .unsol_event = alc883_targa_unsol_event,
10008 .setup = alc882_targa_setup,
10009 .init_hook = alc882_targa_automute,
10012 .mixers = { alc883_base_mixer },
10013 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10014 * and the headphone jack. Turn this on and rely on the
10015 * standard mute methods whenever the user wants to turn
10016 * these outputs off.
10018 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10019 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10020 .dac_nids = alc883_dac_nids,
10021 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10022 .channel_mode = alc883_3ST_2ch_modes,
10023 .input_mux = &alc883_capture_source,
10025 [ALC883_ACER_ASPIRE] = {
10026 .mixers = { alc883_acer_aspire_mixer },
10027 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10028 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10029 .dac_nids = alc883_dac_nids,
10030 .dig_out_nid = ALC883_DIGOUT_NID,
10031 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10032 .channel_mode = alc883_3ST_2ch_modes,
10033 .input_mux = &alc883_capture_source,
10034 .unsol_event = alc_automute_amp_unsol_event,
10035 .setup = alc883_acer_aspire_setup,
10036 .init_hook = alc_automute_amp,
10038 [ALC888_ACER_ASPIRE_4930G] = {
10039 .mixers = { alc888_base_mixer,
10040 alc883_chmode_mixer },
10041 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10042 alc888_acer_aspire_4930g_verbs },
10043 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10044 .dac_nids = alc883_dac_nids,
10045 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10046 .adc_nids = alc883_adc_nids_rev,
10047 .capsrc_nids = alc883_capsrc_nids_rev,
10048 .dig_out_nid = ALC883_DIGOUT_NID,
10049 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10050 .channel_mode = alc883_3ST_6ch_modes,
10052 .const_channel_count = 6,
10054 ARRAY_SIZE(alc888_2_capture_sources),
10055 .input_mux = alc888_2_capture_sources,
10056 .unsol_event = alc_automute_amp_unsol_event,
10057 .setup = alc888_acer_aspire_4930g_setup,
10058 .init_hook = alc_automute_amp,
10060 [ALC888_ACER_ASPIRE_6530G] = {
10061 .mixers = { alc888_acer_aspire_6530_mixer },
10062 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10063 alc888_acer_aspire_6530g_verbs },
10064 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10065 .dac_nids = alc883_dac_nids,
10066 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10067 .adc_nids = alc883_adc_nids_rev,
10068 .capsrc_nids = alc883_capsrc_nids_rev,
10069 .dig_out_nid = ALC883_DIGOUT_NID,
10070 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10071 .channel_mode = alc883_3ST_2ch_modes,
10073 ARRAY_SIZE(alc888_2_capture_sources),
10074 .input_mux = alc888_acer_aspire_6530_sources,
10075 .unsol_event = alc_automute_amp_unsol_event,
10076 .setup = alc888_acer_aspire_6530g_setup,
10077 .init_hook = alc_automute_amp,
10079 [ALC888_ACER_ASPIRE_8930G] = {
10080 .mixers = { alc889_acer_aspire_8930g_mixer,
10081 alc883_chmode_mixer },
10082 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10083 alc889_acer_aspire_8930g_verbs,
10084 alc889_eapd_verbs},
10085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10086 .dac_nids = alc883_dac_nids,
10087 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10088 .adc_nids = alc889_adc_nids,
10089 .capsrc_nids = alc889_capsrc_nids,
10090 .dig_out_nid = ALC883_DIGOUT_NID,
10091 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10092 .channel_mode = alc883_3ST_6ch_modes,
10094 .const_channel_count = 6,
10096 ARRAY_SIZE(alc889_capture_sources),
10097 .input_mux = alc889_capture_sources,
10098 .unsol_event = alc_automute_amp_unsol_event,
10099 .setup = alc889_acer_aspire_8930g_setup,
10100 .init_hook = alc_automute_amp,
10101 #ifdef CONFIG_SND_HDA_POWER_SAVE
10102 .power_hook = alc_power_eapd,
10105 [ALC888_ACER_ASPIRE_7730G] = {
10106 .mixers = { alc883_3ST_6ch_mixer,
10107 alc883_chmode_mixer },
10108 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10109 alc888_acer_aspire_7730G_verbs },
10110 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10111 .dac_nids = alc883_dac_nids,
10112 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10113 .adc_nids = alc883_adc_nids_rev,
10114 .capsrc_nids = alc883_capsrc_nids_rev,
10115 .dig_out_nid = ALC883_DIGOUT_NID,
10116 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10117 .channel_mode = alc883_3ST_6ch_modes,
10119 .const_channel_count = 6,
10120 .input_mux = &alc883_capture_source,
10121 .unsol_event = alc_automute_amp_unsol_event,
10122 .setup = alc888_acer_aspire_6530g_setup,
10123 .init_hook = alc_automute_amp,
10125 [ALC883_MEDION] = {
10126 .mixers = { alc883_fivestack_mixer,
10127 alc883_chmode_mixer },
10128 .init_verbs = { alc883_init_verbs,
10129 alc883_medion_eapd_verbs },
10130 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10131 .dac_nids = alc883_dac_nids,
10132 .adc_nids = alc883_adc_nids_alt,
10133 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10134 .capsrc_nids = alc883_capsrc_nids,
10135 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10136 .channel_mode = alc883_sixstack_modes,
10137 .input_mux = &alc883_capture_source,
10139 [ALC883_MEDION_MD2] = {
10140 .mixers = { alc883_medion_md2_mixer},
10141 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10142 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10143 .dac_nids = alc883_dac_nids,
10144 .dig_out_nid = ALC883_DIGOUT_NID,
10145 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10146 .channel_mode = alc883_3ST_2ch_modes,
10147 .input_mux = &alc883_capture_source,
10148 .unsol_event = alc_automute_amp_unsol_event,
10149 .setup = alc883_medion_md2_setup,
10150 .init_hook = alc_automute_amp,
10152 [ALC883_MEDION_WIM2160] = {
10153 .mixers = { alc883_medion_wim2160_mixer },
10154 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10155 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10156 .dac_nids = alc883_dac_nids,
10157 .dig_out_nid = ALC883_DIGOUT_NID,
10158 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10159 .adc_nids = alc883_adc_nids,
10160 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10161 .channel_mode = alc883_3ST_2ch_modes,
10162 .input_mux = &alc883_capture_source,
10163 .unsol_event = alc_automute_amp_unsol_event,
10164 .setup = alc883_medion_wim2160_setup,
10165 .init_hook = alc_automute_amp,
10167 [ALC883_LAPTOP_EAPD] = {
10168 .mixers = { alc883_base_mixer },
10169 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10170 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10171 .dac_nids = alc883_dac_nids,
10172 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10173 .channel_mode = alc883_3ST_2ch_modes,
10174 .input_mux = &alc883_capture_source,
10176 [ALC883_CLEVO_M540R] = {
10177 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10178 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10179 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10180 .dac_nids = alc883_dac_nids,
10181 .dig_out_nid = ALC883_DIGOUT_NID,
10182 .dig_in_nid = ALC883_DIGIN_NID,
10183 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10184 .channel_mode = alc883_3ST_6ch_clevo_modes,
10186 .input_mux = &alc883_capture_source,
10187 /* This machine has the hardware HP auto-muting, thus
10188 * we need no software mute via unsol event
10191 [ALC883_CLEVO_M720] = {
10192 .mixers = { alc883_clevo_m720_mixer },
10193 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10194 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10195 .dac_nids = alc883_dac_nids,
10196 .dig_out_nid = ALC883_DIGOUT_NID,
10197 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10198 .channel_mode = alc883_3ST_2ch_modes,
10199 .input_mux = &alc883_capture_source,
10200 .unsol_event = alc883_clevo_m720_unsol_event,
10201 .setup = alc883_clevo_m720_setup,
10202 .init_hook = alc883_clevo_m720_init_hook,
10204 [ALC883_LENOVO_101E_2ch] = {
10205 .mixers = { alc883_lenovo_101e_2ch_mixer},
10206 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10207 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10208 .dac_nids = alc883_dac_nids,
10209 .adc_nids = alc883_adc_nids_alt,
10210 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10211 .capsrc_nids = alc883_capsrc_nids,
10212 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10213 .channel_mode = alc883_3ST_2ch_modes,
10214 .input_mux = &alc883_lenovo_101e_capture_source,
10215 .unsol_event = alc883_lenovo_101e_unsol_event,
10216 .init_hook = alc883_lenovo_101e_all_automute,
10218 [ALC883_LENOVO_NB0763] = {
10219 .mixers = { alc883_lenovo_nb0763_mixer },
10220 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10221 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10222 .dac_nids = alc883_dac_nids,
10223 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10224 .channel_mode = alc883_3ST_2ch_modes,
10226 .input_mux = &alc883_lenovo_nb0763_capture_source,
10227 .unsol_event = alc_automute_amp_unsol_event,
10228 .setup = alc883_medion_md2_setup,
10229 .init_hook = alc_automute_amp,
10231 [ALC888_LENOVO_MS7195_DIG] = {
10232 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10233 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10234 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10235 .dac_nids = alc883_dac_nids,
10236 .dig_out_nid = ALC883_DIGOUT_NID,
10237 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10238 .channel_mode = alc883_3ST_6ch_modes,
10240 .input_mux = &alc883_capture_source,
10241 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10242 .init_hook = alc888_lenovo_ms7195_front_automute,
10244 [ALC883_HAIER_W66] = {
10245 .mixers = { alc883_targa_2ch_mixer},
10246 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10247 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10248 .dac_nids = alc883_dac_nids,
10249 .dig_out_nid = ALC883_DIGOUT_NID,
10250 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10251 .channel_mode = alc883_3ST_2ch_modes,
10252 .input_mux = &alc883_capture_source,
10253 .unsol_event = alc_automute_amp_unsol_event,
10254 .setup = alc883_haier_w66_setup,
10255 .init_hook = alc_automute_amp,
10257 [ALC888_3ST_HP] = {
10258 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10259 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10261 .dac_nids = alc883_dac_nids,
10262 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10263 .channel_mode = alc888_3st_hp_modes,
10265 .input_mux = &alc883_capture_source,
10266 .unsol_event = alc_automute_amp_unsol_event,
10267 .setup = alc888_3st_hp_setup,
10268 .init_hook = alc_automute_amp,
10270 [ALC888_6ST_DELL] = {
10271 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10272 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10274 .dac_nids = alc883_dac_nids,
10275 .dig_out_nid = ALC883_DIGOUT_NID,
10276 .dig_in_nid = ALC883_DIGIN_NID,
10277 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10278 .channel_mode = alc883_sixstack_modes,
10279 .input_mux = &alc883_capture_source,
10280 .unsol_event = alc_automute_amp_unsol_event,
10281 .setup = alc888_6st_dell_setup,
10282 .init_hook = alc_automute_amp,
10285 .mixers = { alc883_mitac_mixer },
10286 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10287 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10288 .dac_nids = alc883_dac_nids,
10289 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10290 .channel_mode = alc883_3ST_2ch_modes,
10291 .input_mux = &alc883_capture_source,
10292 .unsol_event = alc_automute_amp_unsol_event,
10293 .setup = alc883_mitac_setup,
10294 .init_hook = alc_automute_amp,
10296 [ALC883_FUJITSU_PI2515] = {
10297 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10298 .init_verbs = { alc883_init_verbs,
10299 alc883_2ch_fujitsu_pi2515_verbs},
10300 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10301 .dac_nids = alc883_dac_nids,
10302 .dig_out_nid = ALC883_DIGOUT_NID,
10303 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10304 .channel_mode = alc883_3ST_2ch_modes,
10305 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10306 .unsol_event = alc_automute_amp_unsol_event,
10307 .setup = alc883_2ch_fujitsu_pi2515_setup,
10308 .init_hook = alc_automute_amp,
10310 [ALC888_FUJITSU_XA3530] = {
10311 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10312 .init_verbs = { alc883_init_verbs,
10313 alc888_fujitsu_xa3530_verbs },
10314 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10315 .dac_nids = alc883_dac_nids,
10316 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10317 .adc_nids = alc883_adc_nids_rev,
10318 .capsrc_nids = alc883_capsrc_nids_rev,
10319 .dig_out_nid = ALC883_DIGOUT_NID,
10320 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10321 .channel_mode = alc888_4ST_8ch_intel_modes,
10323 ARRAY_SIZE(alc888_2_capture_sources),
10324 .input_mux = alc888_2_capture_sources,
10325 .unsol_event = alc_automute_amp_unsol_event,
10326 .setup = alc888_fujitsu_xa3530_setup,
10327 .init_hook = alc_automute_amp,
10329 [ALC888_LENOVO_SKY] = {
10330 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10331 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10332 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10333 .dac_nids = alc883_dac_nids,
10334 .dig_out_nid = ALC883_DIGOUT_NID,
10335 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10336 .channel_mode = alc883_sixstack_modes,
10338 .input_mux = &alc883_lenovo_sky_capture_source,
10339 .unsol_event = alc_automute_amp_unsol_event,
10340 .setup = alc888_lenovo_sky_setup,
10341 .init_hook = alc_automute_amp,
10343 [ALC888_ASUS_M90V] = {
10344 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10345 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10346 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10347 .dac_nids = alc883_dac_nids,
10348 .dig_out_nid = ALC883_DIGOUT_NID,
10349 .dig_in_nid = ALC883_DIGIN_NID,
10350 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10351 .channel_mode = alc883_3ST_6ch_modes,
10353 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10354 .unsol_event = alc_sku_unsol_event,
10355 .setup = alc883_mode2_setup,
10356 .init_hook = alc_inithook,
10358 [ALC888_ASUS_EEE1601] = {
10359 .mixers = { alc883_asus_eee1601_mixer },
10360 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10361 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10362 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10363 .dac_nids = alc883_dac_nids,
10364 .dig_out_nid = ALC883_DIGOUT_NID,
10365 .dig_in_nid = ALC883_DIGIN_NID,
10366 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10367 .channel_mode = alc883_3ST_2ch_modes,
10369 .input_mux = &alc883_asus_eee1601_capture_source,
10370 .unsol_event = alc_sku_unsol_event,
10371 .init_hook = alc883_eee1601_inithook,
10373 [ALC1200_ASUS_P5Q] = {
10374 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10375 .init_verbs = { alc883_init_verbs },
10376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10377 .dac_nids = alc883_dac_nids,
10378 .dig_out_nid = ALC1200_DIGOUT_NID,
10379 .dig_in_nid = ALC883_DIGIN_NID,
10380 .slave_dig_outs = alc1200_slave_dig_outs,
10381 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10382 .channel_mode = alc883_sixstack_modes,
10383 .input_mux = &alc883_capture_source,
10386 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10387 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10388 alc880_gpio1_init_verbs },
10389 .adc_nids = alc883_adc_nids,
10390 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10391 .capsrc_nids = alc883_capsrc_nids,
10392 .dac_nids = alc883_dac_nids,
10393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10394 .channel_mode = alc889A_mb31_6ch_modes,
10395 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10396 .input_mux = &alc889A_mb31_capture_source,
10397 .dig_out_nid = ALC883_DIGOUT_NID,
10398 .unsol_event = alc889A_mb31_unsol_event,
10399 .init_hook = alc889A_mb31_automute,
10401 [ALC883_SONY_VAIO_TT] = {
10402 .mixers = { alc883_vaiott_mixer },
10403 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10404 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10405 .dac_nids = alc883_dac_nids,
10406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10407 .channel_mode = alc883_3ST_2ch_modes,
10408 .input_mux = &alc883_capture_source,
10409 .unsol_event = alc_automute_amp_unsol_event,
10410 .setup = alc883_vaiott_setup,
10411 .init_hook = alc_automute_amp,
10420 PINFIX_ABIT_AW9D_MAX,
10424 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10425 { 0x15, 0x01080104 }, /* side */
10426 { 0x16, 0x01011012 }, /* rear */
10427 { 0x17, 0x01016011 }, /* clfe */
10431 static const struct hda_verb pb_m5210_verbs[] = {
10432 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10436 static const struct alc_fixup alc882_fixups[] = {
10437 [PINFIX_ABIT_AW9D_MAX] = {
10438 .pins = alc882_abit_aw9d_pinfix
10440 [PINFIX_PB_M5210] = {
10441 .verbs = pb_m5210_verbs
10445 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10446 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10447 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10452 * BIOS auto configuration
10454 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10455 const struct auto_pin_cfg *cfg)
10457 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10460 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10461 hda_nid_t nid, int pin_type,
10466 /* set as output */
10467 alc_set_pin_output(codec, nid, pin_type);
10471 else if (dac >= 0x02 && dac <= 0x05)
10475 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10478 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10480 struct alc_spec *spec = codec->spec;
10483 for (i = 0; i <= HDA_SIDE; i++) {
10484 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10485 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10487 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10488 spec->multiout.dac_nids[i]);
10492 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10494 struct alc_spec *spec = codec->spec;
10495 hda_nid_t pin, dac;
10497 pin = spec->autocfg.hp_pins[0];
10499 dac = spec->multiout.hp_nid;
10501 dac = spec->multiout.dac_nids[0]; /* to front */
10502 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10504 pin = spec->autocfg.speaker_pins[0];
10506 dac = spec->multiout.extra_out_nid[0];
10508 dac = spec->multiout.dac_nids[0]; /* to front */
10509 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10513 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10515 struct alc_spec *spec = codec->spec;
10518 for (i = 0; i < AUTO_PIN_LAST; i++) {
10519 hda_nid_t nid = spec->autocfg.input_pins[i];
10522 alc_set_input_pin(codec, nid, i);
10523 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10524 snd_hda_codec_write(codec, nid, 0,
10525 AC_VERB_SET_AMP_GAIN_MUTE,
10530 static void alc882_auto_init_input_src(struct hda_codec *codec)
10532 struct alc_spec *spec = codec->spec;
10535 for (c = 0; c < spec->num_adc_nids; c++) {
10536 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10537 hda_nid_t nid = spec->capsrc_nids[c];
10538 unsigned int mux_idx;
10539 const struct hda_input_mux *imux;
10540 int conns, mute, idx, item;
10542 conns = snd_hda_get_connections(codec, nid, conn_list,
10543 ARRAY_SIZE(conn_list));
10546 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10547 imux = &spec->input_mux[mux_idx];
10548 if (!imux->num_items && mux_idx > 0)
10549 imux = &spec->input_mux[0];
10550 for (idx = 0; idx < conns; idx++) {
10551 /* if the current connection is the selected one,
10552 * unmute it as default - otherwise mute it
10554 mute = AMP_IN_MUTE(idx);
10555 for (item = 0; item < imux->num_items; item++) {
10556 if (imux->items[item].index == idx) {
10557 if (spec->cur_mux[c] == item)
10558 mute = AMP_IN_UNMUTE(idx);
10562 /* check if we have a selector or mixer
10563 * we could check for the widget type instead, but
10564 * just check for Amp-In presence (in case of mixer
10565 * without amp-in there is something wrong, this
10566 * function shouldn't be used or capsrc nid is wrong)
10568 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10569 snd_hda_codec_write(codec, nid, 0,
10570 AC_VERB_SET_AMP_GAIN_MUTE,
10572 else if (mute != AMP_IN_MUTE(idx))
10573 snd_hda_codec_write(codec, nid, 0,
10574 AC_VERB_SET_CONNECT_SEL,
10580 /* add mic boosts if needed */
10581 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10583 struct alc_spec *spec = codec->spec;
10587 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10588 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10589 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10591 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10595 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10596 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10597 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10599 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10606 /* almost identical with ALC880 parser... */
10607 static int alc882_parse_auto_config(struct hda_codec *codec)
10609 struct alc_spec *spec = codec->spec;
10610 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10613 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10617 if (!spec->autocfg.line_outs)
10618 return 0; /* can't find valid BIOS pin config */
10620 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10623 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10626 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10630 err = alc880_auto_create_extra_out(spec,
10631 spec->autocfg.speaker_pins[0],
10635 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10639 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10641 alc_auto_parse_digital(codec);
10643 if (spec->kctls.list)
10644 add_mixer(spec, spec->kctls.list);
10646 add_verb(spec, alc883_auto_init_verbs);
10647 /* if ADC 0x07 is available, initialize it, too */
10648 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10649 add_verb(spec, alc882_adc1_init_verbs);
10651 spec->num_mux_defs = 1;
10652 spec->input_mux = &spec->private_imux[0];
10654 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10656 err = alc_auto_add_mic_boost(codec);
10660 return 1; /* config found */
10663 /* additional initialization for auto-configuration model */
10664 static void alc882_auto_init(struct hda_codec *codec)
10666 struct alc_spec *spec = codec->spec;
10667 alc882_auto_init_multi_out(codec);
10668 alc882_auto_init_hp_out(codec);
10669 alc882_auto_init_analog_input(codec);
10670 alc882_auto_init_input_src(codec);
10671 alc_auto_init_digital(codec);
10672 if (spec->unsol_event)
10673 alc_inithook(codec);
10676 static int patch_alc882(struct hda_codec *codec)
10678 struct alc_spec *spec;
10679 int err, board_config;
10681 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10685 codec->spec = spec;
10687 alc_auto_parse_customize_define(codec);
10689 switch (codec->vendor_id) {
10694 /* ALC883 and variants */
10695 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10699 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10703 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10704 board_config = snd_hda_check_board_codec_sid_config(codec,
10705 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10707 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10708 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10710 board_config = ALC882_AUTO;
10713 if (board_config == ALC882_AUTO)
10714 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10716 if (board_config == ALC882_AUTO) {
10717 /* automatic parse from the BIOS config */
10718 err = alc882_parse_auto_config(codec);
10724 "hda_codec: Cannot set up configuration "
10725 "from BIOS. Using base mode...\n");
10726 board_config = ALC882_3ST_DIG;
10730 if (has_cdefine_beep(codec)) {
10731 err = snd_hda_attach_beep_device(codec, 0x1);
10738 if (board_config != ALC882_AUTO)
10739 setup_preset(codec, &alc882_presets[board_config]);
10741 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10742 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10743 /* FIXME: setup DAC5 */
10744 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10745 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10747 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10748 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10750 if (!spec->adc_nids && spec->input_mux) {
10752 spec->num_adc_nids = 0;
10753 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10754 const struct hda_input_mux *imux = spec->input_mux;
10756 hda_nid_t items[16];
10757 hda_nid_t nid = alc882_adc_nids[i];
10758 unsigned int wcap = get_wcaps(codec, nid);
10760 wcap = get_wcaps_type(wcap);
10761 if (wcap != AC_WID_AUD_IN)
10763 spec->private_adc_nids[spec->num_adc_nids] = nid;
10764 err = snd_hda_get_connections(codec, nid, &cap, 1);
10767 err = snd_hda_get_connections(codec, cap, items,
10768 ARRAY_SIZE(items));
10771 for (j = 0; j < imux->num_items; j++)
10772 if (imux->items[j].index >= err)
10774 if (j < imux->num_items)
10776 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10777 spec->num_adc_nids++;
10779 spec->adc_nids = spec->private_adc_nids;
10780 spec->capsrc_nids = spec->private_capsrc_nids;
10783 set_capture_mixer(codec);
10785 if (has_cdefine_beep(codec))
10786 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10788 if (board_config == ALC882_AUTO)
10789 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10791 spec->vmaster_nid = 0x0c;
10793 codec->patch_ops = alc_patch_ops;
10794 if (board_config == ALC882_AUTO)
10795 spec->init_hook = alc882_auto_init;
10796 #ifdef CONFIG_SND_HDA_POWER_SAVE
10797 if (!spec->loopback.amplist)
10798 spec->loopback.amplist = alc882_loopbacks;
10809 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10810 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10812 #define alc262_dac_nids alc260_dac_nids
10813 #define alc262_adc_nids alc882_adc_nids
10814 #define alc262_adc_nids_alt alc882_adc_nids_alt
10815 #define alc262_capsrc_nids alc882_capsrc_nids
10816 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10818 #define alc262_modes alc260_modes
10819 #define alc262_capture_source alc882_capture_source
10821 static hda_nid_t alc262_dmic_adc_nids[1] = {
10826 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10828 static struct snd_kcontrol_new alc262_base_mixer[] = {
10829 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10830 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10831 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10832 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10833 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10834 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10835 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10836 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10837 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10838 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10839 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10840 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10841 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10843 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10844 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10848 /* update HP, line and mono-out pins according to the master switch */
10849 static void alc262_hp_master_update(struct hda_codec *codec)
10851 struct alc_spec *spec = codec->spec;
10852 int val = spec->master_sw;
10854 /* HP & line-out */
10855 snd_hda_codec_write_cache(codec, 0x1b, 0,
10856 AC_VERB_SET_PIN_WIDGET_CONTROL,
10858 snd_hda_codec_write_cache(codec, 0x15, 0,
10859 AC_VERB_SET_PIN_WIDGET_CONTROL,
10861 /* mono (speaker) depending on the HP jack sense */
10862 val = val && !spec->jack_present;
10863 snd_hda_codec_write_cache(codec, 0x16, 0,
10864 AC_VERB_SET_PIN_WIDGET_CONTROL,
10865 val ? PIN_OUT : 0);
10868 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10870 struct alc_spec *spec = codec->spec;
10872 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10873 alc262_hp_master_update(codec);
10876 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10878 if ((res >> 26) != ALC880_HP_EVENT)
10880 alc262_hp_bpc_automute(codec);
10883 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10885 struct alc_spec *spec = codec->spec;
10887 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10888 alc262_hp_master_update(codec);
10891 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10894 if ((res >> 26) != ALC880_HP_EVENT)
10896 alc262_hp_wildwest_automute(codec);
10899 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10901 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10902 struct snd_ctl_elem_value *ucontrol)
10904 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10905 struct alc_spec *spec = codec->spec;
10906 int val = !!*ucontrol->value.integer.value;
10908 if (val == spec->master_sw)
10910 spec->master_sw = val;
10911 alc262_hp_master_update(codec);
10915 #define ALC262_HP_MASTER_SWITCH \
10917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10918 .name = "Master Playback Switch", \
10919 .info = snd_ctl_boolean_mono_info, \
10920 .get = alc262_hp_master_sw_get, \
10921 .put = alc262_hp_master_sw_put, \
10924 .iface = NID_MAPPING, \
10925 .name = "Master Playback Switch", \
10926 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10930 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10931 ALC262_HP_MASTER_SWITCH,
10932 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10933 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10935 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10937 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10939 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10940 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10941 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10942 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10943 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10944 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10945 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10946 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10949 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10950 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10954 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10955 ALC262_HP_MASTER_SWITCH,
10956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10957 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10960 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10962 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10964 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10965 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10966 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10969 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10970 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10974 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10975 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10976 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10977 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10981 /* mute/unmute internal speaker according to the hp jack and mute state */
10982 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10984 struct alc_spec *spec = codec->spec;
10986 spec->autocfg.hp_pins[0] = 0x15;
10987 spec->autocfg.speaker_pins[0] = 0x14;
10990 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10992 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11001 static struct hda_verb alc262_hp_t5735_verbs[] = {
11002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11005 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11009 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11013 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11019 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11020 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11022 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11024 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11025 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11026 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11027 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11033 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11040 /* bind hp and internal speaker mute (with plug check) as master switch */
11041 static void alc262_hippo_master_update(struct hda_codec *codec)
11043 struct alc_spec *spec = codec->spec;
11044 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11045 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11046 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11050 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11051 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11052 HDA_AMP_MUTE, mute);
11053 /* mute internal speaker per jack sense */
11054 if (spec->jack_present)
11055 mute = HDA_AMP_MUTE;
11057 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11058 HDA_AMP_MUTE, mute);
11059 if (speaker_nid && speaker_nid != line_nid)
11060 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11061 HDA_AMP_MUTE, mute);
11064 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11066 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11067 struct snd_ctl_elem_value *ucontrol)
11069 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11070 struct alc_spec *spec = codec->spec;
11071 int val = !!*ucontrol->value.integer.value;
11073 if (val == spec->master_sw)
11075 spec->master_sw = val;
11076 alc262_hippo_master_update(codec);
11080 #define ALC262_HIPPO_MASTER_SWITCH \
11082 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11083 .name = "Master Playback Switch", \
11084 .info = snd_ctl_boolean_mono_info, \
11085 .get = alc262_hippo_master_sw_get, \
11086 .put = alc262_hippo_master_sw_put, \
11089 .iface = NID_MAPPING, \
11090 .name = "Master Playback Switch", \
11091 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11092 (SUBDEV_SPEAKER(0) << 16), \
11095 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11096 ALC262_HIPPO_MASTER_SWITCH,
11097 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11098 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11099 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11100 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11101 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11108 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11112 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11113 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11114 ALC262_HIPPO_MASTER_SWITCH,
11115 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11116 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11117 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11118 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11122 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11124 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11128 /* mute/unmute internal speaker according to the hp jack and mute state */
11129 static void alc262_hippo_automute(struct hda_codec *codec)
11131 struct alc_spec *spec = codec->spec;
11132 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11134 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11135 alc262_hippo_master_update(codec);
11138 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11140 if ((res >> 26) != ALC880_HP_EVENT)
11142 alc262_hippo_automute(codec);
11145 static void alc262_hippo_setup(struct hda_codec *codec)
11147 struct alc_spec *spec = codec->spec;
11149 spec->autocfg.hp_pins[0] = 0x15;
11150 spec->autocfg.speaker_pins[0] = 0x14;
11153 static void alc262_hippo1_setup(struct hda_codec *codec)
11155 struct alc_spec *spec = codec->spec;
11157 spec->autocfg.hp_pins[0] = 0x1b;
11158 spec->autocfg.speaker_pins[0] = 0x14;
11162 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11163 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11164 ALC262_HIPPO_MASTER_SWITCH,
11165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11167 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11168 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11172 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11173 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11174 ALC262_HIPPO_MASTER_SWITCH,
11175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11178 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11179 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11183 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11184 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11185 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11186 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11187 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11189 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11192 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11193 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11194 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11195 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11199 static struct hda_verb alc262_tyan_verbs[] = {
11200 /* Headphone automute */
11201 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11203 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11205 /* P11 AUX_IN, white 4-pin connector */
11206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11207 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11208 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11209 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11214 /* unsolicited event for HP jack sensing */
11215 static void alc262_tyan_setup(struct hda_codec *codec)
11217 struct alc_spec *spec = codec->spec;
11219 spec->autocfg.hp_pins[0] = 0x1b;
11220 spec->autocfg.speaker_pins[0] = 0x15;
11224 #define alc262_capture_mixer alc882_capture_mixer
11225 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11228 * generic initialization of ADC, input mixers and output mixers
11230 static struct hda_verb alc262_init_verbs[] = {
11232 * Unmute ADC0-2 and set the default input to mic-in
11234 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11236 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11238 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11241 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11243 * Note: PASD motherboards uses the Line In 2 as the input for
11244 * front panel mic (mic 2)
11246 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11254 * Set up output mixers (0x0c - 0x0e)
11256 /* set vol=0 to output mixers */
11257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11260 /* set up input amps for analog loopback */
11261 /* Amp Indices: DAC = 0, mixer = 1 */
11262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11266 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11271 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11272 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11273 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11274 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11276 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11277 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11278 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11279 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11280 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11282 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11285 /* FIXME: use matrix-type input source selection */
11286 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11287 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11291 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11300 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11301 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11306 static struct hda_verb alc262_eapd_verbs[] = {
11307 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11308 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11312 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11313 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11314 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11315 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11317 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11322 static struct hda_verb alc262_sony_unsol_verbs[] = {
11323 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11324 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11325 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11327 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11328 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11332 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11333 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11334 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11335 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11341 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11342 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11344 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11345 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11346 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11348 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11353 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11355 struct alc_spec *spec = codec->spec;
11357 spec->autocfg.hp_pins[0] = 0x15;
11358 spec->autocfg.speaker_pins[0] = 0x14;
11359 spec->ext_mic.pin = 0x18;
11360 spec->ext_mic.mux_idx = 0;
11361 spec->int_mic.pin = 0x12;
11362 spec->int_mic.mux_idx = 9;
11363 spec->auto_mic = 1;
11369 * 0x16 = internal speaker
11370 * 0x18 = external mic
11373 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11374 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11375 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11379 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11381 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11386 static struct hda_verb alc262_nec_verbs[] = {
11387 /* Unmute Speaker */
11388 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11391 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11392 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11394 /* External mic to headphone */
11395 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11396 /* External mic to speaker */
11397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11403 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11404 * 0x1b = port replicator headphone out
11407 #define ALC_HP_EVENT 0x37
11409 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11410 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11412 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11413 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11417 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11418 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11419 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11423 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11424 /* Front Mic pin: input vref at 50% */
11425 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11430 static struct hda_input_mux alc262_fujitsu_capture_source = {
11434 { "Int Mic", 0x1 },
11439 static struct hda_input_mux alc262_HP_capture_source = {
11443 { "Front Mic", 0x1 },
11450 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11454 { "Front Mic", 0x2 },
11460 /* mute/unmute internal speaker according to the hp jacks and mute state */
11461 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11463 struct alc_spec *spec = codec->spec;
11466 if (force || !spec->sense_updated) {
11467 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11468 snd_hda_jack_detect(codec, 0x1b);
11469 spec->sense_updated = 1;
11471 /* unmute internal speaker only if both HPs are unplugged and
11472 * master switch is on
11474 if (spec->jack_present)
11475 mute = HDA_AMP_MUTE;
11477 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11478 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11479 HDA_AMP_MUTE, mute);
11482 /* unsolicited event for HP jack sensing */
11483 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11486 if ((res >> 26) != ALC_HP_EVENT)
11488 alc262_fujitsu_automute(codec, 1);
11491 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11493 alc262_fujitsu_automute(codec, 1);
11496 /* bind volumes of both NID 0x0c and 0x0d */
11497 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11498 .ops = &snd_hda_bind_vol,
11500 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11501 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11506 /* mute/unmute internal speaker according to the hp jack and mute state */
11507 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11509 struct alc_spec *spec = codec->spec;
11512 if (force || !spec->sense_updated) {
11513 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11514 spec->sense_updated = 1;
11516 if (spec->jack_present) {
11517 /* mute internal speaker */
11518 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11519 HDA_AMP_MUTE, HDA_AMP_MUTE);
11520 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11521 HDA_AMP_MUTE, HDA_AMP_MUTE);
11523 /* unmute internal speaker if necessary */
11524 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11525 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11526 HDA_AMP_MUTE, mute);
11527 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11528 HDA_AMP_MUTE, mute);
11532 /* unsolicited event for HP jack sensing */
11533 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11536 if ((res >> 26) != ALC_HP_EVENT)
11538 alc262_lenovo_3000_automute(codec, 1);
11541 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11542 int dir, int idx, long *valp)
11546 for (i = 0; i < 2; i++, valp++)
11547 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11549 *valp ? 0 : HDA_AMP_MUTE);
11553 /* bind hp and internal speaker mute (with plug check) */
11554 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11555 struct snd_ctl_elem_value *ucontrol)
11557 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11558 long *valp = ucontrol->value.integer.value;
11561 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11562 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11564 alc262_fujitsu_automute(codec, 0);
11568 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11569 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11572 .name = "Master Playback Switch",
11573 .subdevice = HDA_SUBDEV_AMP_FLAG,
11574 .info = snd_hda_mixer_amp_switch_info,
11575 .get = snd_hda_mixer_amp_switch_get,
11576 .put = alc262_fujitsu_master_sw_put,
11577 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11580 .iface = NID_MAPPING,
11581 .name = "Master Playback Switch",
11582 .private_value = 0x1b,
11584 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11585 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11586 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11589 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11590 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11591 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11595 /* bind hp and internal speaker mute (with plug check) */
11596 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11597 struct snd_ctl_elem_value *ucontrol)
11599 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11600 long *valp = ucontrol->value.integer.value;
11603 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11605 alc262_lenovo_3000_automute(codec, 0);
11609 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11610 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11613 .name = "Master Playback Switch",
11614 .subdevice = HDA_SUBDEV_AMP_FLAG,
11615 .info = snd_hda_mixer_amp_switch_info,
11616 .get = snd_hda_mixer_amp_switch_get,
11617 .put = alc262_lenovo_3000_master_sw_put,
11618 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11620 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11621 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11622 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11623 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11624 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11625 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11626 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11627 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11631 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11632 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11633 ALC262_HIPPO_MASTER_SWITCH,
11634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11637 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11638 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11639 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11643 /* additional init verbs for Benq laptops */
11644 static struct hda_verb alc262_EAPD_verbs[] = {
11645 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11646 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11650 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11652 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11654 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11655 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11659 /* Samsung Q1 Ultra Vista model setup */
11660 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11661 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11662 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11664 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11665 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11666 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11670 static struct hda_verb alc262_ultra_verbs[] = {
11672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11676 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11677 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11679 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11681 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11684 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11685 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11689 /* ADC, choose mic */
11690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11691 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11703 /* mute/unmute internal speaker according to the hp jack and mute state */
11704 static void alc262_ultra_automute(struct hda_codec *codec)
11706 struct alc_spec *spec = codec->spec;
11710 /* auto-mute only when HP is used as HP */
11711 if (!spec->cur_mux[0]) {
11712 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11713 if (spec->jack_present)
11714 mute = HDA_AMP_MUTE;
11716 /* mute/unmute internal speaker */
11717 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11718 HDA_AMP_MUTE, mute);
11719 /* mute/unmute HP */
11720 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11721 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11724 /* unsolicited event for HP jack sensing */
11725 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11728 if ((res >> 26) != ALC880_HP_EVENT)
11730 alc262_ultra_automute(codec);
11733 static struct hda_input_mux alc262_ultra_capture_source = {
11737 { "Headphone", 0x7 },
11741 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11742 struct snd_ctl_elem_value *ucontrol)
11744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11745 struct alc_spec *spec = codec->spec;
11748 ret = alc_mux_enum_put(kcontrol, ucontrol);
11751 /* reprogram the HP pin as mic or HP according to the input source */
11752 snd_hda_codec_write_cache(codec, 0x15, 0,
11753 AC_VERB_SET_PIN_WIDGET_CONTROL,
11754 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11755 alc262_ultra_automute(codec); /* mute/unmute HP */
11759 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11760 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11761 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11764 .name = "Capture Source",
11765 .info = alc_mux_enum_info,
11766 .get = alc_mux_enum_get,
11767 .put = alc262_ultra_mux_enum_put,
11770 .iface = NID_MAPPING,
11771 .name = "Capture Source",
11772 .private_value = 0x15,
11777 /* We use two mixers depending on the output pin; 0x16 is a mono output
11778 * and thus it's bound with a different mixer.
11779 * This function returns which mixer amp should be used.
11781 static int alc262_check_volbit(hda_nid_t nid)
11785 else if (nid == 0x16)
11791 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11792 const char *pfx, int *vbits)
11797 vbit = alc262_check_volbit(nid);
11800 if (*vbits & vbit) /* a volume control for this mixer already there */
11804 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11806 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11807 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11810 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11818 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11820 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11821 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11824 /* add playback controls from the parsed DAC table */
11825 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11826 const struct auto_pin_cfg *cfg)
11832 spec->multiout.num_dacs = 1; /* only use one dac */
11833 spec->multiout.dac_nids = spec->private_dac_nids;
11834 spec->multiout.dac_nids[0] = 2;
11836 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11838 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11842 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11845 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11848 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11852 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11853 alc262_check_volbit(cfg->speaker_pins[0]) |
11854 alc262_check_volbit(cfg->hp_pins[0]);
11855 if (vbits == 1 || vbits == 2)
11856 pfx = "Master"; /* only one mixer is used */
11857 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11862 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11865 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11869 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11876 #define alc262_auto_create_input_ctls \
11877 alc882_auto_create_input_ctls
11880 * generic initialization of ADC, input mixers and output mixers
11882 static struct hda_verb alc262_volume_init_verbs[] = {
11884 * Unmute ADC0-2 and set the default input to mic-in
11886 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11888 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11889 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11890 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11893 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11895 * Note: PASD motherboards uses the Line In 2 as the input for
11896 * front panel mic (mic 2)
11898 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11899 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11900 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11901 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11902 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11903 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11906 * Set up output mixers (0x0c - 0x0f)
11908 /* set vol=0 to output mixers */
11909 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11910 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11911 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11913 /* set up input amps for analog loopback */
11914 /* Amp Indices: DAC = 0, mixer = 1 */
11915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11918 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11920 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11922 /* FIXME: use matrix-type input source selection */
11923 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11924 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11925 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11926 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11927 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11928 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11930 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11931 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11932 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11933 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11935 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11936 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11943 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11945 * Unmute ADC0-2 and set the default input to mic-in
11947 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11949 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11950 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11951 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11954 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11956 * Note: PASD motherboards uses the Line In 2 as the input for
11957 * front panel mic (mic 2)
11959 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11961 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11962 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11963 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11964 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11965 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11966 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11969 * Set up output mixers (0x0c - 0x0e)
11971 /* set vol=0 to output mixers */
11972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11973 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11974 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11976 /* set up input amps for analog loopback */
11977 /* Amp Indices: DAC = 0, mixer = 1 */
11978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11980 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11981 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11983 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11985 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11989 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11992 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11997 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11998 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12001 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12002 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12003 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12005 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12006 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12009 /* FIXME: use matrix-type input source selection */
12010 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12011 /* Input mixer1: only unmute Mic */
12012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12013 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12015 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12016 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12020 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12022 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12023 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12024 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12025 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12026 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12027 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12028 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12029 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12034 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12042 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12047 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12049 * Unmute ADC0-2 and set the default input to mic-in
12051 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12053 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12055 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12056 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12058 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12060 * Note: PASD motherboards uses the Line In 2 as the input for front
12061 * panel mic (mic 2)
12063 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12067 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12068 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12073 * Set up output mixers (0x0c - 0x0e)
12075 /* set vol=0 to output mixers */
12076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12078 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12080 /* set up input amps for analog loopback */
12081 /* Amp Indices: DAC = 0, mixer = 1 */
12082 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12084 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12085 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12086 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12087 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12090 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12092 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12093 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12094 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12096 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12098 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12099 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12101 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12102 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12104 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12105 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12106 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12107 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12108 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12109 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12111 /* FIXME: use matrix-type input source selection */
12112 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12113 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12117 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12118 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12119 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12122 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12123 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12124 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12125 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12126 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12127 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12128 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12130 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12131 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12135 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12136 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12138 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12143 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12146 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12147 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12150 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12151 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12152 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12155 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12161 #ifdef CONFIG_SND_HDA_POWER_SAVE
12162 #define alc262_loopbacks alc880_loopbacks
12165 /* pcm configuration: identical with ALC880 */
12166 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12167 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12168 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12169 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12172 * BIOS auto configuration
12174 static int alc262_parse_auto_config(struct hda_codec *codec)
12176 struct alc_spec *spec = codec->spec;
12178 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12180 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12184 if (!spec->autocfg.line_outs) {
12185 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12186 spec->multiout.max_channels = 2;
12187 spec->no_analog = 1;
12190 return 0; /* can't find valid BIOS pin config */
12192 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12195 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12199 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12202 alc_auto_parse_digital(codec);
12204 if (spec->kctls.list)
12205 add_mixer(spec, spec->kctls.list);
12207 add_verb(spec, alc262_volume_init_verbs);
12208 spec->num_mux_defs = 1;
12209 spec->input_mux = &spec->private_imux[0];
12211 err = alc_auto_add_mic_boost(codec);
12215 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12220 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12221 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12222 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12223 #define alc262_auto_init_input_src alc882_auto_init_input_src
12226 /* init callback for auto-configuration model -- overriding the default init */
12227 static void alc262_auto_init(struct hda_codec *codec)
12229 struct alc_spec *spec = codec->spec;
12230 alc262_auto_init_multi_out(codec);
12231 alc262_auto_init_hp_out(codec);
12232 alc262_auto_init_analog_input(codec);
12233 alc262_auto_init_input_src(codec);
12234 alc_auto_init_digital(codec);
12235 if (spec->unsol_event)
12236 alc_inithook(codec);
12240 * configuration and preset
12242 static const char *alc262_models[ALC262_MODEL_LAST] = {
12243 [ALC262_BASIC] = "basic",
12244 [ALC262_HIPPO] = "hippo",
12245 [ALC262_HIPPO_1] = "hippo_1",
12246 [ALC262_FUJITSU] = "fujitsu",
12247 [ALC262_HP_BPC] = "hp-bpc",
12248 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12249 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12250 [ALC262_HP_RP5700] = "hp-rp5700",
12251 [ALC262_BENQ_ED8] = "benq",
12252 [ALC262_BENQ_T31] = "benq-t31",
12253 [ALC262_SONY_ASSAMD] = "sony-assamd",
12254 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12255 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12256 [ALC262_ULTRA] = "ultra",
12257 [ALC262_LENOVO_3000] = "lenovo-3000",
12258 [ALC262_NEC] = "nec",
12259 [ALC262_TYAN] = "tyan",
12260 [ALC262_AUTO] = "auto",
12263 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12264 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12265 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12266 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12268 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12270 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12272 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12273 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12274 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12275 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12276 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12277 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12278 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12279 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12280 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12281 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12282 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12283 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12284 ALC262_HP_TC_T5735),
12285 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12286 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12287 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12288 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12289 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12290 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12291 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12292 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12293 #if 0 /* disable the quirk since model=auto works better in recent versions */
12294 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12295 ALC262_SONY_ASSAMD),
12297 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12298 ALC262_TOSHIBA_RX1),
12299 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12300 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12301 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12302 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12303 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12305 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12306 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12307 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12308 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12309 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12313 static struct alc_config_preset alc262_presets[] = {
12315 .mixers = { alc262_base_mixer },
12316 .init_verbs = { alc262_init_verbs },
12317 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12318 .dac_nids = alc262_dac_nids,
12320 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12321 .channel_mode = alc262_modes,
12322 .input_mux = &alc262_capture_source,
12325 .mixers = { alc262_hippo_mixer },
12326 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12327 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12328 .dac_nids = alc262_dac_nids,
12330 .dig_out_nid = ALC262_DIGOUT_NID,
12331 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12332 .channel_mode = alc262_modes,
12333 .input_mux = &alc262_capture_source,
12334 .unsol_event = alc262_hippo_unsol_event,
12335 .setup = alc262_hippo_setup,
12336 .init_hook = alc262_hippo_automute,
12338 [ALC262_HIPPO_1] = {
12339 .mixers = { alc262_hippo1_mixer },
12340 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12341 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12342 .dac_nids = alc262_dac_nids,
12344 .dig_out_nid = ALC262_DIGOUT_NID,
12345 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12346 .channel_mode = alc262_modes,
12347 .input_mux = &alc262_capture_source,
12348 .unsol_event = alc262_hippo_unsol_event,
12349 .setup = alc262_hippo1_setup,
12350 .init_hook = alc262_hippo_automute,
12352 [ALC262_FUJITSU] = {
12353 .mixers = { alc262_fujitsu_mixer },
12354 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12355 alc262_fujitsu_unsol_verbs },
12356 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12357 .dac_nids = alc262_dac_nids,
12359 .dig_out_nid = ALC262_DIGOUT_NID,
12360 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12361 .channel_mode = alc262_modes,
12362 .input_mux = &alc262_fujitsu_capture_source,
12363 .unsol_event = alc262_fujitsu_unsol_event,
12364 .init_hook = alc262_fujitsu_init_hook,
12366 [ALC262_HP_BPC] = {
12367 .mixers = { alc262_HP_BPC_mixer },
12368 .init_verbs = { alc262_HP_BPC_init_verbs },
12369 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12370 .dac_nids = alc262_dac_nids,
12372 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12373 .channel_mode = alc262_modes,
12374 .input_mux = &alc262_HP_capture_source,
12375 .unsol_event = alc262_hp_bpc_unsol_event,
12376 .init_hook = alc262_hp_bpc_automute,
12378 [ALC262_HP_BPC_D7000_WF] = {
12379 .mixers = { alc262_HP_BPC_WildWest_mixer },
12380 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12381 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12382 .dac_nids = alc262_dac_nids,
12384 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12385 .channel_mode = alc262_modes,
12386 .input_mux = &alc262_HP_D7000_capture_source,
12387 .unsol_event = alc262_hp_wildwest_unsol_event,
12388 .init_hook = alc262_hp_wildwest_automute,
12390 [ALC262_HP_BPC_D7000_WL] = {
12391 .mixers = { alc262_HP_BPC_WildWest_mixer,
12392 alc262_HP_BPC_WildWest_option_mixer },
12393 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12394 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12395 .dac_nids = alc262_dac_nids,
12397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12398 .channel_mode = alc262_modes,
12399 .input_mux = &alc262_HP_D7000_capture_source,
12400 .unsol_event = alc262_hp_wildwest_unsol_event,
12401 .init_hook = alc262_hp_wildwest_automute,
12403 [ALC262_HP_TC_T5735] = {
12404 .mixers = { alc262_hp_t5735_mixer },
12405 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12406 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12407 .dac_nids = alc262_dac_nids,
12409 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12410 .channel_mode = alc262_modes,
12411 .input_mux = &alc262_capture_source,
12412 .unsol_event = alc_sku_unsol_event,
12413 .setup = alc262_hp_t5735_setup,
12414 .init_hook = alc_inithook,
12416 [ALC262_HP_RP5700] = {
12417 .mixers = { alc262_hp_rp5700_mixer },
12418 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12419 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12420 .dac_nids = alc262_dac_nids,
12421 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12422 .channel_mode = alc262_modes,
12423 .input_mux = &alc262_hp_rp5700_capture_source,
12425 [ALC262_BENQ_ED8] = {
12426 .mixers = { alc262_base_mixer },
12427 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12428 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12429 .dac_nids = alc262_dac_nids,
12431 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12432 .channel_mode = alc262_modes,
12433 .input_mux = &alc262_capture_source,
12435 [ALC262_SONY_ASSAMD] = {
12436 .mixers = { alc262_sony_mixer },
12437 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12438 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12439 .dac_nids = alc262_dac_nids,
12441 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12442 .channel_mode = alc262_modes,
12443 .input_mux = &alc262_capture_source,
12444 .unsol_event = alc262_hippo_unsol_event,
12445 .setup = alc262_hippo_setup,
12446 .init_hook = alc262_hippo_automute,
12448 [ALC262_BENQ_T31] = {
12449 .mixers = { alc262_benq_t31_mixer },
12450 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12451 alc_hp15_unsol_verbs },
12452 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12453 .dac_nids = alc262_dac_nids,
12455 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12456 .channel_mode = alc262_modes,
12457 .input_mux = &alc262_capture_source,
12458 .unsol_event = alc262_hippo_unsol_event,
12459 .setup = alc262_hippo_setup,
12460 .init_hook = alc262_hippo_automute,
12463 .mixers = { alc262_ultra_mixer },
12464 .cap_mixer = alc262_ultra_capture_mixer,
12465 .init_verbs = { alc262_ultra_verbs },
12466 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12467 .dac_nids = alc262_dac_nids,
12468 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12469 .channel_mode = alc262_modes,
12470 .input_mux = &alc262_ultra_capture_source,
12471 .adc_nids = alc262_adc_nids, /* ADC0 */
12472 .capsrc_nids = alc262_capsrc_nids,
12473 .num_adc_nids = 1, /* single ADC */
12474 .unsol_event = alc262_ultra_unsol_event,
12475 .init_hook = alc262_ultra_automute,
12477 [ALC262_LENOVO_3000] = {
12478 .mixers = { alc262_lenovo_3000_mixer },
12479 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12480 alc262_lenovo_3000_unsol_verbs,
12481 alc262_lenovo_3000_init_verbs },
12482 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12483 .dac_nids = alc262_dac_nids,
12485 .dig_out_nid = ALC262_DIGOUT_NID,
12486 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12487 .channel_mode = alc262_modes,
12488 .input_mux = &alc262_fujitsu_capture_source,
12489 .unsol_event = alc262_lenovo_3000_unsol_event,
12492 .mixers = { alc262_nec_mixer },
12493 .init_verbs = { alc262_nec_verbs },
12494 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12495 .dac_nids = alc262_dac_nids,
12497 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12498 .channel_mode = alc262_modes,
12499 .input_mux = &alc262_capture_source,
12501 [ALC262_TOSHIBA_S06] = {
12502 .mixers = { alc262_toshiba_s06_mixer },
12503 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12504 alc262_eapd_verbs },
12505 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12506 .capsrc_nids = alc262_dmic_capsrc_nids,
12507 .dac_nids = alc262_dac_nids,
12508 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12509 .num_adc_nids = 1, /* single ADC */
12510 .dig_out_nid = ALC262_DIGOUT_NID,
12511 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12512 .channel_mode = alc262_modes,
12513 .unsol_event = alc_sku_unsol_event,
12514 .setup = alc262_toshiba_s06_setup,
12515 .init_hook = alc_inithook,
12517 [ALC262_TOSHIBA_RX1] = {
12518 .mixers = { alc262_toshiba_rx1_mixer },
12519 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12520 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12521 .dac_nids = alc262_dac_nids,
12523 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12524 .channel_mode = alc262_modes,
12525 .input_mux = &alc262_capture_source,
12526 .unsol_event = alc262_hippo_unsol_event,
12527 .setup = alc262_hippo_setup,
12528 .init_hook = alc262_hippo_automute,
12531 .mixers = { alc262_tyan_mixer },
12532 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12533 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12534 .dac_nids = alc262_dac_nids,
12536 .dig_out_nid = ALC262_DIGOUT_NID,
12537 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12538 .channel_mode = alc262_modes,
12539 .input_mux = &alc262_capture_source,
12540 .unsol_event = alc_automute_amp_unsol_event,
12541 .setup = alc262_tyan_setup,
12542 .init_hook = alc_automute_amp,
12546 static int patch_alc262(struct hda_codec *codec)
12548 struct alc_spec *spec;
12552 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12556 codec->spec = spec;
12558 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12563 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12564 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12565 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12566 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12569 alc_auto_parse_customize_define(codec);
12571 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12573 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12577 if (board_config < 0) {
12578 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12580 board_config = ALC262_AUTO;
12583 if (board_config == ALC262_AUTO) {
12584 /* automatic parse from the BIOS config */
12585 err = alc262_parse_auto_config(codec);
12591 "hda_codec: Cannot set up configuration "
12592 "from BIOS. Using base mode...\n");
12593 board_config = ALC262_BASIC;
12597 if (!spec->no_analog && has_cdefine_beep(codec)) {
12598 err = snd_hda_attach_beep_device(codec, 0x1);
12605 if (board_config != ALC262_AUTO)
12606 setup_preset(codec, &alc262_presets[board_config]);
12608 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12609 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12611 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12612 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12614 if (!spec->adc_nids && spec->input_mux) {
12616 /* check whether the digital-mic has to be supported */
12617 for (i = 0; i < spec->input_mux->num_items; i++) {
12618 if (spec->input_mux->items[i].index >= 9)
12621 if (i < spec->input_mux->num_items) {
12622 /* use only ADC0 */
12623 spec->adc_nids = alc262_dmic_adc_nids;
12624 spec->num_adc_nids = 1;
12625 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12627 /* all analog inputs */
12628 /* check whether NID 0x07 is valid */
12629 unsigned int wcap = get_wcaps(codec, 0x07);
12632 wcap = get_wcaps_type(wcap);
12633 if (wcap != AC_WID_AUD_IN) {
12634 spec->adc_nids = alc262_adc_nids_alt;
12635 spec->num_adc_nids =
12636 ARRAY_SIZE(alc262_adc_nids_alt);
12637 spec->capsrc_nids = alc262_capsrc_nids_alt;
12639 spec->adc_nids = alc262_adc_nids;
12640 spec->num_adc_nids =
12641 ARRAY_SIZE(alc262_adc_nids);
12642 spec->capsrc_nids = alc262_capsrc_nids;
12646 if (!spec->cap_mixer && !spec->no_analog)
12647 set_capture_mixer(codec);
12648 if (!spec->no_analog && has_cdefine_beep(codec))
12649 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12651 spec->vmaster_nid = 0x0c;
12653 codec->patch_ops = alc_patch_ops;
12654 if (board_config == ALC262_AUTO)
12655 spec->init_hook = alc262_auto_init;
12656 #ifdef CONFIG_SND_HDA_POWER_SAVE
12657 if (!spec->loopback.amplist)
12658 spec->loopback.amplist = alc262_loopbacks;
12665 * ALC268 channel source setting (2 channel)
12667 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12668 #define alc268_modes alc260_modes
12670 static hda_nid_t alc268_dac_nids[2] = {
12675 static hda_nid_t alc268_adc_nids[2] = {
12680 static hda_nid_t alc268_adc_nids_alt[1] = {
12685 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12687 static struct snd_kcontrol_new alc268_base_mixer[] = {
12688 /* output mixer control */
12689 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12690 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12693 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12694 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12695 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12699 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12700 /* output mixer control */
12701 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12703 ALC262_HIPPO_MASTER_SWITCH,
12704 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12705 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12706 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12710 /* bind Beep switches of both NID 0x0f and 0x10 */
12711 static struct hda_bind_ctls alc268_bind_beep_sw = {
12712 .ops = &snd_hda_bind_sw,
12714 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12715 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12720 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12721 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12722 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12726 static struct hda_verb alc268_eapd_verbs[] = {
12727 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12728 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12732 /* Toshiba specific */
12733 static struct hda_verb alc268_toshiba_verbs[] = {
12734 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12738 /* Acer specific */
12739 /* bind volumes of both NID 0x02 and 0x03 */
12740 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12741 .ops = &snd_hda_bind_vol,
12743 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12744 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12749 /* mute/unmute internal speaker according to the hp jack and mute state */
12750 static void alc268_acer_automute(struct hda_codec *codec, int force)
12752 struct alc_spec *spec = codec->spec;
12755 if (force || !spec->sense_updated) {
12756 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12757 spec->sense_updated = 1;
12759 if (spec->jack_present)
12760 mute = HDA_AMP_MUTE; /* mute internal speaker */
12761 else /* unmute internal speaker if necessary */
12762 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12763 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12764 HDA_AMP_MUTE, mute);
12768 /* bind hp and internal speaker mute (with plug check) */
12769 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12770 struct snd_ctl_elem_value *ucontrol)
12772 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12773 long *valp = ucontrol->value.integer.value;
12776 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12778 alc268_acer_automute(codec, 0);
12782 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12783 /* output mixer control */
12784 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12786 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12787 .name = "Master Playback Switch",
12788 .subdevice = HDA_SUBDEV_AMP_FLAG,
12789 .info = snd_hda_mixer_amp_switch_info,
12790 .get = snd_hda_mixer_amp_switch_get,
12791 .put = alc268_acer_master_sw_put,
12792 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12794 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12798 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12799 /* output mixer control */
12800 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12802 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12803 .name = "Master Playback Switch",
12804 .subdevice = HDA_SUBDEV_AMP_FLAG,
12805 .info = snd_hda_mixer_amp_switch_info,
12806 .get = snd_hda_mixer_amp_switch_get,
12807 .put = alc268_acer_master_sw_put,
12808 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12810 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12811 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12812 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12816 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12817 /* output mixer control */
12818 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12820 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12821 .name = "Master Playback Switch",
12822 .subdevice = HDA_SUBDEV_AMP_FLAG,
12823 .info = snd_hda_mixer_amp_switch_info,
12824 .get = snd_hda_mixer_amp_switch_get,
12825 .put = alc268_acer_master_sw_put,
12826 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12828 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12829 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12833 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12834 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12836 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12837 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12838 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12843 static struct hda_verb alc268_acer_verbs[] = {
12844 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12845 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12848 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12850 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12854 /* unsolicited event for HP jack sensing */
12855 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12856 #define alc268_toshiba_setup alc262_hippo_setup
12857 #define alc268_toshiba_automute alc262_hippo_automute
12859 static void alc268_acer_unsol_event(struct hda_codec *codec,
12862 if ((res >> 26) != ALC880_HP_EVENT)
12864 alc268_acer_automute(codec, 1);
12867 static void alc268_acer_init_hook(struct hda_codec *codec)
12869 alc268_acer_automute(codec, 1);
12872 /* toggle speaker-output according to the hp-jack state */
12873 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12875 unsigned int present;
12876 unsigned char bits;
12878 present = snd_hda_jack_detect(codec, 0x15);
12879 bits = present ? HDA_AMP_MUTE : 0;
12880 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12881 HDA_AMP_MUTE, bits);
12882 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12883 HDA_AMP_MUTE, bits);
12886 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12889 switch (res >> 26) {
12890 case ALC880_HP_EVENT:
12891 alc268_aspire_one_speaker_automute(codec);
12893 case ALC880_MIC_EVENT:
12894 alc_mic_automute(codec);
12899 static void alc268_acer_lc_setup(struct hda_codec *codec)
12901 struct alc_spec *spec = codec->spec;
12902 spec->ext_mic.pin = 0x18;
12903 spec->ext_mic.mux_idx = 0;
12904 spec->int_mic.pin = 0x12;
12905 spec->int_mic.mux_idx = 6;
12906 spec->auto_mic = 1;
12909 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12911 alc268_aspire_one_speaker_automute(codec);
12912 alc_mic_automute(codec);
12915 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12916 /* output mixer control */
12917 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12918 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12919 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12920 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12922 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12926 static struct hda_verb alc268_dell_verbs[] = {
12927 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12928 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12930 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12934 /* mute/unmute internal speaker according to the hp jack and mute state */
12935 static void alc268_dell_setup(struct hda_codec *codec)
12937 struct alc_spec *spec = codec->spec;
12939 spec->autocfg.hp_pins[0] = 0x15;
12940 spec->autocfg.speaker_pins[0] = 0x14;
12941 spec->ext_mic.pin = 0x18;
12942 spec->ext_mic.mux_idx = 0;
12943 spec->int_mic.pin = 0x19;
12944 spec->int_mic.mux_idx = 1;
12945 spec->auto_mic = 1;
12948 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12949 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12950 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12951 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12952 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12953 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12954 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12955 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12956 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12960 static struct hda_verb alc267_quanta_il1_verbs[] = {
12961 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12962 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12966 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12968 struct alc_spec *spec = codec->spec;
12969 spec->autocfg.hp_pins[0] = 0x15;
12970 spec->autocfg.speaker_pins[0] = 0x14;
12971 spec->ext_mic.pin = 0x18;
12972 spec->ext_mic.mux_idx = 0;
12973 spec->int_mic.pin = 0x19;
12974 spec->int_mic.mux_idx = 1;
12975 spec->auto_mic = 1;
12979 * generic initialization of ADC, input mixers and output mixers
12981 static struct hda_verb alc268_base_init_verbs[] = {
12982 /* Unmute DAC0-1 and set vol = 0 */
12983 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12984 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12987 * Set up output mixers (0x0c - 0x0e)
12989 /* set vol=0 to output mixers */
12990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12991 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12993 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12994 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12999 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13000 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13001 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13002 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13003 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13005 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13007 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13011 /* set PCBEEP vol = 0, mute connections */
13012 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13013 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13014 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13016 /* Unmute Selector 23h,24h and set the default input to mic-in */
13018 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13019 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13020 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13021 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13027 * generic initialization of ADC, input mixers and output mixers
13029 static struct hda_verb alc268_volume_init_verbs[] = {
13030 /* set output DAC */
13031 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13032 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13034 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13036 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13037 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13038 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13040 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13041 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13042 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13044 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13047 /* set PCBEEP vol = 0, mute connections */
13048 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13049 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13050 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13055 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13056 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13057 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13061 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13062 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13063 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13068 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13069 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13070 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13071 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13072 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13077 static struct hda_input_mux alc268_capture_source = {
13081 { "Front Mic", 0x1 },
13087 static struct hda_input_mux alc268_acer_capture_source = {
13091 { "Internal Mic", 0x1 },
13096 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13100 { "Internal Mic", 0x6 },
13105 #ifdef CONFIG_SND_DEBUG
13106 static struct snd_kcontrol_new alc268_test_mixer[] = {
13107 /* Volume widgets */
13108 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13109 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13110 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13111 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13112 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13113 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13114 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13115 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13116 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13117 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13118 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13119 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13120 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13121 /* The below appears problematic on some hardwares */
13122 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13123 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13124 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13125 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13126 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13128 /* Modes for retasking pin widgets */
13129 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13130 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13131 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13132 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13134 /* Controls for GPIO pins, assuming they are configured as outputs */
13135 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13136 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13137 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13138 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13140 /* Switches to allow the digital SPDIF output pin to be enabled.
13141 * The ALC268 does not have an SPDIF input.
13143 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13145 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13146 * this output to turn on an external amplifier.
13148 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13149 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13155 /* create input playback/capture controls for the given pin */
13156 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13157 const char *ctlname, int idx)
13168 case 0x1a: /* ALC259/269 only */
13169 case 0x1b: /* ALC259/269 only */
13170 case 0x21: /* ALC269vb has this pin, too */
13174 snd_printd(KERN_WARNING "hda_codec: "
13175 "ignoring pin 0x%x as unknown\n", nid);
13178 if (spec->multiout.dac_nids[0] != dac &&
13179 spec->multiout.dac_nids[1] != dac) {
13180 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13181 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13185 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13189 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13190 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13192 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13193 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13199 /* add playback controls from the parsed DAC table */
13200 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13201 const struct auto_pin_cfg *cfg)
13206 spec->multiout.dac_nids = spec->private_dac_nids;
13208 nid = cfg->line_out_pins[0];
13211 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13215 err = alc268_new_analog_output(spec, nid, name, 0);
13220 nid = cfg->speaker_pins[0];
13222 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13223 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13227 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13231 nid = cfg->hp_pins[0];
13233 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13238 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13240 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13241 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13248 /* create playback/capture controls for input pins */
13249 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13250 const struct auto_pin_cfg *cfg)
13252 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13255 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13256 hda_nid_t nid, int pin_type)
13260 alc_set_pin_output(codec, nid, pin_type);
13261 if (nid == 0x14 || nid == 0x16)
13265 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13268 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13270 struct alc_spec *spec = codec->spec;
13271 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13273 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13274 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13278 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13280 struct alc_spec *spec = codec->spec;
13283 pin = spec->autocfg.hp_pins[0];
13285 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13286 pin = spec->autocfg.speaker_pins[0];
13288 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13291 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13293 struct alc_spec *spec = codec->spec;
13294 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13295 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13296 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13297 unsigned int dac_vol1, dac_vol2;
13299 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13300 snd_hda_codec_write(codec, speaker_nid, 0,
13301 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13302 /* mute mixer inputs from 0x1d */
13303 snd_hda_codec_write(codec, 0x0f, 0,
13304 AC_VERB_SET_AMP_GAIN_MUTE,
13306 snd_hda_codec_write(codec, 0x10, 0,
13307 AC_VERB_SET_AMP_GAIN_MUTE,
13310 /* unmute mixer inputs from 0x1d */
13311 snd_hda_codec_write(codec, 0x0f, 0,
13312 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13313 snd_hda_codec_write(codec, 0x10, 0,
13314 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13317 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13318 if (line_nid == 0x14)
13319 dac_vol2 = AMP_OUT_ZERO;
13320 else if (line_nid == 0x15)
13321 dac_vol1 = AMP_OUT_ZERO;
13322 if (hp_nid == 0x14)
13323 dac_vol2 = AMP_OUT_ZERO;
13324 else if (hp_nid == 0x15)
13325 dac_vol1 = AMP_OUT_ZERO;
13326 if (line_nid != 0x16 || hp_nid != 0x16 ||
13327 spec->autocfg.line_out_pins[1] != 0x16 ||
13328 spec->autocfg.line_out_pins[2] != 0x16)
13329 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13331 snd_hda_codec_write(codec, 0x02, 0,
13332 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13333 snd_hda_codec_write(codec, 0x03, 0,
13334 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13337 /* pcm configuration: identical with ALC880 */
13338 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13339 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13340 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13341 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13344 * BIOS auto configuration
13346 static int alc268_parse_auto_config(struct hda_codec *codec)
13348 struct alc_spec *spec = codec->spec;
13350 static hda_nid_t alc268_ignore[] = { 0 };
13352 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13356 if (!spec->autocfg.line_outs) {
13357 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13358 spec->multiout.max_channels = 2;
13359 spec->no_analog = 1;
13362 return 0; /* can't find valid BIOS pin config */
13364 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13367 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13371 spec->multiout.max_channels = 2;
13374 /* digital only support output */
13375 alc_auto_parse_digital(codec);
13376 if (spec->kctls.list)
13377 add_mixer(spec, spec->kctls.list);
13379 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13380 add_mixer(spec, alc268_beep_mixer);
13382 add_verb(spec, alc268_volume_init_verbs);
13383 spec->num_mux_defs = 2;
13384 spec->input_mux = &spec->private_imux[0];
13386 err = alc_auto_add_mic_boost(codec);
13390 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13395 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13397 /* init callback for auto-configuration model -- overriding the default init */
13398 static void alc268_auto_init(struct hda_codec *codec)
13400 struct alc_spec *spec = codec->spec;
13401 alc268_auto_init_multi_out(codec);
13402 alc268_auto_init_hp_out(codec);
13403 alc268_auto_init_mono_speaker_out(codec);
13404 alc268_auto_init_analog_input(codec);
13405 alc_auto_init_digital(codec);
13406 if (spec->unsol_event)
13407 alc_inithook(codec);
13411 * configuration and preset
13413 static const char *alc268_models[ALC268_MODEL_LAST] = {
13414 [ALC267_QUANTA_IL1] = "quanta-il1",
13415 [ALC268_3ST] = "3stack",
13416 [ALC268_TOSHIBA] = "toshiba",
13417 [ALC268_ACER] = "acer",
13418 [ALC268_ACER_DMIC] = "acer-dmic",
13419 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13420 [ALC268_DELL] = "dell",
13421 [ALC268_ZEPTO] = "zepto",
13422 #ifdef CONFIG_SND_DEBUG
13423 [ALC268_TEST] = "test",
13425 [ALC268_AUTO] = "auto",
13428 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13429 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13430 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13431 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13432 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13433 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13434 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13435 ALC268_ACER_ASPIRE_ONE),
13436 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13437 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13438 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13439 /* almost compatible with toshiba but with optional digital outs;
13440 * auto-probing seems working fine
13442 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13444 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13445 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13446 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13447 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13448 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13449 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13453 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13454 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13455 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13456 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13457 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13462 static struct alc_config_preset alc268_presets[] = {
13463 [ALC267_QUANTA_IL1] = {
13464 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13465 alc268_capture_nosrc_mixer },
13466 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13467 alc267_quanta_il1_verbs },
13468 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13469 .dac_nids = alc268_dac_nids,
13470 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13471 .adc_nids = alc268_adc_nids_alt,
13473 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13474 .channel_mode = alc268_modes,
13475 .unsol_event = alc_sku_unsol_event,
13476 .setup = alc267_quanta_il1_setup,
13477 .init_hook = alc_inithook,
13480 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13481 alc268_beep_mixer },
13482 .init_verbs = { alc268_base_init_verbs },
13483 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13484 .dac_nids = alc268_dac_nids,
13485 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13486 .adc_nids = alc268_adc_nids_alt,
13487 .capsrc_nids = alc268_capsrc_nids,
13489 .dig_out_nid = ALC268_DIGOUT_NID,
13490 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13491 .channel_mode = alc268_modes,
13492 .input_mux = &alc268_capture_source,
13494 [ALC268_TOSHIBA] = {
13495 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13496 alc268_beep_mixer },
13497 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13498 alc268_toshiba_verbs },
13499 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13500 .dac_nids = alc268_dac_nids,
13501 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13502 .adc_nids = alc268_adc_nids_alt,
13503 .capsrc_nids = alc268_capsrc_nids,
13505 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13506 .channel_mode = alc268_modes,
13507 .input_mux = &alc268_capture_source,
13508 .unsol_event = alc268_toshiba_unsol_event,
13509 .setup = alc268_toshiba_setup,
13510 .init_hook = alc268_toshiba_automute,
13513 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13514 alc268_beep_mixer },
13515 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13516 alc268_acer_verbs },
13517 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13518 .dac_nids = alc268_dac_nids,
13519 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13520 .adc_nids = alc268_adc_nids_alt,
13521 .capsrc_nids = alc268_capsrc_nids,
13523 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13524 .channel_mode = alc268_modes,
13525 .input_mux = &alc268_acer_capture_source,
13526 .unsol_event = alc268_acer_unsol_event,
13527 .init_hook = alc268_acer_init_hook,
13529 [ALC268_ACER_DMIC] = {
13530 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13531 alc268_beep_mixer },
13532 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13533 alc268_acer_verbs },
13534 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13535 .dac_nids = alc268_dac_nids,
13536 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13537 .adc_nids = alc268_adc_nids_alt,
13538 .capsrc_nids = alc268_capsrc_nids,
13540 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13541 .channel_mode = alc268_modes,
13542 .input_mux = &alc268_acer_dmic_capture_source,
13543 .unsol_event = alc268_acer_unsol_event,
13544 .init_hook = alc268_acer_init_hook,
13546 [ALC268_ACER_ASPIRE_ONE] = {
13547 .mixers = { alc268_acer_aspire_one_mixer,
13549 alc268_capture_nosrc_mixer },
13550 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13551 alc268_acer_aspire_one_verbs },
13552 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13553 .dac_nids = alc268_dac_nids,
13554 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13555 .adc_nids = alc268_adc_nids_alt,
13556 .capsrc_nids = alc268_capsrc_nids,
13558 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13559 .channel_mode = alc268_modes,
13560 .unsol_event = alc268_acer_lc_unsol_event,
13561 .setup = alc268_acer_lc_setup,
13562 .init_hook = alc268_acer_lc_init_hook,
13565 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13566 alc268_capture_nosrc_mixer },
13567 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13568 alc268_dell_verbs },
13569 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13570 .dac_nids = alc268_dac_nids,
13571 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13572 .adc_nids = alc268_adc_nids_alt,
13573 .capsrc_nids = alc268_capsrc_nids,
13575 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13576 .channel_mode = alc268_modes,
13577 .unsol_event = alc_sku_unsol_event,
13578 .setup = alc268_dell_setup,
13579 .init_hook = alc_inithook,
13582 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13583 alc268_beep_mixer },
13584 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13585 alc268_toshiba_verbs },
13586 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13587 .dac_nids = alc268_dac_nids,
13588 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13589 .adc_nids = alc268_adc_nids_alt,
13590 .capsrc_nids = alc268_capsrc_nids,
13592 .dig_out_nid = ALC268_DIGOUT_NID,
13593 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13594 .channel_mode = alc268_modes,
13595 .input_mux = &alc268_capture_source,
13596 .setup = alc268_toshiba_setup,
13597 .init_hook = alc268_toshiba_automute,
13599 #ifdef CONFIG_SND_DEBUG
13601 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13602 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13603 alc268_volume_init_verbs },
13604 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13605 .dac_nids = alc268_dac_nids,
13606 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13607 .adc_nids = alc268_adc_nids_alt,
13608 .capsrc_nids = alc268_capsrc_nids,
13610 .dig_out_nid = ALC268_DIGOUT_NID,
13611 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13612 .channel_mode = alc268_modes,
13613 .input_mux = &alc268_capture_source,
13618 static int patch_alc268(struct hda_codec *codec)
13620 struct alc_spec *spec;
13622 int i, has_beep, err;
13624 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13628 codec->spec = spec;
13630 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13634 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13635 board_config = snd_hda_check_board_codec_sid_config(codec,
13636 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13638 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13639 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13641 board_config = ALC268_AUTO;
13644 if (board_config == ALC268_AUTO) {
13645 /* automatic parse from the BIOS config */
13646 err = alc268_parse_auto_config(codec);
13652 "hda_codec: Cannot set up configuration "
13653 "from BIOS. Using base mode...\n");
13654 board_config = ALC268_3ST;
13658 if (board_config != ALC268_AUTO)
13659 setup_preset(codec, &alc268_presets[board_config]);
13661 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13662 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13663 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13665 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13668 for (i = 0; i < spec->num_mixers; i++) {
13669 if (spec->mixers[i] == alc268_beep_mixer) {
13676 err = snd_hda_attach_beep_device(codec, 0x1);
13681 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13682 /* override the amp caps for beep generator */
13683 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13684 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13685 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13686 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13687 (0 << AC_AMPCAP_MUTE_SHIFT));
13690 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13691 /* check whether NID 0x07 is valid */
13692 unsigned int wcap = get_wcaps(codec, 0x07);
13695 spec->capsrc_nids = alc268_capsrc_nids;
13697 wcap = get_wcaps_type(wcap);
13698 if (spec->auto_mic ||
13699 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13700 spec->adc_nids = alc268_adc_nids_alt;
13701 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13702 if (spec->auto_mic)
13703 fixup_automic_adc(codec);
13704 if (spec->auto_mic || spec->input_mux->num_items == 1)
13705 add_mixer(spec, alc268_capture_nosrc_mixer);
13707 add_mixer(spec, alc268_capture_alt_mixer);
13709 spec->adc_nids = alc268_adc_nids;
13710 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13711 add_mixer(spec, alc268_capture_mixer);
13713 /* set default input source */
13714 for (i = 0; i < spec->num_adc_nids; i++)
13715 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13716 0, AC_VERB_SET_CONNECT_SEL,
13717 i < spec->num_mux_defs ?
13718 spec->input_mux[i].items[0].index :
13719 spec->input_mux->items[0].index);
13722 spec->vmaster_nid = 0x02;
13724 codec->patch_ops = alc_patch_ops;
13725 if (board_config == ALC268_AUTO)
13726 spec->init_hook = alc268_auto_init;
13732 * ALC269 channel source setting (2 channel)
13734 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13736 #define alc269_dac_nids alc260_dac_nids
13738 static hda_nid_t alc269_adc_nids[1] = {
13743 static hda_nid_t alc269_capsrc_nids[1] = {
13747 static hda_nid_t alc269vb_adc_nids[1] = {
13752 static hda_nid_t alc269vb_capsrc_nids[1] = {
13756 static hda_nid_t alc269_adc_candidates[] = {
13760 #define alc269_modes alc260_modes
13761 #define alc269_capture_source alc880_lg_lw_capture_source
13763 static struct snd_kcontrol_new alc269_base_mixer[] = {
13764 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13765 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13766 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13767 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13769 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13770 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13771 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13772 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13773 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13775 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13779 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13780 /* output mixer control */
13781 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13784 .name = "Master Playback Switch",
13785 .subdevice = HDA_SUBDEV_AMP_FLAG,
13786 .info = snd_hda_mixer_amp_switch_info,
13787 .get = snd_hda_mixer_amp_switch_get,
13788 .put = alc268_acer_master_sw_put,
13789 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13792 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13794 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13795 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13796 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13800 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13801 /* output mixer control */
13802 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13804 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13805 .name = "Master Playback Switch",
13806 .subdevice = HDA_SUBDEV_AMP_FLAG,
13807 .info = snd_hda_mixer_amp_switch_info,
13808 .get = snd_hda_mixer_amp_switch_get,
13809 .put = alc268_acer_master_sw_put,
13810 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13814 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13815 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13816 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13817 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13818 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13819 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13820 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13824 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13825 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13826 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13828 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13832 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13833 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13834 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13835 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13840 /* capture mixer elements */
13841 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13842 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13843 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13845 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13849 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13850 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13851 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13852 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13856 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13857 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13858 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13859 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13860 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13864 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13865 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13866 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13872 #define alc269_fujitsu_mixer alc269_laptop_mixer
13874 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13875 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13876 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13878 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13880 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13884 static struct hda_verb alc269_lifebook_verbs[] = {
13885 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13886 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13887 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13888 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13889 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13890 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13892 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13893 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13894 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13898 /* toggle speaker-output according to the hp-jack state */
13899 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13901 unsigned int present;
13902 unsigned char bits;
13904 present = snd_hda_jack_detect(codec, 0x15);
13905 bits = present ? HDA_AMP_MUTE : 0;
13906 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13907 HDA_AMP_MUTE, bits);
13908 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13909 HDA_AMP_MUTE, bits);
13911 snd_hda_codec_write(codec, 0x20, 0,
13912 AC_VERB_SET_COEF_INDEX, 0x0c);
13913 snd_hda_codec_write(codec, 0x20, 0,
13914 AC_VERB_SET_PROC_COEF, 0x680);
13916 snd_hda_codec_write(codec, 0x20, 0,
13917 AC_VERB_SET_COEF_INDEX, 0x0c);
13918 snd_hda_codec_write(codec, 0x20, 0,
13919 AC_VERB_SET_PROC_COEF, 0x480);
13922 /* toggle speaker-output according to the hp-jacks state */
13923 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13925 unsigned int present;
13926 unsigned char bits;
13928 /* Check laptop headphone socket */
13929 present = snd_hda_jack_detect(codec, 0x15);
13931 /* Check port replicator headphone socket */
13932 present |= snd_hda_jack_detect(codec, 0x1a);
13934 bits = present ? HDA_AMP_MUTE : 0;
13935 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13936 HDA_AMP_MUTE, bits);
13937 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13938 HDA_AMP_MUTE, bits);
13940 snd_hda_codec_write(codec, 0x20, 0,
13941 AC_VERB_SET_COEF_INDEX, 0x0c);
13942 snd_hda_codec_write(codec, 0x20, 0,
13943 AC_VERB_SET_PROC_COEF, 0x680);
13945 snd_hda_codec_write(codec, 0x20, 0,
13946 AC_VERB_SET_COEF_INDEX, 0x0c);
13947 snd_hda_codec_write(codec, 0x20, 0,
13948 AC_VERB_SET_PROC_COEF, 0x480);
13951 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13953 unsigned int present_laptop;
13954 unsigned int present_dock;
13956 present_laptop = snd_hda_jack_detect(codec, 0x18);
13957 present_dock = snd_hda_jack_detect(codec, 0x1b);
13959 /* Laptop mic port overrides dock mic port, design decision */
13961 snd_hda_codec_write(codec, 0x23, 0,
13962 AC_VERB_SET_CONNECT_SEL, 0x3);
13963 if (present_laptop)
13964 snd_hda_codec_write(codec, 0x23, 0,
13965 AC_VERB_SET_CONNECT_SEL, 0x0);
13966 if (!present_dock && !present_laptop)
13967 snd_hda_codec_write(codec, 0x23, 0,
13968 AC_VERB_SET_CONNECT_SEL, 0x1);
13971 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13974 switch (res >> 26) {
13975 case ALC880_HP_EVENT:
13976 alc269_quanta_fl1_speaker_automute(codec);
13978 case ALC880_MIC_EVENT:
13979 alc_mic_automute(codec);
13984 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13987 if ((res >> 26) == ALC880_HP_EVENT)
13988 alc269_lifebook_speaker_automute(codec);
13989 if ((res >> 26) == ALC880_MIC_EVENT)
13990 alc269_lifebook_mic_autoswitch(codec);
13993 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13995 struct alc_spec *spec = codec->spec;
13996 spec->autocfg.hp_pins[0] = 0x15;
13997 spec->autocfg.speaker_pins[0] = 0x14;
13998 spec->ext_mic.pin = 0x18;
13999 spec->ext_mic.mux_idx = 0;
14000 spec->int_mic.pin = 0x19;
14001 spec->int_mic.mux_idx = 1;
14002 spec->auto_mic = 1;
14005 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14007 alc269_quanta_fl1_speaker_automute(codec);
14008 alc_mic_automute(codec);
14011 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14013 alc269_lifebook_speaker_automute(codec);
14014 alc269_lifebook_mic_autoswitch(codec);
14017 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14019 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14020 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14021 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14022 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14023 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14024 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14028 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14029 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14030 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14031 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14032 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14033 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14034 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14038 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14039 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14040 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14041 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14042 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14043 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14044 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14045 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14049 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14050 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14051 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14052 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14053 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14054 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14055 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14056 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14060 /* toggle speaker-output according to the hp-jack state */
14061 static void alc269_speaker_automute(struct hda_codec *codec)
14063 struct alc_spec *spec = codec->spec;
14064 unsigned int nid = spec->autocfg.hp_pins[0];
14065 unsigned int present;
14066 unsigned char bits;
14068 present = snd_hda_jack_detect(codec, nid);
14069 bits = present ? HDA_AMP_MUTE : 0;
14070 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14071 HDA_AMP_MUTE, bits);
14072 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14073 HDA_AMP_MUTE, bits);
14076 /* unsolicited event for HP jack sensing */
14077 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14080 switch (res >> 26) {
14081 case ALC880_HP_EVENT:
14082 alc269_speaker_automute(codec);
14084 case ALC880_MIC_EVENT:
14085 alc_mic_automute(codec);
14090 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14092 struct alc_spec *spec = codec->spec;
14093 spec->autocfg.hp_pins[0] = 0x15;
14094 spec->autocfg.speaker_pins[0] = 0x14;
14095 spec->ext_mic.pin = 0x18;
14096 spec->ext_mic.mux_idx = 0;
14097 spec->int_mic.pin = 0x19;
14098 spec->int_mic.mux_idx = 1;
14099 spec->auto_mic = 1;
14102 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14104 struct alc_spec *spec = codec->spec;
14105 spec->autocfg.hp_pins[0] = 0x15;
14106 spec->autocfg.speaker_pins[0] = 0x14;
14107 spec->ext_mic.pin = 0x18;
14108 spec->ext_mic.mux_idx = 0;
14109 spec->int_mic.pin = 0x12;
14110 spec->int_mic.mux_idx = 5;
14111 spec->auto_mic = 1;
14114 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14116 struct alc_spec *spec = codec->spec;
14117 spec->autocfg.hp_pins[0] = 0x21;
14118 spec->autocfg.speaker_pins[0] = 0x14;
14119 spec->ext_mic.pin = 0x18;
14120 spec->ext_mic.mux_idx = 0;
14121 spec->int_mic.pin = 0x19;
14122 spec->int_mic.mux_idx = 1;
14123 spec->auto_mic = 1;
14126 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14128 struct alc_spec *spec = codec->spec;
14129 spec->autocfg.hp_pins[0] = 0x21;
14130 spec->autocfg.speaker_pins[0] = 0x14;
14131 spec->ext_mic.pin = 0x18;
14132 spec->ext_mic.mux_idx = 0;
14133 spec->int_mic.pin = 0x12;
14134 spec->int_mic.mux_idx = 6;
14135 spec->auto_mic = 1;
14138 static void alc269_laptop_inithook(struct hda_codec *codec)
14140 alc269_speaker_automute(codec);
14141 alc_mic_automute(codec);
14145 * generic initialization of ADC, input mixers and output mixers
14147 static struct hda_verb alc269_init_verbs[] = {
14149 * Unmute ADC0 and set the default input to mic-in
14151 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14154 * Set up output mixers (0x02 - 0x03)
14156 /* set vol=0 to output mixers */
14157 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14158 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14160 /* set up input amps for analog loopback */
14161 /* Amp Indices: DAC = 0, mixer = 1 */
14162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14163 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14164 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14165 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14166 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14167 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14169 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14170 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14171 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14173 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14174 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14175 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14180 /* FIXME: use Mux-type input source selection */
14181 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14182 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14183 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14186 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14190 static struct hda_verb alc269vb_init_verbs[] = {
14192 * Unmute ADC0 and set the default input to mic-in
14194 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14197 * Set up output mixers (0x02 - 0x03)
14199 /* set vol=0 to output mixers */
14200 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14201 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14203 /* set up input amps for analog loopback */
14204 /* Amp Indices: DAC = 0, mixer = 1 */
14205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14207 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14209 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14210 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14213 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14214 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14215 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14217 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14221 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14223 /* FIXME: use Mux-type input source selection */
14224 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14225 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14226 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14229 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14233 #define alc269_auto_create_multi_out_ctls \
14234 alc268_auto_create_multi_out_ctls
14235 #define alc269_auto_create_input_ctls \
14236 alc268_auto_create_input_ctls
14238 #ifdef CONFIG_SND_HDA_POWER_SAVE
14239 #define alc269_loopbacks alc880_loopbacks
14242 /* pcm configuration: identical with ALC880 */
14243 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14244 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14245 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14246 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14248 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14252 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14253 /* NID is set in alc_build_pcms */
14255 .open = alc880_playback_pcm_open,
14256 .prepare = alc880_playback_pcm_prepare,
14257 .cleanup = alc880_playback_pcm_cleanup
14261 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14265 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14266 /* NID is set in alc_build_pcms */
14269 #ifdef CONFIG_SND_HDA_POWER_SAVE
14270 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14272 switch (codec->subsystem_id) {
14279 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14281 /* update mute-LED according to the speaker mute state */
14282 if (nid == 0x01 || nid == 0x14) {
14284 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14289 /* mic2 vref pin is used for mute LED control */
14290 snd_hda_codec_update_cache(codec, 0x19, 0,
14291 AC_VERB_SET_PIN_WIDGET_CONTROL,
14294 return alc_check_power_status(codec, nid);
14296 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14298 static int alc275_setup_dual_adc(struct hda_codec *codec)
14300 struct alc_spec *spec = codec->spec;
14302 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14304 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14305 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14306 if (spec->ext_mic.pin <= 0x12) {
14307 spec->private_adc_nids[0] = 0x08;
14308 spec->private_adc_nids[1] = 0x11;
14309 spec->private_capsrc_nids[0] = 0x23;
14310 spec->private_capsrc_nids[1] = 0x22;
14312 spec->private_adc_nids[0] = 0x11;
14313 spec->private_adc_nids[1] = 0x08;
14314 spec->private_capsrc_nids[0] = 0x22;
14315 spec->private_capsrc_nids[1] = 0x23;
14317 spec->adc_nids = spec->private_adc_nids;
14318 spec->capsrc_nids = spec->private_capsrc_nids;
14319 spec->num_adc_nids = 2;
14320 spec->dual_adc_switch = 1;
14321 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14322 spec->adc_nids[0], spec->adc_nids[1]);
14329 * BIOS auto configuration
14331 static int alc269_parse_auto_config(struct hda_codec *codec)
14333 struct alc_spec *spec = codec->spec;
14335 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14337 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14342 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14345 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14349 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14351 alc_auto_parse_digital(codec);
14353 if (spec->kctls.list)
14354 add_mixer(spec, spec->kctls.list);
14356 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14357 add_verb(spec, alc269vb_init_verbs);
14358 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14360 add_verb(spec, alc269_init_verbs);
14361 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14364 spec->num_mux_defs = 1;
14365 spec->input_mux = &spec->private_imux[0];
14367 if (!alc275_setup_dual_adc(codec))
14368 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14369 sizeof(alc269_adc_candidates));
14371 /* set default input source */
14372 if (!spec->dual_adc_switch)
14373 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14374 spec->input_mux->items[0].index);
14376 err = alc_auto_add_mic_boost(codec);
14380 if (!spec->cap_mixer && !spec->no_analog)
14381 set_capture_mixer(codec);
14386 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14387 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14388 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14391 /* init callback for auto-configuration model -- overriding the default init */
14392 static void alc269_auto_init(struct hda_codec *codec)
14394 struct alc_spec *spec = codec->spec;
14395 alc269_auto_init_multi_out(codec);
14396 alc269_auto_init_hp_out(codec);
14397 alc269_auto_init_analog_input(codec);
14398 alc_auto_init_digital(codec);
14399 if (spec->unsol_event)
14400 alc_inithook(codec);
14404 ALC269_FIXUP_SONY_VAIO,
14407 static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = {
14408 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14412 static const struct alc_fixup alc269_fixups[] = {
14413 [ALC269_FIXUP_SONY_VAIO] = {
14414 .verbs = alc269_sony_vaio_fixup_verbs
14418 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14419 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14425 * configuration and preset
14427 static const char *alc269_models[ALC269_MODEL_LAST] = {
14428 [ALC269_BASIC] = "basic",
14429 [ALC269_QUANTA_FL1] = "quanta",
14430 [ALC269_AMIC] = "laptop-amic",
14431 [ALC269_DMIC] = "laptop-dmic",
14432 [ALC269_FUJITSU] = "fujitsu",
14433 [ALC269_LIFEBOOK] = "lifebook",
14434 [ALC269_AUTO] = "auto",
14437 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14438 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14439 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14441 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14442 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14443 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14444 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14445 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14446 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14447 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14448 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14449 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14450 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14451 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14452 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14453 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14454 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14455 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14456 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14457 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14458 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14459 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14460 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14461 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14462 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14463 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14464 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14465 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14466 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14467 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14468 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14469 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14470 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14471 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14472 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14473 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14474 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14475 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14476 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14477 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14479 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14481 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14482 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14483 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14484 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14485 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14486 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14487 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14488 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14489 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14490 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14494 static struct alc_config_preset alc269_presets[] = {
14496 .mixers = { alc269_base_mixer },
14497 .init_verbs = { alc269_init_verbs },
14498 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14499 .dac_nids = alc269_dac_nids,
14501 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14502 .channel_mode = alc269_modes,
14503 .input_mux = &alc269_capture_source,
14505 [ALC269_QUANTA_FL1] = {
14506 .mixers = { alc269_quanta_fl1_mixer },
14507 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14508 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14509 .dac_nids = alc269_dac_nids,
14511 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14512 .channel_mode = alc269_modes,
14513 .input_mux = &alc269_capture_source,
14514 .unsol_event = alc269_quanta_fl1_unsol_event,
14515 .setup = alc269_quanta_fl1_setup,
14516 .init_hook = alc269_quanta_fl1_init_hook,
14519 .mixers = { alc269_laptop_mixer },
14520 .cap_mixer = alc269_laptop_analog_capture_mixer,
14521 .init_verbs = { alc269_init_verbs,
14522 alc269_laptop_amic_init_verbs },
14523 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14524 .dac_nids = alc269_dac_nids,
14526 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14527 .channel_mode = alc269_modes,
14528 .unsol_event = alc269_laptop_unsol_event,
14529 .setup = alc269_laptop_amic_setup,
14530 .init_hook = alc269_laptop_inithook,
14533 .mixers = { alc269_laptop_mixer },
14534 .cap_mixer = alc269_laptop_digital_capture_mixer,
14535 .init_verbs = { alc269_init_verbs,
14536 alc269_laptop_dmic_init_verbs },
14537 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14538 .dac_nids = alc269_dac_nids,
14540 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14541 .channel_mode = alc269_modes,
14542 .unsol_event = alc269_laptop_unsol_event,
14543 .setup = alc269_laptop_dmic_setup,
14544 .init_hook = alc269_laptop_inithook,
14546 [ALC269VB_AMIC] = {
14547 .mixers = { alc269vb_laptop_mixer },
14548 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14549 .init_verbs = { alc269vb_init_verbs,
14550 alc269vb_laptop_amic_init_verbs },
14551 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14552 .dac_nids = alc269_dac_nids,
14554 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14555 .channel_mode = alc269_modes,
14556 .unsol_event = alc269_laptop_unsol_event,
14557 .setup = alc269vb_laptop_amic_setup,
14558 .init_hook = alc269_laptop_inithook,
14560 [ALC269VB_DMIC] = {
14561 .mixers = { alc269vb_laptop_mixer },
14562 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14563 .init_verbs = { alc269vb_init_verbs,
14564 alc269vb_laptop_dmic_init_verbs },
14565 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14566 .dac_nids = alc269_dac_nids,
14568 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14569 .channel_mode = alc269_modes,
14570 .unsol_event = alc269_laptop_unsol_event,
14571 .setup = alc269vb_laptop_dmic_setup,
14572 .init_hook = alc269_laptop_inithook,
14574 [ALC269_FUJITSU] = {
14575 .mixers = { alc269_fujitsu_mixer },
14576 .cap_mixer = alc269_laptop_digital_capture_mixer,
14577 .init_verbs = { alc269_init_verbs,
14578 alc269_laptop_dmic_init_verbs },
14579 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14580 .dac_nids = alc269_dac_nids,
14582 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14583 .channel_mode = alc269_modes,
14584 .unsol_event = alc269_laptop_unsol_event,
14585 .setup = alc269_laptop_dmic_setup,
14586 .init_hook = alc269_laptop_inithook,
14588 [ALC269_LIFEBOOK] = {
14589 .mixers = { alc269_lifebook_mixer },
14590 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14591 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14592 .dac_nids = alc269_dac_nids,
14594 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14595 .channel_mode = alc269_modes,
14596 .input_mux = &alc269_capture_source,
14597 .unsol_event = alc269_lifebook_unsol_event,
14598 .init_hook = alc269_lifebook_init_hook,
14602 static int patch_alc269(struct hda_codec *codec)
14604 struct alc_spec *spec;
14607 int is_alc269vb = 0;
14609 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14613 codec->spec = spec;
14615 alc_auto_parse_customize_define(codec);
14617 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14618 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14619 spec->cdefine.platform_type == 1)
14620 alc_codec_rename(codec, "ALC271X");
14622 alc_codec_rename(codec, "ALC259");
14625 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14627 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14631 if (board_config < 0) {
14632 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14634 board_config = ALC269_AUTO;
14637 if (board_config == ALC269_AUTO)
14638 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14640 if (board_config == ALC269_AUTO) {
14641 /* automatic parse from the BIOS config */
14642 err = alc269_parse_auto_config(codec);
14648 "hda_codec: Cannot set up configuration "
14649 "from BIOS. Using base mode...\n");
14650 board_config = ALC269_BASIC;
14654 if (has_cdefine_beep(codec)) {
14655 err = snd_hda_attach_beep_device(codec, 0x1);
14662 if (board_config != ALC269_AUTO)
14663 setup_preset(codec, &alc269_presets[board_config]);
14665 if (board_config == ALC269_QUANTA_FL1) {
14666 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14667 * fix the sample rate of analog I/O to 44.1kHz
14669 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14670 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14671 } else if (spec->dual_adc_switch) {
14672 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14673 /* switch ADC dynamically */
14674 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14676 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14677 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14679 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14680 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14682 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14683 if (!is_alc269vb) {
14684 spec->adc_nids = alc269_adc_nids;
14685 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14686 spec->capsrc_nids = alc269_capsrc_nids;
14688 spec->adc_nids = alc269vb_adc_nids;
14689 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14690 spec->capsrc_nids = alc269vb_capsrc_nids;
14694 if (!spec->cap_mixer)
14695 set_capture_mixer(codec);
14696 if (has_cdefine_beep(codec))
14697 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14699 if (board_config == ALC269_AUTO)
14700 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14702 spec->vmaster_nid = 0x02;
14704 codec->patch_ops = alc_patch_ops;
14705 if (board_config == ALC269_AUTO)
14706 spec->init_hook = alc269_auto_init;
14707 #ifdef CONFIG_SND_HDA_POWER_SAVE
14708 if (!spec->loopback.amplist)
14709 spec->loopback.amplist = alc269_loopbacks;
14710 if (alc269_mic2_for_mute_led(codec))
14711 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14718 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14722 * set the path ways for 2 channel output
14723 * need to set the codec line out and mic 1 pin widgets to inputs
14725 static struct hda_verb alc861_threestack_ch2_init[] = {
14726 /* set pin widget 1Ah (line in) for input */
14727 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14728 /* set pin widget 18h (mic1/2) for input, for mic also enable
14731 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14733 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14735 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14736 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14742 * need to set the codec line out and mic 1 pin widgets to outputs
14744 static struct hda_verb alc861_threestack_ch6_init[] = {
14745 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14746 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14747 /* set pin widget 18h (mic1) for output (CLFE)*/
14748 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14750 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14751 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14753 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14755 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14756 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14761 static struct hda_channel_mode alc861_threestack_modes[2] = {
14762 { 2, alc861_threestack_ch2_init },
14763 { 6, alc861_threestack_ch6_init },
14765 /* Set mic1 as input and unmute the mixer */
14766 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14767 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14768 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14771 /* Set mic1 as output and mute mixer */
14772 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14773 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14774 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14778 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14779 { 2, alc861_uniwill_m31_ch2_init },
14780 { 4, alc861_uniwill_m31_ch4_init },
14783 /* Set mic1 and line-in as input and unmute the mixer */
14784 static struct hda_verb alc861_asus_ch2_init[] = {
14785 /* set pin widget 1Ah (line in) for input */
14786 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14787 /* set pin widget 18h (mic1/2) for input, for mic also enable
14790 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14794 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14795 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14799 /* Set mic1 nad line-in as output and mute mixer */
14800 static struct hda_verb alc861_asus_ch6_init[] = {
14801 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14802 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14803 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14804 /* set pin widget 18h (mic1) for output (CLFE)*/
14805 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14806 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14807 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14808 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14810 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14812 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14818 static struct hda_channel_mode alc861_asus_modes[2] = {
14819 { 2, alc861_asus_ch2_init },
14820 { 6, alc861_asus_ch6_init },
14825 static struct snd_kcontrol_new alc861_base_mixer[] = {
14826 /* output mixer control */
14827 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14828 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14829 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14830 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14831 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14833 /*Input mixer control */
14834 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14835 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14836 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14837 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14838 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14839 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14841 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14842 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14843 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14848 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14849 /* output mixer control */
14850 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14851 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14852 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14853 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14854 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14856 /* Input mixer control */
14857 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14858 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14859 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14860 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14861 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14862 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14864 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14865 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14870 .name = "Channel Mode",
14871 .info = alc_ch_mode_info,
14872 .get = alc_ch_mode_get,
14873 .put = alc_ch_mode_put,
14874 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14879 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14880 /* output mixer control */
14881 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14883 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14888 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14889 /* output mixer control */
14890 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14891 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14892 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14893 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14894 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14896 /* Input mixer control */
14897 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14898 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14899 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14900 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14901 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14902 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14904 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14906 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14909 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14910 .name = "Channel Mode",
14911 .info = alc_ch_mode_info,
14912 .get = alc_ch_mode_get,
14913 .put = alc_ch_mode_put,
14914 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14919 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14920 /* output mixer control */
14921 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14922 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14923 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14924 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14925 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14927 /* Input mixer control */
14928 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14929 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14930 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14931 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14932 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14933 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14935 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14936 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14937 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14940 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14941 .name = "Channel Mode",
14942 .info = alc_ch_mode_info,
14943 .get = alc_ch_mode_get,
14944 .put = alc_ch_mode_put,
14945 .private_value = ARRAY_SIZE(alc861_asus_modes),
14950 /* additional mixer */
14951 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14952 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14953 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14958 * generic initialization of ADC, input mixers and output mixers
14960 static struct hda_verb alc861_base_init_verbs[] = {
14962 * Unmute ADC0 and set the default input to mic-in
14964 /* port-A for surround (rear panel) */
14965 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14966 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14967 /* port-B for mic-in (rear panel) with vref */
14968 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14969 /* port-C for line-in (rear panel) */
14970 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14971 /* port-D for Front */
14972 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14973 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14974 /* port-E for HP out (front panel) */
14975 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14976 /* route front PCM to HP */
14977 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14978 /* port-F for mic-in (front panel) with vref */
14979 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14980 /* port-G for CLFE (rear panel) */
14981 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14982 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14983 /* port-H for side (rear panel) */
14984 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14985 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14987 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14988 /* route front mic to ADC1*/
14989 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14992 /* Unmute DAC0~3 & spdif out*/
14993 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14994 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14995 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14996 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14999 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15000 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15001 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15002 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15003 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15005 /* Unmute Stereo Mixer 15 */
15006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15011 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15012 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15014 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15016 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15017 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15019 /* hp used DAC 3 (Front) */
15020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15026 static struct hda_verb alc861_threestack_init_verbs[] = {
15028 * Unmute ADC0 and set the default input to mic-in
15030 /* port-A for surround (rear panel) */
15031 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15032 /* port-B for mic-in (rear panel) with vref */
15033 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15034 /* port-C for line-in (rear panel) */
15035 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15036 /* port-D for Front */
15037 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15038 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15039 /* port-E for HP out (front panel) */
15040 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15041 /* route front PCM to HP */
15042 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15043 /* port-F for mic-in (front panel) with vref */
15044 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15045 /* port-G for CLFE (rear panel) */
15046 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15047 /* port-H for side (rear panel) */
15048 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15050 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15051 /* route front mic to ADC1*/
15052 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15053 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15054 /* Unmute DAC0~3 & spdif out*/
15055 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15056 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15057 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15058 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15061 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15062 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15063 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15064 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15065 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15067 /* Unmute Stereo Mixer 15 */
15068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15074 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15076 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15077 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15079 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15081 /* hp used DAC 3 (Front) */
15082 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15083 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15087 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15089 * Unmute ADC0 and set the default input to mic-in
15091 /* port-A for surround (rear panel) */
15092 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15093 /* port-B for mic-in (rear panel) with vref */
15094 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15095 /* port-C for line-in (rear panel) */
15096 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15097 /* port-D for Front */
15098 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15099 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15100 /* port-E for HP out (front panel) */
15101 /* this has to be set to VREF80 */
15102 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15103 /* route front PCM to HP */
15104 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15105 /* port-F for mic-in (front panel) with vref */
15106 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15107 /* port-G for CLFE (rear panel) */
15108 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15109 /* port-H for side (rear panel) */
15110 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15112 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15113 /* route front mic to ADC1*/
15114 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15116 /* Unmute DAC0~3 & spdif out*/
15117 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15118 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15119 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15120 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15123 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15124 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15125 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15126 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15127 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15129 /* Unmute Stereo Mixer 15 */
15130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15136 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15137 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15138 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15139 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15140 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15142 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15143 /* hp used DAC 3 (Front) */
15144 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15145 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15149 static struct hda_verb alc861_asus_init_verbs[] = {
15151 * Unmute ADC0 and set the default input to mic-in
15153 /* port-A for surround (rear panel)
15154 * according to codec#0 this is the HP jack
15156 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15157 /* route front PCM to HP */
15158 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15159 /* port-B for mic-in (rear panel) with vref */
15160 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15161 /* port-C for line-in (rear panel) */
15162 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15163 /* port-D for Front */
15164 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15165 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15166 /* port-E for HP out (front panel) */
15167 /* this has to be set to VREF80 */
15168 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15169 /* route front PCM to HP */
15170 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15171 /* port-F for mic-in (front panel) with vref */
15172 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15173 /* port-G for CLFE (rear panel) */
15174 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15175 /* port-H for side (rear panel) */
15176 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15178 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15179 /* route front mic to ADC1*/
15180 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15181 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15182 /* Unmute DAC0~3 & spdif out*/
15183 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15184 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15185 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15186 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15188 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15189 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15190 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15191 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15192 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15194 /* Unmute Stereo Mixer 15 */
15195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15197 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15200 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15201 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15202 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15203 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15204 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15205 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15206 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15207 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15208 /* hp used DAC 3 (Front) */
15209 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15210 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15214 /* additional init verbs for ASUS laptops */
15215 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15216 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15217 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15222 * generic initialization of ADC, input mixers and output mixers
15224 static struct hda_verb alc861_auto_init_verbs[] = {
15226 * Unmute ADC0 and set the default input to mic-in
15228 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15231 /* Unmute DAC0~3 & spdif out*/
15232 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15233 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15234 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15235 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15238 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15239 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15240 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15241 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15242 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15244 /* Unmute Stereo Mixer 15 */
15245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15250 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15252 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15253 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15254 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15255 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15256 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15259 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15260 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15261 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15263 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15265 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15266 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15268 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15273 static struct hda_verb alc861_toshiba_init_verbs[] = {
15274 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15279 /* toggle speaker-output according to the hp-jack state */
15280 static void alc861_toshiba_automute(struct hda_codec *codec)
15282 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15284 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15285 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15286 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15287 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15290 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15293 if ((res >> 26) == ALC880_HP_EVENT)
15294 alc861_toshiba_automute(codec);
15297 /* pcm configuration: identical with ALC880 */
15298 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15299 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15300 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15301 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15304 #define ALC861_DIGOUT_NID 0x07
15306 static struct hda_channel_mode alc861_8ch_modes[1] = {
15310 static hda_nid_t alc861_dac_nids[4] = {
15311 /* front, surround, clfe, side */
15312 0x03, 0x06, 0x05, 0x04
15315 static hda_nid_t alc660_dac_nids[3] = {
15316 /* front, clfe, surround */
15320 static hda_nid_t alc861_adc_nids[1] = {
15325 static struct hda_input_mux alc861_capture_source = {
15329 { "Front Mic", 0x3 },
15336 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15338 struct alc_spec *spec = codec->spec;
15339 hda_nid_t mix, srcs[5];
15342 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15344 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15347 for (i = 0; i < num; i++) {
15349 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15350 if (type != AC_WID_AUD_OUT)
15352 for (j = 0; j < spec->multiout.num_dacs; j++)
15353 if (spec->multiout.dac_nids[j] == srcs[i])
15355 if (j >= spec->multiout.num_dacs)
15361 /* fill in the dac_nids table from the parsed pin configuration */
15362 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15363 const struct auto_pin_cfg *cfg)
15365 struct alc_spec *spec = codec->spec;
15367 hda_nid_t nid, dac;
15369 spec->multiout.dac_nids = spec->private_dac_nids;
15370 for (i = 0; i < cfg->line_outs; i++) {
15371 nid = cfg->line_out_pins[i];
15372 dac = alc861_look_for_dac(codec, nid);
15375 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15380 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15381 hda_nid_t nid, unsigned int chs)
15383 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15384 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15387 /* add playback controls from the parsed DAC table */
15388 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15389 const struct auto_pin_cfg *cfg)
15391 struct alc_spec *spec = codec->spec;
15392 static const char *chname[4] = {
15393 "Front", "Surround", NULL /*CLFE*/, "Side"
15398 if (cfg->line_outs == 1) {
15399 const char *pfx = NULL;
15402 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15405 nid = spec->multiout.dac_nids[0];
15406 return alc861_create_out_sw(codec, pfx, nid, 3);
15410 for (i = 0; i < cfg->line_outs; i++) {
15411 nid = spec->multiout.dac_nids[i];
15416 err = alc861_create_out_sw(codec, "Center", nid, 1);
15419 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15423 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15431 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15433 struct alc_spec *spec = codec->spec;
15440 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15441 nid = alc861_look_for_dac(codec, pin);
15443 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15446 spec->multiout.hp_nid = nid;
15452 /* create playback/capture controls for input pins */
15453 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15454 const struct auto_pin_cfg *cfg)
15456 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15459 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15461 int pin_type, hda_nid_t dac)
15463 hda_nid_t mix, srcs[5];
15466 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15468 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15470 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15472 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15475 for (i = 0; i < num; i++) {
15477 if (srcs[i] == dac || srcs[i] == 0x15)
15478 mute = AMP_IN_UNMUTE(i);
15480 mute = AMP_IN_MUTE(i);
15481 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15486 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15488 struct alc_spec *spec = codec->spec;
15491 for (i = 0; i < spec->autocfg.line_outs; i++) {
15492 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15493 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15495 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15496 spec->multiout.dac_nids[i]);
15500 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15502 struct alc_spec *spec = codec->spec;
15504 if (spec->autocfg.hp_outs)
15505 alc861_auto_set_output_and_unmute(codec,
15506 spec->autocfg.hp_pins[0],
15508 spec->multiout.hp_nid);
15509 if (spec->autocfg.speaker_outs)
15510 alc861_auto_set_output_and_unmute(codec,
15511 spec->autocfg.speaker_pins[0],
15513 spec->multiout.dac_nids[0]);
15516 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15518 struct alc_spec *spec = codec->spec;
15521 for (i = 0; i < AUTO_PIN_LAST; i++) {
15522 hda_nid_t nid = spec->autocfg.input_pins[i];
15523 if (nid >= 0x0c && nid <= 0x11)
15524 alc_set_input_pin(codec, nid, i);
15528 /* parse the BIOS configuration and set up the alc_spec */
15529 /* return 1 if successful, 0 if the proper config is not found,
15530 * or a negative error code
15532 static int alc861_parse_auto_config(struct hda_codec *codec)
15534 struct alc_spec *spec = codec->spec;
15536 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15538 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15542 if (!spec->autocfg.line_outs)
15543 return 0; /* can't find valid BIOS pin config */
15545 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15548 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15551 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15554 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15558 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15560 alc_auto_parse_digital(codec);
15562 if (spec->kctls.list)
15563 add_mixer(spec, spec->kctls.list);
15565 add_verb(spec, alc861_auto_init_verbs);
15567 spec->num_mux_defs = 1;
15568 spec->input_mux = &spec->private_imux[0];
15570 spec->adc_nids = alc861_adc_nids;
15571 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15572 set_capture_mixer(codec);
15574 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15579 /* additional initialization for auto-configuration model */
15580 static void alc861_auto_init(struct hda_codec *codec)
15582 struct alc_spec *spec = codec->spec;
15583 alc861_auto_init_multi_out(codec);
15584 alc861_auto_init_hp_out(codec);
15585 alc861_auto_init_analog_input(codec);
15586 alc_auto_init_digital(codec);
15587 if (spec->unsol_event)
15588 alc_inithook(codec);
15591 #ifdef CONFIG_SND_HDA_POWER_SAVE
15592 static struct hda_amp_list alc861_loopbacks[] = {
15593 { 0x15, HDA_INPUT, 0 },
15594 { 0x15, HDA_INPUT, 1 },
15595 { 0x15, HDA_INPUT, 2 },
15596 { 0x15, HDA_INPUT, 3 },
15603 * configuration and preset
15605 static const char *alc861_models[ALC861_MODEL_LAST] = {
15606 [ALC861_3ST] = "3stack",
15607 [ALC660_3ST] = "3stack-660",
15608 [ALC861_3ST_DIG] = "3stack-dig",
15609 [ALC861_6ST_DIG] = "6stack-dig",
15610 [ALC861_UNIWILL_M31] = "uniwill-m31",
15611 [ALC861_TOSHIBA] = "toshiba",
15612 [ALC861_ASUS] = "asus",
15613 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15614 [ALC861_AUTO] = "auto",
15617 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15618 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15619 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15620 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15621 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15622 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15623 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15624 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15625 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15626 * Any other models that need this preset?
15628 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15629 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15630 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15631 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15632 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15633 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15634 /* FIXME: the below seems conflict */
15635 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15636 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15637 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15641 static struct alc_config_preset alc861_presets[] = {
15643 .mixers = { alc861_3ST_mixer },
15644 .init_verbs = { alc861_threestack_init_verbs },
15645 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15646 .dac_nids = alc861_dac_nids,
15647 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15648 .channel_mode = alc861_threestack_modes,
15650 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15651 .adc_nids = alc861_adc_nids,
15652 .input_mux = &alc861_capture_source,
15654 [ALC861_3ST_DIG] = {
15655 .mixers = { alc861_base_mixer },
15656 .init_verbs = { alc861_threestack_init_verbs },
15657 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15658 .dac_nids = alc861_dac_nids,
15659 .dig_out_nid = ALC861_DIGOUT_NID,
15660 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15661 .channel_mode = alc861_threestack_modes,
15663 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15664 .adc_nids = alc861_adc_nids,
15665 .input_mux = &alc861_capture_source,
15667 [ALC861_6ST_DIG] = {
15668 .mixers = { alc861_base_mixer },
15669 .init_verbs = { alc861_base_init_verbs },
15670 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15671 .dac_nids = alc861_dac_nids,
15672 .dig_out_nid = ALC861_DIGOUT_NID,
15673 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15674 .channel_mode = alc861_8ch_modes,
15675 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15676 .adc_nids = alc861_adc_nids,
15677 .input_mux = &alc861_capture_source,
15680 .mixers = { alc861_3ST_mixer },
15681 .init_verbs = { alc861_threestack_init_verbs },
15682 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15683 .dac_nids = alc660_dac_nids,
15684 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15685 .channel_mode = alc861_threestack_modes,
15687 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15688 .adc_nids = alc861_adc_nids,
15689 .input_mux = &alc861_capture_source,
15691 [ALC861_UNIWILL_M31] = {
15692 .mixers = { alc861_uniwill_m31_mixer },
15693 .init_verbs = { alc861_uniwill_m31_init_verbs },
15694 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15695 .dac_nids = alc861_dac_nids,
15696 .dig_out_nid = ALC861_DIGOUT_NID,
15697 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15698 .channel_mode = alc861_uniwill_m31_modes,
15700 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15701 .adc_nids = alc861_adc_nids,
15702 .input_mux = &alc861_capture_source,
15704 [ALC861_TOSHIBA] = {
15705 .mixers = { alc861_toshiba_mixer },
15706 .init_verbs = { alc861_base_init_verbs,
15707 alc861_toshiba_init_verbs },
15708 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15709 .dac_nids = alc861_dac_nids,
15710 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15711 .channel_mode = alc883_3ST_2ch_modes,
15712 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15713 .adc_nids = alc861_adc_nids,
15714 .input_mux = &alc861_capture_source,
15715 .unsol_event = alc861_toshiba_unsol_event,
15716 .init_hook = alc861_toshiba_automute,
15719 .mixers = { alc861_asus_mixer },
15720 .init_verbs = { alc861_asus_init_verbs },
15721 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15722 .dac_nids = alc861_dac_nids,
15723 .dig_out_nid = ALC861_DIGOUT_NID,
15724 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15725 .channel_mode = alc861_asus_modes,
15728 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15729 .adc_nids = alc861_adc_nids,
15730 .input_mux = &alc861_capture_source,
15732 [ALC861_ASUS_LAPTOP] = {
15733 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15734 .init_verbs = { alc861_asus_init_verbs,
15735 alc861_asus_laptop_init_verbs },
15736 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15737 .dac_nids = alc861_dac_nids,
15738 .dig_out_nid = ALC861_DIGOUT_NID,
15739 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15740 .channel_mode = alc883_3ST_2ch_modes,
15742 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15743 .adc_nids = alc861_adc_nids,
15744 .input_mux = &alc861_capture_source,
15748 /* Pin config fixes */
15750 PINFIX_FSC_AMILO_PI1505,
15753 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15754 { 0x0b, 0x0221101f }, /* HP */
15755 { 0x0f, 0x90170310 }, /* speaker */
15759 static const struct alc_fixup alc861_fixups[] = {
15760 [PINFIX_FSC_AMILO_PI1505] = {
15761 .pins = alc861_fsc_amilo_pi1505_pinfix
15765 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15766 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15770 static int patch_alc861(struct hda_codec *codec)
15772 struct alc_spec *spec;
15776 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15780 codec->spec = spec;
15782 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15786 if (board_config < 0) {
15787 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15789 board_config = ALC861_AUTO;
15792 if (board_config == ALC861_AUTO)
15793 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15795 if (board_config == ALC861_AUTO) {
15796 /* automatic parse from the BIOS config */
15797 err = alc861_parse_auto_config(codec);
15803 "hda_codec: Cannot set up configuration "
15804 "from BIOS. Using base mode...\n");
15805 board_config = ALC861_3ST_DIG;
15809 err = snd_hda_attach_beep_device(codec, 0x23);
15815 if (board_config != ALC861_AUTO)
15816 setup_preset(codec, &alc861_presets[board_config]);
15818 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15819 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15821 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15822 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15824 if (!spec->cap_mixer)
15825 set_capture_mixer(codec);
15826 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15828 spec->vmaster_nid = 0x03;
15830 if (board_config == ALC861_AUTO)
15831 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15833 codec->patch_ops = alc_patch_ops;
15834 if (board_config == ALC861_AUTO) {
15835 spec->init_hook = alc861_auto_init;
15836 #ifdef CONFIG_SND_HDA_POWER_SAVE
15837 spec->power_hook = alc_power_eapd;
15840 #ifdef CONFIG_SND_HDA_POWER_SAVE
15841 if (!spec->loopback.amplist)
15842 spec->loopback.amplist = alc861_loopbacks;
15849 * ALC861-VD support
15853 * In addition, an independent DAC
15855 #define ALC861VD_DIGOUT_NID 0x06
15857 static hda_nid_t alc861vd_dac_nids[4] = {
15858 /* front, surr, clfe, side surr */
15859 0x02, 0x03, 0x04, 0x05
15862 /* dac_nids for ALC660vd are in a different order - according to
15863 * Realtek's driver.
15864 * This should probably result in a different mixer for 6stack models
15865 * of ALC660vd codecs, but for now there is only 3stack mixer
15866 * - and it is the same as in 861vd.
15867 * adc_nids in ALC660vd are (is) the same as in 861vd
15869 static hda_nid_t alc660vd_dac_nids[3] = {
15870 /* front, rear, clfe, rear_surr */
15874 static hda_nid_t alc861vd_adc_nids[1] = {
15879 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15882 /* FIXME: should be a matrix-type input source selection */
15883 static struct hda_input_mux alc861vd_capture_source = {
15887 { "Front Mic", 0x1 },
15893 static struct hda_input_mux alc861vd_dallas_capture_source = {
15896 { "Ext Mic", 0x0 },
15897 { "Int Mic", 0x1 },
15901 static struct hda_input_mux alc861vd_hp_capture_source = {
15904 { "Front Mic", 0x0 },
15905 { "ATAPI Mic", 0x1 },
15912 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15919 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15920 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15921 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15922 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15923 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15930 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15931 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15932 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15933 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15934 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15938 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15939 { 6, alc861vd_6stack_ch6_init },
15940 { 8, alc861vd_6stack_ch8_init },
15943 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15945 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15946 .name = "Channel Mode",
15947 .info = alc_ch_mode_info,
15948 .get = alc_ch_mode_get,
15949 .put = alc_ch_mode_put,
15954 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15955 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15957 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15958 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15959 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15961 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15962 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15966 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15968 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15969 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15971 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15972 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15974 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15977 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15980 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15981 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15982 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15984 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15985 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15987 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15988 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15993 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15994 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15995 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15999 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16003 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16004 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16005 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16007 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16008 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16010 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16011 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16016 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16017 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16018 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16019 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16023 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16027 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16028 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16029 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16031 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16032 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16037 /* Pin assignment: Speaker=0x14, HP = 0x15,
16038 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16040 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16041 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16042 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16043 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16044 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16045 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16046 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16047 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16048 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16049 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16050 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16054 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16055 * Front Mic=0x18, ATAPI Mic = 0x19,
16057 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16058 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16059 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16060 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16061 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16062 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16063 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16064 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16065 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16071 * generic initialization of ADC, input mixers and output mixers
16073 static struct hda_verb alc861vd_volume_init_verbs[] = {
16075 * Unmute ADC0 and set the default input to mic-in
16077 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16080 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16081 * the analog-loopback mixer widget
16083 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16087 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16088 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16090 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16097 * Set up output mixers (0x02 - 0x05)
16099 /* set vol=0 to output mixers */
16100 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16101 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16105 /* set up input amps for analog loopback */
16106 /* Amp Indices: DAC = 0, mixer = 1 */
16107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16109 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16112 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16113 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16120 * 3-stack pin configuration:
16121 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16123 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16125 * Set pin mode and muting
16127 /* set front pin widgets 0x14 for output */
16128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16129 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16130 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16132 /* Mic (rear) pin: input vref at 80% */
16133 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16134 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16135 /* Front Mic pin: input vref at 80% */
16136 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16138 /* Line In pin: input */
16139 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16140 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16141 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16142 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16143 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16144 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16145 /* CD pin widget for input */
16146 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16152 * 6-stack pin configuration:
16154 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16156 * Set pin mode and muting
16158 /* set front pin widgets 0x14 for output */
16159 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16160 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16161 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16163 /* Rear Pin: output 1 (0x0d) */
16164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16165 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16166 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16167 /* CLFE Pin: output 2 (0x0e) */
16168 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16169 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16170 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16171 /* Side Pin: output 3 (0x0f) */
16172 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16173 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16174 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16176 /* Mic (rear) pin: input vref at 80% */
16177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16178 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16179 /* Front Mic pin: input vref at 80% */
16180 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16182 /* Line In pin: input */
16183 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16184 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16185 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16187 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16188 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16189 /* CD pin widget for input */
16190 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16195 static struct hda_verb alc861vd_eapd_verbs[] = {
16196 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16200 static struct hda_verb alc660vd_eapd_verbs[] = {
16201 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16202 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16206 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16208 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16209 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16210 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16211 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16215 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16217 unsigned int present;
16218 unsigned char bits;
16220 present = snd_hda_jack_detect(codec, 0x18);
16221 bits = present ? HDA_AMP_MUTE : 0;
16223 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16224 HDA_AMP_MUTE, bits);
16227 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16229 struct alc_spec *spec = codec->spec;
16230 spec->autocfg.hp_pins[0] = 0x1b;
16231 spec->autocfg.speaker_pins[0] = 0x14;
16234 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16236 alc_automute_amp(codec);
16237 alc861vd_lenovo_mic_automute(codec);
16240 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16243 switch (res >> 26) {
16244 case ALC880_MIC_EVENT:
16245 alc861vd_lenovo_mic_automute(codec);
16248 alc_automute_amp_unsol_event(codec, res);
16253 static struct hda_verb alc861vd_dallas_verbs[] = {
16254 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16255 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16256 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16257 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16263 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16269 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16272 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16273 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16274 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16275 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16279 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16280 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16281 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16282 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16283 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16284 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16288 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16292 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16293 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16298 /* toggle speaker-output according to the hp-jack state */
16299 static void alc861vd_dallas_setup(struct hda_codec *codec)
16301 struct alc_spec *spec = codec->spec;
16303 spec->autocfg.hp_pins[0] = 0x15;
16304 spec->autocfg.speaker_pins[0] = 0x14;
16307 #ifdef CONFIG_SND_HDA_POWER_SAVE
16308 #define alc861vd_loopbacks alc880_loopbacks
16311 /* pcm configuration: identical with ALC880 */
16312 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16313 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16314 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16315 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16318 * configuration and preset
16320 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16321 [ALC660VD_3ST] = "3stack-660",
16322 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16323 [ALC660VD_ASUS_V1S] = "asus-v1s",
16324 [ALC861VD_3ST] = "3stack",
16325 [ALC861VD_3ST_DIG] = "3stack-digout",
16326 [ALC861VD_6ST_DIG] = "6stack-digout",
16327 [ALC861VD_LENOVO] = "lenovo",
16328 [ALC861VD_DALLAS] = "dallas",
16329 [ALC861VD_HP] = "hp",
16330 [ALC861VD_AUTO] = "auto",
16333 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16334 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16335 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16336 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16337 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16338 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16339 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16340 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16341 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16342 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16343 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16344 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16345 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16346 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16347 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16348 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16352 static struct alc_config_preset alc861vd_presets[] = {
16354 .mixers = { alc861vd_3st_mixer },
16355 .init_verbs = { alc861vd_volume_init_verbs,
16356 alc861vd_3stack_init_verbs },
16357 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16358 .dac_nids = alc660vd_dac_nids,
16359 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16360 .channel_mode = alc861vd_3stack_2ch_modes,
16361 .input_mux = &alc861vd_capture_source,
16363 [ALC660VD_3ST_DIG] = {
16364 .mixers = { alc861vd_3st_mixer },
16365 .init_verbs = { alc861vd_volume_init_verbs,
16366 alc861vd_3stack_init_verbs },
16367 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16368 .dac_nids = alc660vd_dac_nids,
16369 .dig_out_nid = ALC861VD_DIGOUT_NID,
16370 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16371 .channel_mode = alc861vd_3stack_2ch_modes,
16372 .input_mux = &alc861vd_capture_source,
16375 .mixers = { alc861vd_3st_mixer },
16376 .init_verbs = { alc861vd_volume_init_verbs,
16377 alc861vd_3stack_init_verbs },
16378 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16379 .dac_nids = alc861vd_dac_nids,
16380 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16381 .channel_mode = alc861vd_3stack_2ch_modes,
16382 .input_mux = &alc861vd_capture_source,
16384 [ALC861VD_3ST_DIG] = {
16385 .mixers = { alc861vd_3st_mixer },
16386 .init_verbs = { alc861vd_volume_init_verbs,
16387 alc861vd_3stack_init_verbs },
16388 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16389 .dac_nids = alc861vd_dac_nids,
16390 .dig_out_nid = ALC861VD_DIGOUT_NID,
16391 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16392 .channel_mode = alc861vd_3stack_2ch_modes,
16393 .input_mux = &alc861vd_capture_source,
16395 [ALC861VD_6ST_DIG] = {
16396 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16397 .init_verbs = { alc861vd_volume_init_verbs,
16398 alc861vd_6stack_init_verbs },
16399 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16400 .dac_nids = alc861vd_dac_nids,
16401 .dig_out_nid = ALC861VD_DIGOUT_NID,
16402 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16403 .channel_mode = alc861vd_6stack_modes,
16404 .input_mux = &alc861vd_capture_source,
16406 [ALC861VD_LENOVO] = {
16407 .mixers = { alc861vd_lenovo_mixer },
16408 .init_verbs = { alc861vd_volume_init_verbs,
16409 alc861vd_3stack_init_verbs,
16410 alc861vd_eapd_verbs,
16411 alc861vd_lenovo_unsol_verbs },
16412 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16413 .dac_nids = alc660vd_dac_nids,
16414 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16415 .channel_mode = alc861vd_3stack_2ch_modes,
16416 .input_mux = &alc861vd_capture_source,
16417 .unsol_event = alc861vd_lenovo_unsol_event,
16418 .setup = alc861vd_lenovo_setup,
16419 .init_hook = alc861vd_lenovo_init_hook,
16421 [ALC861VD_DALLAS] = {
16422 .mixers = { alc861vd_dallas_mixer },
16423 .init_verbs = { alc861vd_dallas_verbs },
16424 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16425 .dac_nids = alc861vd_dac_nids,
16426 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16427 .channel_mode = alc861vd_3stack_2ch_modes,
16428 .input_mux = &alc861vd_dallas_capture_source,
16429 .unsol_event = alc_automute_amp_unsol_event,
16430 .setup = alc861vd_dallas_setup,
16431 .init_hook = alc_automute_amp,
16434 .mixers = { alc861vd_hp_mixer },
16435 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16436 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16437 .dac_nids = alc861vd_dac_nids,
16438 .dig_out_nid = ALC861VD_DIGOUT_NID,
16439 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16440 .channel_mode = alc861vd_3stack_2ch_modes,
16441 .input_mux = &alc861vd_hp_capture_source,
16442 .unsol_event = alc_automute_amp_unsol_event,
16443 .setup = alc861vd_dallas_setup,
16444 .init_hook = alc_automute_amp,
16446 [ALC660VD_ASUS_V1S] = {
16447 .mixers = { alc861vd_lenovo_mixer },
16448 .init_verbs = { alc861vd_volume_init_verbs,
16449 alc861vd_3stack_init_verbs,
16450 alc861vd_eapd_verbs,
16451 alc861vd_lenovo_unsol_verbs },
16452 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16453 .dac_nids = alc660vd_dac_nids,
16454 .dig_out_nid = ALC861VD_DIGOUT_NID,
16455 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16456 .channel_mode = alc861vd_3stack_2ch_modes,
16457 .input_mux = &alc861vd_capture_source,
16458 .unsol_event = alc861vd_lenovo_unsol_event,
16459 .setup = alc861vd_lenovo_setup,
16460 .init_hook = alc861vd_lenovo_init_hook,
16465 * BIOS auto configuration
16467 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16468 const struct auto_pin_cfg *cfg)
16470 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16474 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16475 hda_nid_t nid, int pin_type, int dac_idx)
16477 alc_set_pin_output(codec, nid, pin_type);
16480 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16482 struct alc_spec *spec = codec->spec;
16485 for (i = 0; i <= HDA_SIDE; i++) {
16486 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16487 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16489 alc861vd_auto_set_output_and_unmute(codec, nid,
16495 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16497 struct alc_spec *spec = codec->spec;
16500 pin = spec->autocfg.hp_pins[0];
16501 if (pin) /* connect to front and use dac 0 */
16502 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16503 pin = spec->autocfg.speaker_pins[0];
16505 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16508 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16510 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16512 struct alc_spec *spec = codec->spec;
16515 for (i = 0; i < AUTO_PIN_LAST; i++) {
16516 hda_nid_t nid = spec->autocfg.input_pins[i];
16517 if (alc_is_input_pin(codec, nid)) {
16518 alc_set_input_pin(codec, nid, i);
16519 if (nid != ALC861VD_PIN_CD_NID &&
16520 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16521 snd_hda_codec_write(codec, nid, 0,
16522 AC_VERB_SET_AMP_GAIN_MUTE,
16528 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16530 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16531 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16533 /* add playback controls from the parsed DAC table */
16534 /* Based on ALC880 version. But ALC861VD has separate,
16535 * different NIDs for mute/unmute switch and volume control */
16536 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16537 const struct auto_pin_cfg *cfg)
16539 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16540 hda_nid_t nid_v, nid_s;
16543 for (i = 0; i < cfg->line_outs; i++) {
16544 if (!spec->multiout.dac_nids[i])
16546 nid_v = alc861vd_idx_to_mixer_vol(
16548 spec->multiout.dac_nids[i]));
16549 nid_s = alc861vd_idx_to_mixer_switch(
16551 spec->multiout.dac_nids[i]));
16555 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16557 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16561 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16563 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16567 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16569 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16573 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16575 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16581 if (cfg->line_outs == 1 &&
16582 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16589 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16590 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16594 if (cfg->line_outs == 1 &&
16595 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16597 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16598 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16607 /* add playback controls for speaker and HP outputs */
16608 /* Based on ALC880 version. But ALC861VD has separate,
16609 * different NIDs for mute/unmute switch and volume control */
16610 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16611 hda_nid_t pin, const char *pfx)
16613 hda_nid_t nid_v, nid_s;
16619 if (alc880_is_fixed_pin(pin)) {
16620 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16621 /* specify the DAC as the extra output */
16622 if (!spec->multiout.hp_nid)
16623 spec->multiout.hp_nid = nid_v;
16625 spec->multiout.extra_out_nid[0] = nid_v;
16626 /* control HP volume/switch on the output mixer amp */
16627 nid_v = alc861vd_idx_to_mixer_vol(
16628 alc880_fixed_pin_idx(pin));
16629 nid_s = alc861vd_idx_to_mixer_switch(
16630 alc880_fixed_pin_idx(pin));
16632 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16633 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16636 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16637 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16640 } else if (alc880_is_multi_pin(pin)) {
16641 /* set manual connection */
16642 /* we have only a switch on HP-out PIN */
16643 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16644 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16651 /* parse the BIOS configuration and set up the alc_spec
16652 * return 1 if successful, 0 if the proper config is not found,
16653 * or a negative error code
16654 * Based on ALC880 version - had to change it to override
16655 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16656 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16658 struct alc_spec *spec = codec->spec;
16660 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16662 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16666 if (!spec->autocfg.line_outs)
16667 return 0; /* can't find valid BIOS pin config */
16669 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16672 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16675 err = alc861vd_auto_create_extra_out(spec,
16676 spec->autocfg.speaker_pins[0],
16680 err = alc861vd_auto_create_extra_out(spec,
16681 spec->autocfg.hp_pins[0],
16685 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16689 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16691 alc_auto_parse_digital(codec);
16693 if (spec->kctls.list)
16694 add_mixer(spec, spec->kctls.list);
16696 add_verb(spec, alc861vd_volume_init_verbs);
16698 spec->num_mux_defs = 1;
16699 spec->input_mux = &spec->private_imux[0];
16701 err = alc_auto_add_mic_boost(codec);
16705 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16710 /* additional initialization for auto-configuration model */
16711 static void alc861vd_auto_init(struct hda_codec *codec)
16713 struct alc_spec *spec = codec->spec;
16714 alc861vd_auto_init_multi_out(codec);
16715 alc861vd_auto_init_hp_out(codec);
16716 alc861vd_auto_init_analog_input(codec);
16717 alc861vd_auto_init_input_src(codec);
16718 alc_auto_init_digital(codec);
16719 if (spec->unsol_event)
16720 alc_inithook(codec);
16724 ALC660VD_FIX_ASUS_GPIO1
16728 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16729 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16730 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16731 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16735 static const struct alc_fixup alc861vd_fixups[] = {
16736 [ALC660VD_FIX_ASUS_GPIO1] = {
16737 .verbs = alc660vd_fix_asus_gpio1_verbs,
16741 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16742 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16746 static int patch_alc861vd(struct hda_codec *codec)
16748 struct alc_spec *spec;
16749 int err, board_config;
16751 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16755 codec->spec = spec;
16757 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16761 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16762 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16764 board_config = ALC861VD_AUTO;
16767 if (board_config == ALC861VD_AUTO)
16768 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16770 if (board_config == ALC861VD_AUTO) {
16771 /* automatic parse from the BIOS config */
16772 err = alc861vd_parse_auto_config(codec);
16778 "hda_codec: Cannot set up configuration "
16779 "from BIOS. Using base mode...\n");
16780 board_config = ALC861VD_3ST;
16784 err = snd_hda_attach_beep_device(codec, 0x23);
16790 if (board_config != ALC861VD_AUTO)
16791 setup_preset(codec, &alc861vd_presets[board_config]);
16793 if (codec->vendor_id == 0x10ec0660) {
16794 /* always turn on EAPD */
16795 add_verb(spec, alc660vd_eapd_verbs);
16798 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16799 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16801 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16802 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16804 if (!spec->adc_nids) {
16805 spec->adc_nids = alc861vd_adc_nids;
16806 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16808 if (!spec->capsrc_nids)
16809 spec->capsrc_nids = alc861vd_capsrc_nids;
16811 set_capture_mixer(codec);
16812 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16814 spec->vmaster_nid = 0x02;
16816 if (board_config == ALC861VD_AUTO)
16817 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16819 codec->patch_ops = alc_patch_ops;
16821 if (board_config == ALC861VD_AUTO)
16822 spec->init_hook = alc861vd_auto_init;
16823 #ifdef CONFIG_SND_HDA_POWER_SAVE
16824 if (!spec->loopback.amplist)
16825 spec->loopback.amplist = alc861vd_loopbacks;
16834 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16835 * configuration. Each pin widget can choose any input DACs and a mixer.
16836 * Each ADC is connected from a mixer of all inputs. This makes possible
16837 * 6-channel independent captures.
16839 * In addition, an independent DAC for the multi-playback (not used in this
16842 #define ALC662_DIGOUT_NID 0x06
16843 #define ALC662_DIGIN_NID 0x0a
16845 static hda_nid_t alc662_dac_nids[4] = {
16846 /* front, rear, clfe, rear_surr */
16850 static hda_nid_t alc272_dac_nids[2] = {
16854 static hda_nid_t alc662_adc_nids[2] = {
16859 static hda_nid_t alc272_adc_nids[1] = {
16864 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16865 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16869 /* FIXME: should be a matrix-type input source selection */
16870 static struct hda_input_mux alc662_capture_source = {
16874 { "Front Mic", 0x1 },
16880 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16888 static struct hda_input_mux alc663_capture_source = {
16892 { "Front Mic", 0x1 },
16897 #if 0 /* set to 1 for testing other input sources below */
16898 static struct hda_input_mux alc272_nc10_capture_source = {
16901 { "Autoselect Mic", 0x0 },
16902 { "Internal Mic", 0x1 },
16903 { "In-0x02", 0x2 },
16904 { "In-0x03", 0x3 },
16905 { "In-0x04", 0x4 },
16906 { "In-0x05", 0x5 },
16907 { "In-0x06", 0x6 },
16908 { "In-0x07", 0x7 },
16909 { "In-0x08", 0x8 },
16910 { "In-0x09", 0x9 },
16911 { "In-0x0a", 0x0a },
16912 { "In-0x0b", 0x0b },
16913 { "In-0x0c", 0x0c },
16914 { "In-0x0d", 0x0d },
16915 { "In-0x0e", 0x0e },
16916 { "In-0x0f", 0x0f },
16924 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16931 static struct hda_verb alc662_3ST_ch2_init[] = {
16932 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16933 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16934 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16935 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16942 static struct hda_verb alc662_3ST_ch6_init[] = {
16943 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16944 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16945 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16946 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16947 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16948 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16952 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16953 { 2, alc662_3ST_ch2_init },
16954 { 6, alc662_3ST_ch6_init },
16960 static struct hda_verb alc662_sixstack_ch6_init[] = {
16961 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16962 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16963 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16970 static struct hda_verb alc662_sixstack_ch8_init[] = {
16971 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16972 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16973 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16977 static struct hda_channel_mode alc662_5stack_modes[2] = {
16978 { 2, alc662_sixstack_ch6_init },
16979 { 6, alc662_sixstack_ch8_init },
16982 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16983 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16986 static struct snd_kcontrol_new alc662_base_mixer[] = {
16987 /* output mixer control */
16988 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16989 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16990 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16991 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16992 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16993 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16994 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16995 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16998 /*Input mixer control */
16999 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17000 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17001 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17002 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17003 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17004 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17010 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17011 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17012 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17013 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17014 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17015 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17016 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17017 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17019 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17020 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17021 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17025 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17026 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17027 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17028 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17029 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17030 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17031 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17032 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17033 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17035 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17036 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17037 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17038 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17040 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17041 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17042 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17046 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17047 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17048 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17049 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17050 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17053 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17055 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17059 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17060 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17061 ALC262_HIPPO_MASTER_SWITCH,
17063 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17064 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17065 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17067 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17068 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17069 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17073 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17074 ALC262_HIPPO_MASTER_SWITCH,
17075 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17076 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17077 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17078 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17079 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17087 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17088 .ops = &snd_hda_bind_vol,
17090 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17091 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17096 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17097 .ops = &snd_hda_bind_sw,
17099 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17100 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17105 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17106 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17107 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17113 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17114 .ops = &snd_hda_bind_sw,
17116 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17117 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17118 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17123 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17124 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17125 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17128 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17129 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17134 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17135 .ops = &snd_hda_bind_sw,
17137 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17138 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17139 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17144 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17145 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17146 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17149 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17150 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17154 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17156 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17160 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17161 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17165 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17166 .ops = &snd_hda_bind_vol,
17168 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17169 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17174 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17175 .ops = &snd_hda_bind_sw,
17177 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17178 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17183 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17184 HDA_BIND_VOL("Master Playback Volume",
17185 &alc663_asus_two_bind_master_vol),
17186 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17187 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17194 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17195 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17196 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17197 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17204 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17205 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17206 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17207 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17208 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17213 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17214 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17218 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17219 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17220 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17221 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17225 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17226 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17232 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17233 .ops = &snd_hda_bind_sw,
17235 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17236 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17237 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17238 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17239 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17244 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17245 .ops = &snd_hda_bind_sw,
17247 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17248 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17253 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17254 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17255 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17256 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17257 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17258 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17259 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17260 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17266 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17267 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17268 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17269 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17270 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17271 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17278 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17280 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17281 .name = "Channel Mode",
17282 .info = alc_ch_mode_info,
17283 .get = alc_ch_mode_get,
17284 .put = alc_ch_mode_put,
17289 static struct hda_verb alc662_init_verbs[] = {
17290 /* ADC: mute amp left and right */
17291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17292 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17301 /* Front Pin: output 0 (0x0c) */
17302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17305 /* Rear Pin: output 1 (0x0d) */
17306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17309 /* CLFE Pin: output 2 (0x0e) */
17310 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17313 /* Mic (rear) pin: input vref at 80% */
17314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17316 /* Front Mic pin: input vref at 80% */
17317 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17319 /* Line In pin: input */
17320 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17322 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17324 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17325 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17326 /* CD pin widget for input */
17327 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17329 /* FIXME: use matrix-type input source selection */
17330 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17333 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17335 /* always trun on EAPD */
17336 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17337 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17342 static struct hda_verb alc663_init_verbs[] = {
17343 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17344 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17345 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17346 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17352 static struct hda_verb alc272_init_verbs[] = {
17353 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17354 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17355 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17356 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17357 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17358 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17360 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17364 static struct hda_verb alc662_sue_init_verbs[] = {
17365 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17366 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17370 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17371 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17372 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17376 /* Set Unsolicited Event*/
17377 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17379 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17383 static struct hda_verb alc663_m51va_init_verbs[] = {
17384 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17385 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17386 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17387 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17388 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17391 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17392 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17396 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17397 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17398 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17399 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17403 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17407 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17408 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17410 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17411 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17414 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17415 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17419 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17422 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17425 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17426 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17430 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17431 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17432 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17433 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17434 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17437 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17438 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17440 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17441 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17442 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17446 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17447 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17449 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17453 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17456 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17457 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17458 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17462 static struct hda_verb alc663_g71v_init_verbs[] = {
17463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17464 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17465 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17467 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17468 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17469 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17471 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17472 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17473 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17477 static struct hda_verb alc663_g50v_init_verbs[] = {
17478 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17479 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17480 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17482 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17483 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17487 static struct hda_verb alc662_ecs_init_verbs[] = {
17488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17490 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17491 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17495 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17496 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17497 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17500 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17501 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17502 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17505 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17506 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17510 static struct hda_verb alc272_dell_init_verbs[] = {
17511 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17512 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17514 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17515 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17516 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17517 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17520 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17521 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17525 static struct hda_verb alc663_mode7_init_verbs[] = {
17526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17528 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17529 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17530 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17531 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17532 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17533 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17534 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17535 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17538 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17539 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17540 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17544 static struct hda_verb alc663_mode8_init_verbs[] = {
17545 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17547 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17548 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17549 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17550 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17551 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17553 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17554 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17555 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17558 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17559 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17560 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17564 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17565 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17566 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17570 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17571 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17572 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17576 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17578 unsigned int present;
17579 unsigned char bits;
17581 present = snd_hda_jack_detect(codec, 0x14);
17582 bits = present ? HDA_AMP_MUTE : 0;
17584 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17585 HDA_AMP_MUTE, bits);
17588 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17590 unsigned int present;
17591 unsigned char bits;
17593 present = snd_hda_jack_detect(codec, 0x1b);
17594 bits = present ? HDA_AMP_MUTE : 0;
17596 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17597 HDA_AMP_MUTE, bits);
17598 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17599 HDA_AMP_MUTE, bits);
17602 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17605 if ((res >> 26) == ALC880_HP_EVENT)
17606 alc662_lenovo_101e_all_automute(codec);
17607 if ((res >> 26) == ALC880_FRONT_EVENT)
17608 alc662_lenovo_101e_ispeaker_automute(codec);
17611 /* unsolicited event for HP jack sensing */
17612 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17615 if ((res >> 26) == ALC880_MIC_EVENT)
17616 alc_mic_automute(codec);
17618 alc262_hippo_unsol_event(codec, res);
17621 static void alc662_eeepc_setup(struct hda_codec *codec)
17623 struct alc_spec *spec = codec->spec;
17625 alc262_hippo1_setup(codec);
17626 spec->ext_mic.pin = 0x18;
17627 spec->ext_mic.mux_idx = 0;
17628 spec->int_mic.pin = 0x19;
17629 spec->int_mic.mux_idx = 1;
17630 spec->auto_mic = 1;
17633 static void alc662_eeepc_inithook(struct hda_codec *codec)
17635 alc262_hippo_automute(codec);
17636 alc_mic_automute(codec);
17639 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17641 struct alc_spec *spec = codec->spec;
17643 spec->autocfg.hp_pins[0] = 0x14;
17644 spec->autocfg.speaker_pins[0] = 0x1b;
17647 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17649 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17651 unsigned int present;
17652 unsigned char bits;
17654 present = snd_hda_jack_detect(codec, 0x21);
17655 bits = present ? HDA_AMP_MUTE : 0;
17656 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17657 HDA_AMP_MUTE, bits);
17658 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17659 HDA_AMP_MUTE, bits);
17662 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17664 unsigned int present;
17665 unsigned char bits;
17667 present = snd_hda_jack_detect(codec, 0x21);
17668 bits = present ? HDA_AMP_MUTE : 0;
17669 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17670 HDA_AMP_MUTE, bits);
17671 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17672 HDA_AMP_MUTE, bits);
17673 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17674 HDA_AMP_MUTE, bits);
17675 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17676 HDA_AMP_MUTE, bits);
17679 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17681 unsigned int present;
17682 unsigned char bits;
17684 present = snd_hda_jack_detect(codec, 0x15);
17685 bits = present ? HDA_AMP_MUTE : 0;
17686 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17687 HDA_AMP_MUTE, bits);
17688 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17689 HDA_AMP_MUTE, bits);
17690 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17691 HDA_AMP_MUTE, bits);
17692 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17693 HDA_AMP_MUTE, bits);
17696 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17698 unsigned int present;
17699 unsigned char bits;
17701 present = snd_hda_jack_detect(codec, 0x1b);
17702 bits = present ? 0 : PIN_OUT;
17703 snd_hda_codec_write(codec, 0x14, 0,
17704 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17707 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17709 unsigned int present1, present2;
17711 present1 = snd_hda_jack_detect(codec, 0x21);
17712 present2 = snd_hda_jack_detect(codec, 0x15);
17714 if (present1 || present2) {
17715 snd_hda_codec_write_cache(codec, 0x14, 0,
17716 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17718 snd_hda_codec_write_cache(codec, 0x14, 0,
17719 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17723 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17725 unsigned int present1, present2;
17727 present1 = snd_hda_jack_detect(codec, 0x1b);
17728 present2 = snd_hda_jack_detect(codec, 0x15);
17730 if (present1 || present2) {
17731 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17732 HDA_AMP_MUTE, HDA_AMP_MUTE);
17733 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17734 HDA_AMP_MUTE, HDA_AMP_MUTE);
17736 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17738 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17743 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17745 unsigned int present1, present2;
17747 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17748 AC_VERB_GET_PIN_SENSE, 0)
17749 & AC_PINSENSE_PRESENCE;
17750 present2 = snd_hda_codec_read(codec, 0x21, 0,
17751 AC_VERB_GET_PIN_SENSE, 0)
17752 & AC_PINSENSE_PRESENCE;
17754 if (present1 || present2) {
17755 snd_hda_codec_write_cache(codec, 0x14, 0,
17756 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17757 snd_hda_codec_write_cache(codec, 0x17, 0,
17758 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17760 snd_hda_codec_write_cache(codec, 0x14, 0,
17761 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17762 snd_hda_codec_write_cache(codec, 0x17, 0,
17763 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17767 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17769 unsigned int present1, present2;
17771 present1 = snd_hda_codec_read(codec, 0x21, 0,
17772 AC_VERB_GET_PIN_SENSE, 0)
17773 & AC_PINSENSE_PRESENCE;
17774 present2 = snd_hda_codec_read(codec, 0x15, 0,
17775 AC_VERB_GET_PIN_SENSE, 0)
17776 & AC_PINSENSE_PRESENCE;
17778 if (present1 || present2) {
17779 snd_hda_codec_write_cache(codec, 0x14, 0,
17780 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17781 snd_hda_codec_write_cache(codec, 0x17, 0,
17782 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17784 snd_hda_codec_write_cache(codec, 0x14, 0,
17785 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17786 snd_hda_codec_write_cache(codec, 0x17, 0,
17787 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17791 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17794 switch (res >> 26) {
17795 case ALC880_HP_EVENT:
17796 alc663_m51va_speaker_automute(codec);
17798 case ALC880_MIC_EVENT:
17799 alc_mic_automute(codec);
17804 static void alc663_m51va_setup(struct hda_codec *codec)
17806 struct alc_spec *spec = codec->spec;
17807 spec->ext_mic.pin = 0x18;
17808 spec->ext_mic.mux_idx = 0;
17809 spec->int_mic.pin = 0x12;
17810 spec->int_mic.mux_idx = 9;
17811 spec->auto_mic = 1;
17814 static void alc663_m51va_inithook(struct hda_codec *codec)
17816 alc663_m51va_speaker_automute(codec);
17817 alc_mic_automute(codec);
17820 /* ***************** Mode1 ******************************/
17821 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17823 static void alc663_mode1_setup(struct hda_codec *codec)
17825 struct alc_spec *spec = codec->spec;
17826 spec->ext_mic.pin = 0x18;
17827 spec->ext_mic.mux_idx = 0;
17828 spec->int_mic.pin = 0x19;
17829 spec->int_mic.mux_idx = 1;
17830 spec->auto_mic = 1;
17833 #define alc663_mode1_inithook alc663_m51va_inithook
17835 /* ***************** Mode2 ******************************/
17836 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17839 switch (res >> 26) {
17840 case ALC880_HP_EVENT:
17841 alc662_f5z_speaker_automute(codec);
17843 case ALC880_MIC_EVENT:
17844 alc_mic_automute(codec);
17849 #define alc662_mode2_setup alc663_mode1_setup
17851 static void alc662_mode2_inithook(struct hda_codec *codec)
17853 alc662_f5z_speaker_automute(codec);
17854 alc_mic_automute(codec);
17856 /* ***************** Mode3 ******************************/
17857 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17860 switch (res >> 26) {
17861 case ALC880_HP_EVENT:
17862 alc663_two_hp_m1_speaker_automute(codec);
17864 case ALC880_MIC_EVENT:
17865 alc_mic_automute(codec);
17870 #define alc663_mode3_setup alc663_mode1_setup
17872 static void alc663_mode3_inithook(struct hda_codec *codec)
17874 alc663_two_hp_m1_speaker_automute(codec);
17875 alc_mic_automute(codec);
17877 /* ***************** Mode4 ******************************/
17878 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17881 switch (res >> 26) {
17882 case ALC880_HP_EVENT:
17883 alc663_21jd_two_speaker_automute(codec);
17885 case ALC880_MIC_EVENT:
17886 alc_mic_automute(codec);
17891 #define alc663_mode4_setup alc663_mode1_setup
17893 static void alc663_mode4_inithook(struct hda_codec *codec)
17895 alc663_21jd_two_speaker_automute(codec);
17896 alc_mic_automute(codec);
17898 /* ***************** Mode5 ******************************/
17899 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17902 switch (res >> 26) {
17903 case ALC880_HP_EVENT:
17904 alc663_15jd_two_speaker_automute(codec);
17906 case ALC880_MIC_EVENT:
17907 alc_mic_automute(codec);
17912 #define alc663_mode5_setup alc663_mode1_setup
17914 static void alc663_mode5_inithook(struct hda_codec *codec)
17916 alc663_15jd_two_speaker_automute(codec);
17917 alc_mic_automute(codec);
17919 /* ***************** Mode6 ******************************/
17920 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17923 switch (res >> 26) {
17924 case ALC880_HP_EVENT:
17925 alc663_two_hp_m2_speaker_automute(codec);
17927 case ALC880_MIC_EVENT:
17928 alc_mic_automute(codec);
17933 #define alc663_mode6_setup alc663_mode1_setup
17935 static void alc663_mode6_inithook(struct hda_codec *codec)
17937 alc663_two_hp_m2_speaker_automute(codec);
17938 alc_mic_automute(codec);
17941 /* ***************** Mode7 ******************************/
17942 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17945 switch (res >> 26) {
17946 case ALC880_HP_EVENT:
17947 alc663_two_hp_m7_speaker_automute(codec);
17949 case ALC880_MIC_EVENT:
17950 alc_mic_automute(codec);
17955 #define alc663_mode7_setup alc663_mode1_setup
17957 static void alc663_mode7_inithook(struct hda_codec *codec)
17959 alc663_two_hp_m7_speaker_automute(codec);
17960 alc_mic_automute(codec);
17963 /* ***************** Mode8 ******************************/
17964 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17967 switch (res >> 26) {
17968 case ALC880_HP_EVENT:
17969 alc663_two_hp_m8_speaker_automute(codec);
17971 case ALC880_MIC_EVENT:
17972 alc_mic_automute(codec);
17977 #define alc663_mode8_setup alc663_m51va_setup
17979 static void alc663_mode8_inithook(struct hda_codec *codec)
17981 alc663_two_hp_m8_speaker_automute(codec);
17982 alc_mic_automute(codec);
17985 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17987 unsigned int present;
17988 unsigned char bits;
17990 present = snd_hda_jack_detect(codec, 0x21);
17991 bits = present ? HDA_AMP_MUTE : 0;
17992 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17993 HDA_AMP_MUTE, bits);
17994 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17995 HDA_AMP_MUTE, bits);
17998 static void alc663_g71v_front_automute(struct hda_codec *codec)
18000 unsigned int present;
18001 unsigned char bits;
18003 present = snd_hda_jack_detect(codec, 0x15);
18004 bits = present ? HDA_AMP_MUTE : 0;
18005 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18006 HDA_AMP_MUTE, bits);
18009 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18012 switch (res >> 26) {
18013 case ALC880_HP_EVENT:
18014 alc663_g71v_hp_automute(codec);
18016 case ALC880_FRONT_EVENT:
18017 alc663_g71v_front_automute(codec);
18019 case ALC880_MIC_EVENT:
18020 alc_mic_automute(codec);
18025 #define alc663_g71v_setup alc663_m51va_setup
18027 static void alc663_g71v_inithook(struct hda_codec *codec)
18029 alc663_g71v_front_automute(codec);
18030 alc663_g71v_hp_automute(codec);
18031 alc_mic_automute(codec);
18034 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18037 switch (res >> 26) {
18038 case ALC880_HP_EVENT:
18039 alc663_m51va_speaker_automute(codec);
18041 case ALC880_MIC_EVENT:
18042 alc_mic_automute(codec);
18047 #define alc663_g50v_setup alc663_m51va_setup
18049 static void alc663_g50v_inithook(struct hda_codec *codec)
18051 alc663_m51va_speaker_automute(codec);
18052 alc_mic_automute(codec);
18055 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18056 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18057 ALC262_HIPPO_MASTER_SWITCH,
18059 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18060 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18061 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18063 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18064 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18065 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18069 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18070 /* Master Playback automatically created from Speaker and Headphone */
18071 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18072 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18073 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18074 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18076 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18077 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18078 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18080 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18081 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18082 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18086 #ifdef CONFIG_SND_HDA_POWER_SAVE
18087 #define alc662_loopbacks alc880_loopbacks
18091 /* pcm configuration: identical with ALC880 */
18092 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18093 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18094 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18095 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18098 * configuration and preset
18100 static const char *alc662_models[ALC662_MODEL_LAST] = {
18101 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18102 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18103 [ALC662_3ST_6ch] = "3stack-6ch",
18104 [ALC662_5ST_DIG] = "6stack-dig",
18105 [ALC662_LENOVO_101E] = "lenovo-101e",
18106 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18107 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18108 [ALC662_ECS] = "ecs",
18109 [ALC663_ASUS_M51VA] = "m51va",
18110 [ALC663_ASUS_G71V] = "g71v",
18111 [ALC663_ASUS_H13] = "h13",
18112 [ALC663_ASUS_G50V] = "g50v",
18113 [ALC663_ASUS_MODE1] = "asus-mode1",
18114 [ALC662_ASUS_MODE2] = "asus-mode2",
18115 [ALC663_ASUS_MODE3] = "asus-mode3",
18116 [ALC663_ASUS_MODE4] = "asus-mode4",
18117 [ALC663_ASUS_MODE5] = "asus-mode5",
18118 [ALC663_ASUS_MODE6] = "asus-mode6",
18119 [ALC663_ASUS_MODE7] = "asus-mode7",
18120 [ALC663_ASUS_MODE8] = "asus-mode8",
18121 [ALC272_DELL] = "dell",
18122 [ALC272_DELL_ZM1] = "dell-zm1",
18123 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18124 [ALC662_AUTO] = "auto",
18127 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18128 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18129 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18130 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18131 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18132 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18133 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18134 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18135 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18136 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18137 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18138 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18139 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18140 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18141 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18142 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18143 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18144 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18145 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18146 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18147 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18148 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18149 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18150 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18151 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18152 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18153 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18154 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18155 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18156 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18157 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18158 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18159 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18160 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18161 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18162 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18163 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18164 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18165 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18166 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18167 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18168 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18169 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18170 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18171 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18172 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18173 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18174 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18175 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18176 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18177 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18178 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18179 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18180 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18181 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18182 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18183 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18184 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18185 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18186 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18187 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18188 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18189 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18190 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18191 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18192 ALC662_3ST_6ch_DIG),
18193 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18194 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18195 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18196 ALC662_3ST_6ch_DIG),
18197 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18198 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18199 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18200 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18201 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18202 ALC662_3ST_6ch_DIG),
18203 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18208 static struct alc_config_preset alc662_presets[] = {
18209 [ALC662_3ST_2ch_DIG] = {
18210 .mixers = { alc662_3ST_2ch_mixer },
18211 .init_verbs = { alc662_init_verbs },
18212 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18213 .dac_nids = alc662_dac_nids,
18214 .dig_out_nid = ALC662_DIGOUT_NID,
18215 .dig_in_nid = ALC662_DIGIN_NID,
18216 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18217 .channel_mode = alc662_3ST_2ch_modes,
18218 .input_mux = &alc662_capture_source,
18220 [ALC662_3ST_6ch_DIG] = {
18221 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18222 .init_verbs = { alc662_init_verbs },
18223 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18224 .dac_nids = alc662_dac_nids,
18225 .dig_out_nid = ALC662_DIGOUT_NID,
18226 .dig_in_nid = ALC662_DIGIN_NID,
18227 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18228 .channel_mode = alc662_3ST_6ch_modes,
18230 .input_mux = &alc662_capture_source,
18232 [ALC662_3ST_6ch] = {
18233 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18234 .init_verbs = { alc662_init_verbs },
18235 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18236 .dac_nids = alc662_dac_nids,
18237 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18238 .channel_mode = alc662_3ST_6ch_modes,
18240 .input_mux = &alc662_capture_source,
18242 [ALC662_5ST_DIG] = {
18243 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18244 .init_verbs = { alc662_init_verbs },
18245 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18246 .dac_nids = alc662_dac_nids,
18247 .dig_out_nid = ALC662_DIGOUT_NID,
18248 .dig_in_nid = ALC662_DIGIN_NID,
18249 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18250 .channel_mode = alc662_5stack_modes,
18251 .input_mux = &alc662_capture_source,
18253 [ALC662_LENOVO_101E] = {
18254 .mixers = { alc662_lenovo_101e_mixer },
18255 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18256 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18257 .dac_nids = alc662_dac_nids,
18258 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18259 .channel_mode = alc662_3ST_2ch_modes,
18260 .input_mux = &alc662_lenovo_101e_capture_source,
18261 .unsol_event = alc662_lenovo_101e_unsol_event,
18262 .init_hook = alc662_lenovo_101e_all_automute,
18264 [ALC662_ASUS_EEEPC_P701] = {
18265 .mixers = { alc662_eeepc_p701_mixer },
18266 .init_verbs = { alc662_init_verbs,
18267 alc662_eeepc_sue_init_verbs },
18268 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18269 .dac_nids = alc662_dac_nids,
18270 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18271 .channel_mode = alc662_3ST_2ch_modes,
18272 .unsol_event = alc662_eeepc_unsol_event,
18273 .setup = alc662_eeepc_setup,
18274 .init_hook = alc662_eeepc_inithook,
18276 [ALC662_ASUS_EEEPC_EP20] = {
18277 .mixers = { alc662_eeepc_ep20_mixer,
18278 alc662_chmode_mixer },
18279 .init_verbs = { alc662_init_verbs,
18280 alc662_eeepc_ep20_sue_init_verbs },
18281 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18282 .dac_nids = alc662_dac_nids,
18283 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18284 .channel_mode = alc662_3ST_6ch_modes,
18285 .input_mux = &alc662_lenovo_101e_capture_source,
18286 .unsol_event = alc662_eeepc_unsol_event,
18287 .setup = alc662_eeepc_ep20_setup,
18288 .init_hook = alc662_eeepc_ep20_inithook,
18291 .mixers = { alc662_ecs_mixer },
18292 .init_verbs = { alc662_init_verbs,
18293 alc662_ecs_init_verbs },
18294 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18295 .dac_nids = alc662_dac_nids,
18296 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18297 .channel_mode = alc662_3ST_2ch_modes,
18298 .unsol_event = alc662_eeepc_unsol_event,
18299 .setup = alc662_eeepc_setup,
18300 .init_hook = alc662_eeepc_inithook,
18302 [ALC663_ASUS_M51VA] = {
18303 .mixers = { alc663_m51va_mixer },
18304 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18305 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18306 .dac_nids = alc662_dac_nids,
18307 .dig_out_nid = ALC662_DIGOUT_NID,
18308 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18309 .channel_mode = alc662_3ST_2ch_modes,
18310 .unsol_event = alc663_m51va_unsol_event,
18311 .setup = alc663_m51va_setup,
18312 .init_hook = alc663_m51va_inithook,
18314 [ALC663_ASUS_G71V] = {
18315 .mixers = { alc663_g71v_mixer },
18316 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18317 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18318 .dac_nids = alc662_dac_nids,
18319 .dig_out_nid = ALC662_DIGOUT_NID,
18320 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18321 .channel_mode = alc662_3ST_2ch_modes,
18322 .unsol_event = alc663_g71v_unsol_event,
18323 .setup = alc663_g71v_setup,
18324 .init_hook = alc663_g71v_inithook,
18326 [ALC663_ASUS_H13] = {
18327 .mixers = { alc663_m51va_mixer },
18328 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18329 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18330 .dac_nids = alc662_dac_nids,
18331 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18332 .channel_mode = alc662_3ST_2ch_modes,
18333 .unsol_event = alc663_m51va_unsol_event,
18334 .init_hook = alc663_m51va_inithook,
18336 [ALC663_ASUS_G50V] = {
18337 .mixers = { alc663_g50v_mixer },
18338 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18339 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18340 .dac_nids = alc662_dac_nids,
18341 .dig_out_nid = ALC662_DIGOUT_NID,
18342 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18343 .channel_mode = alc662_3ST_6ch_modes,
18344 .input_mux = &alc663_capture_source,
18345 .unsol_event = alc663_g50v_unsol_event,
18346 .setup = alc663_g50v_setup,
18347 .init_hook = alc663_g50v_inithook,
18349 [ALC663_ASUS_MODE1] = {
18350 .mixers = { alc663_m51va_mixer },
18351 .cap_mixer = alc662_auto_capture_mixer,
18352 .init_verbs = { alc662_init_verbs,
18353 alc663_21jd_amic_init_verbs },
18354 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18356 .dac_nids = alc662_dac_nids,
18357 .dig_out_nid = ALC662_DIGOUT_NID,
18358 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18359 .channel_mode = alc662_3ST_2ch_modes,
18360 .unsol_event = alc663_mode1_unsol_event,
18361 .setup = alc663_mode1_setup,
18362 .init_hook = alc663_mode1_inithook,
18364 [ALC662_ASUS_MODE2] = {
18365 .mixers = { alc662_1bjd_mixer },
18366 .cap_mixer = alc662_auto_capture_mixer,
18367 .init_verbs = { alc662_init_verbs,
18368 alc662_1bjd_amic_init_verbs },
18369 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18370 .dac_nids = alc662_dac_nids,
18371 .dig_out_nid = ALC662_DIGOUT_NID,
18372 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18373 .channel_mode = alc662_3ST_2ch_modes,
18374 .unsol_event = alc662_mode2_unsol_event,
18375 .setup = alc662_mode2_setup,
18376 .init_hook = alc662_mode2_inithook,
18378 [ALC663_ASUS_MODE3] = {
18379 .mixers = { alc663_two_hp_m1_mixer },
18380 .cap_mixer = alc662_auto_capture_mixer,
18381 .init_verbs = { alc662_init_verbs,
18382 alc663_two_hp_amic_m1_init_verbs },
18383 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18385 .dac_nids = alc662_dac_nids,
18386 .dig_out_nid = ALC662_DIGOUT_NID,
18387 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18388 .channel_mode = alc662_3ST_2ch_modes,
18389 .unsol_event = alc663_mode3_unsol_event,
18390 .setup = alc663_mode3_setup,
18391 .init_hook = alc663_mode3_inithook,
18393 [ALC663_ASUS_MODE4] = {
18394 .mixers = { alc663_asus_21jd_clfe_mixer },
18395 .cap_mixer = alc662_auto_capture_mixer,
18396 .init_verbs = { alc662_init_verbs,
18397 alc663_21jd_amic_init_verbs},
18398 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18400 .dac_nids = alc662_dac_nids,
18401 .dig_out_nid = ALC662_DIGOUT_NID,
18402 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18403 .channel_mode = alc662_3ST_2ch_modes,
18404 .unsol_event = alc663_mode4_unsol_event,
18405 .setup = alc663_mode4_setup,
18406 .init_hook = alc663_mode4_inithook,
18408 [ALC663_ASUS_MODE5] = {
18409 .mixers = { alc663_asus_15jd_clfe_mixer },
18410 .cap_mixer = alc662_auto_capture_mixer,
18411 .init_verbs = { alc662_init_verbs,
18412 alc663_15jd_amic_init_verbs },
18413 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18415 .dac_nids = alc662_dac_nids,
18416 .dig_out_nid = ALC662_DIGOUT_NID,
18417 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18418 .channel_mode = alc662_3ST_2ch_modes,
18419 .unsol_event = alc663_mode5_unsol_event,
18420 .setup = alc663_mode5_setup,
18421 .init_hook = alc663_mode5_inithook,
18423 [ALC663_ASUS_MODE6] = {
18424 .mixers = { alc663_two_hp_m2_mixer },
18425 .cap_mixer = alc662_auto_capture_mixer,
18426 .init_verbs = { alc662_init_verbs,
18427 alc663_two_hp_amic_m2_init_verbs },
18428 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18430 .dac_nids = alc662_dac_nids,
18431 .dig_out_nid = ALC662_DIGOUT_NID,
18432 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18433 .channel_mode = alc662_3ST_2ch_modes,
18434 .unsol_event = alc663_mode6_unsol_event,
18435 .setup = alc663_mode6_setup,
18436 .init_hook = alc663_mode6_inithook,
18438 [ALC663_ASUS_MODE7] = {
18439 .mixers = { alc663_mode7_mixer },
18440 .cap_mixer = alc662_auto_capture_mixer,
18441 .init_verbs = { alc662_init_verbs,
18442 alc663_mode7_init_verbs },
18443 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18445 .dac_nids = alc662_dac_nids,
18446 .dig_out_nid = ALC662_DIGOUT_NID,
18447 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18448 .channel_mode = alc662_3ST_2ch_modes,
18449 .unsol_event = alc663_mode7_unsol_event,
18450 .setup = alc663_mode7_setup,
18451 .init_hook = alc663_mode7_inithook,
18453 [ALC663_ASUS_MODE8] = {
18454 .mixers = { alc663_mode8_mixer },
18455 .cap_mixer = alc662_auto_capture_mixer,
18456 .init_verbs = { alc662_init_verbs,
18457 alc663_mode8_init_verbs },
18458 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18460 .dac_nids = alc662_dac_nids,
18461 .dig_out_nid = ALC662_DIGOUT_NID,
18462 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18463 .channel_mode = alc662_3ST_2ch_modes,
18464 .unsol_event = alc663_mode8_unsol_event,
18465 .setup = alc663_mode8_setup,
18466 .init_hook = alc663_mode8_inithook,
18469 .mixers = { alc663_m51va_mixer },
18470 .cap_mixer = alc272_auto_capture_mixer,
18471 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18472 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18473 .dac_nids = alc662_dac_nids,
18474 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18475 .adc_nids = alc272_adc_nids,
18476 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18477 .capsrc_nids = alc272_capsrc_nids,
18478 .channel_mode = alc662_3ST_2ch_modes,
18479 .unsol_event = alc663_m51va_unsol_event,
18480 .setup = alc663_m51va_setup,
18481 .init_hook = alc663_m51va_inithook,
18483 [ALC272_DELL_ZM1] = {
18484 .mixers = { alc663_m51va_mixer },
18485 .cap_mixer = alc662_auto_capture_mixer,
18486 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18487 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18488 .dac_nids = alc662_dac_nids,
18489 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18490 .adc_nids = alc662_adc_nids,
18492 .capsrc_nids = alc662_capsrc_nids,
18493 .channel_mode = alc662_3ST_2ch_modes,
18494 .unsol_event = alc663_m51va_unsol_event,
18495 .setup = alc663_m51va_setup,
18496 .init_hook = alc663_m51va_inithook,
18498 [ALC272_SAMSUNG_NC10] = {
18499 .mixers = { alc272_nc10_mixer },
18500 .init_verbs = { alc662_init_verbs,
18501 alc663_21jd_amic_init_verbs },
18502 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18503 .dac_nids = alc272_dac_nids,
18504 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18505 .channel_mode = alc662_3ST_2ch_modes,
18506 /*.input_mux = &alc272_nc10_capture_source,*/
18507 .unsol_event = alc663_mode4_unsol_event,
18508 .setup = alc663_mode4_setup,
18509 .init_hook = alc663_mode4_inithook,
18515 * BIOS auto configuration
18518 /* convert from MIX nid to DAC */
18519 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18523 else if (nid >= 0x0c && nid <= 0x0e)
18524 return nid - 0x0c + 0x02;
18529 /* get MIX nid connected to the given pin targeted to DAC */
18530 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18536 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18537 for (i = 0; i < num; i++) {
18538 if (alc662_mix_to_dac(mix[i]) == dac)
18544 /* look for an empty DAC slot */
18545 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18547 struct alc_spec *spec = codec->spec;
18551 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18554 for (i = 0; i < num; i++) {
18555 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18558 for (j = 0; j < spec->multiout.num_dacs; j++)
18559 if (spec->multiout.dac_nids[j] == nid)
18561 if (j >= spec->multiout.num_dacs)
18567 /* fill in the dac_nids table from the parsed pin configuration */
18568 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18569 const struct auto_pin_cfg *cfg)
18571 struct alc_spec *spec = codec->spec;
18575 spec->multiout.dac_nids = spec->private_dac_nids;
18576 for (i = 0; i < cfg->line_outs; i++) {
18577 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18580 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18585 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18586 hda_nid_t nid, unsigned int chs)
18588 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18589 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18592 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18593 hda_nid_t nid, unsigned int chs)
18595 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18596 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18599 #define alc662_add_stereo_vol(spec, pfx, nid) \
18600 alc662_add_vol_ctl(spec, pfx, nid, 3)
18601 #define alc662_add_stereo_sw(spec, pfx, nid) \
18602 alc662_add_sw_ctl(spec, pfx, nid, 3)
18604 /* add playback controls from the parsed DAC table */
18605 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18606 const struct auto_pin_cfg *cfg)
18608 struct alc_spec *spec = codec->spec;
18609 static const char *chname[4] = {
18610 "Front", "Surround", NULL /*CLFE*/, "Side"
18612 hda_nid_t nid, mix;
18615 for (i = 0; i < cfg->line_outs; i++) {
18616 nid = spec->multiout.dac_nids[i];
18619 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18624 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18627 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18630 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18633 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18638 if (cfg->line_outs == 1 &&
18639 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18646 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18649 if (cfg->line_outs == 1 &&
18650 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18652 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18660 /* add playback controls for speaker and HP outputs */
18661 /* return DAC nid if any new DAC is assigned */
18662 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18665 struct alc_spec *spec = codec->spec;
18666 hda_nid_t nid, mix;
18671 nid = alc662_look_for_dac(codec, pin);
18673 /* the corresponding DAC is already occupied */
18674 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18675 return 0; /* no way */
18676 /* create a switch only */
18677 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18678 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18681 mix = alc662_dac_to_mix(codec, pin, nid);
18684 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18687 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18693 /* create playback/capture controls for input pins */
18694 #define alc662_auto_create_input_ctls \
18695 alc882_auto_create_input_ctls
18697 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18698 hda_nid_t nid, int pin_type,
18702 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18704 alc_set_pin_output(codec, nid, pin_type);
18705 /* need the manual connection? */
18706 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18709 for (i = 0; i < num; i++) {
18710 if (alc662_mix_to_dac(srcs[i]) != dac)
18712 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18717 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18719 struct alc_spec *spec = codec->spec;
18720 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18723 for (i = 0; i <= HDA_SIDE; i++) {
18724 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18726 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18727 spec->multiout.dac_nids[i]);
18731 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18733 struct alc_spec *spec = codec->spec;
18736 pin = spec->autocfg.hp_pins[0];
18738 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18739 spec->multiout.hp_nid);
18740 pin = spec->autocfg.speaker_pins[0];
18742 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18743 spec->multiout.extra_out_nid[0]);
18746 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18748 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18750 struct alc_spec *spec = codec->spec;
18753 for (i = 0; i < AUTO_PIN_LAST; i++) {
18754 hda_nid_t nid = spec->autocfg.input_pins[i];
18755 if (alc_is_input_pin(codec, nid)) {
18756 alc_set_input_pin(codec, nid, i);
18757 if (nid != ALC662_PIN_CD_NID &&
18758 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18759 snd_hda_codec_write(codec, nid, 0,
18760 AC_VERB_SET_AMP_GAIN_MUTE,
18766 #define alc662_auto_init_input_src alc882_auto_init_input_src
18768 static int alc662_parse_auto_config(struct hda_codec *codec)
18770 struct alc_spec *spec = codec->spec;
18772 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18774 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18778 if (!spec->autocfg.line_outs)
18779 return 0; /* can't find valid BIOS pin config */
18781 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18784 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18787 err = alc662_auto_create_extra_out(codec,
18788 spec->autocfg.speaker_pins[0],
18793 spec->multiout.extra_out_nid[0] = err;
18794 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18799 spec->multiout.hp_nid = err;
18800 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18804 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18806 alc_auto_parse_digital(codec);
18808 if (spec->kctls.list)
18809 add_mixer(spec, spec->kctls.list);
18811 spec->num_mux_defs = 1;
18812 spec->input_mux = &spec->private_imux[0];
18814 add_verb(spec, alc662_init_verbs);
18815 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18816 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18817 add_verb(spec, alc663_init_verbs);
18819 if (codec->vendor_id == 0x10ec0272)
18820 add_verb(spec, alc272_init_verbs);
18822 err = alc_auto_add_mic_boost(codec);
18826 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18827 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18828 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18830 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18835 /* additional initialization for auto-configuration model */
18836 static void alc662_auto_init(struct hda_codec *codec)
18838 struct alc_spec *spec = codec->spec;
18839 alc662_auto_init_multi_out(codec);
18840 alc662_auto_init_hp_out(codec);
18841 alc662_auto_init_analog_input(codec);
18842 alc662_auto_init_input_src(codec);
18843 alc_auto_init_digital(codec);
18844 if (spec->unsol_event)
18845 alc_inithook(codec);
18848 static int patch_alc662(struct hda_codec *codec)
18850 struct alc_spec *spec;
18851 int err, board_config;
18853 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18857 codec->spec = spec;
18859 alc_auto_parse_customize_define(codec);
18861 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18863 if (alc_read_coef_idx(codec, 0) == 0x8020)
18864 alc_codec_rename(codec, "ALC661");
18865 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18866 codec->bus->pci->subsystem_vendor == 0x1025 &&
18867 spec->cdefine.platform_type == 1)
18868 alc_codec_rename(codec, "ALC272X");
18870 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18873 if (board_config < 0) {
18874 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18876 board_config = ALC662_AUTO;
18879 if (board_config == ALC662_AUTO) {
18880 /* automatic parse from the BIOS config */
18881 err = alc662_parse_auto_config(codec);
18887 "hda_codec: Cannot set up configuration "
18888 "from BIOS. Using base mode...\n");
18889 board_config = ALC662_3ST_2ch_DIG;
18893 if (has_cdefine_beep(codec)) {
18894 err = snd_hda_attach_beep_device(codec, 0x1);
18901 if (board_config != ALC662_AUTO)
18902 setup_preset(codec, &alc662_presets[board_config]);
18904 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18905 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18907 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18908 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18910 if (!spec->adc_nids) {
18911 spec->adc_nids = alc662_adc_nids;
18912 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18914 if (!spec->capsrc_nids)
18915 spec->capsrc_nids = alc662_capsrc_nids;
18917 if (!spec->cap_mixer)
18918 set_capture_mixer(codec);
18920 if (has_cdefine_beep(codec)) {
18921 switch (codec->vendor_id) {
18923 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18928 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18931 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18935 spec->vmaster_nid = 0x02;
18937 codec->patch_ops = alc_patch_ops;
18938 if (board_config == ALC662_AUTO)
18939 spec->init_hook = alc662_auto_init;
18940 #ifdef CONFIG_SND_HDA_POWER_SAVE
18941 if (!spec->loopback.amplist)
18942 spec->loopback.amplist = alc662_loopbacks;
18948 static int patch_alc888(struct hda_codec *codec)
18950 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18951 kfree(codec->chip_name);
18952 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18953 if (!codec->chip_name) {
18957 return patch_alc662(codec);
18959 return patch_alc882(codec);
18965 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
18966 #define alc680_modes alc260_modes
18968 static hda_nid_t alc680_dac_nids[3] = {
18969 /* Lout1, Lout2, hp */
18973 static hda_nid_t alc680_adc_nids[3] = {
18975 /* DMIC, MIC, Line-in*/
18979 static struct snd_kcontrol_new alc680_base_mixer[] = {
18980 /* output mixer control */
18981 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
18982 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18983 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
18984 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
18985 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
18989 static struct snd_kcontrol_new alc680_capture_mixer[] = {
18990 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
18991 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
18992 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
18993 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
18994 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
18995 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
19000 * generic initialization of ADC, input mixers and output mixers
19002 static struct hda_verb alc680_init_verbs[] = {
19003 /* Unmute DAC0-1 and set vol = 0 */
19004 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
19005 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
19006 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
19008 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
19009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
19010 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
19011 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
19012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
19014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19016 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19017 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19022 /* create input playback/capture controls for the given pin */
19023 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19024 const char *ctlname, int idx)
19042 if (spec->multiout.dac_nids[0] != dac &&
19043 spec->multiout.dac_nids[1] != dac) {
19044 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19045 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19050 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19051 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19055 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19061 /* add playback controls from the parsed DAC table */
19062 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19063 const struct auto_pin_cfg *cfg)
19068 spec->multiout.dac_nids = spec->private_dac_nids;
19070 nid = cfg->line_out_pins[0];
19073 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19077 err = alc680_new_analog_output(spec, nid, name, 0);
19082 nid = cfg->speaker_pins[0];
19084 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19088 nid = cfg->hp_pins[0];
19090 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19098 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19099 hda_nid_t nid, int pin_type)
19101 alc_set_pin_output(codec, nid, pin_type);
19104 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19106 struct alc_spec *spec = codec->spec;
19107 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19109 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19110 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19114 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19116 struct alc_spec *spec = codec->spec;
19119 pin = spec->autocfg.hp_pins[0];
19121 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19122 pin = spec->autocfg.speaker_pins[0];
19124 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19127 /* pcm configuration: identical with ALC880 */
19128 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19129 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19130 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19131 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19133 static struct hda_input_mux alc680_capture_source = {
19141 * BIOS auto configuration
19143 static int alc680_parse_auto_config(struct hda_codec *codec)
19145 struct alc_spec *spec = codec->spec;
19147 static hda_nid_t alc680_ignore[] = { 0 };
19149 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19153 if (!spec->autocfg.line_outs) {
19154 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19155 spec->multiout.max_channels = 2;
19156 spec->no_analog = 1;
19159 return 0; /* can't find valid BIOS pin config */
19161 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19165 spec->multiout.max_channels = 2;
19168 /* digital only support output */
19169 alc_auto_parse_digital(codec);
19170 if (spec->kctls.list)
19171 add_mixer(spec, spec->kctls.list);
19173 add_verb(spec, alc680_init_verbs);
19174 spec->num_mux_defs = 1;
19175 spec->input_mux = &alc680_capture_source;
19177 err = alc_auto_add_mic_boost(codec);
19184 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19186 /* init callback for auto-configuration model -- overriding the default init */
19187 static void alc680_auto_init(struct hda_codec *codec)
19189 struct alc_spec *spec = codec->spec;
19190 alc680_auto_init_multi_out(codec);
19191 alc680_auto_init_hp_out(codec);
19192 alc680_auto_init_analog_input(codec);
19193 alc_auto_init_digital(codec);
19194 if (spec->unsol_event)
19195 alc_inithook(codec);
19199 * configuration and preset
19201 static const char *alc680_models[ALC680_MODEL_LAST] = {
19202 [ALC680_BASE] = "base",
19203 [ALC680_AUTO] = "auto",
19206 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19207 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19211 static struct alc_config_preset alc680_presets[] = {
19213 .mixers = { alc680_base_mixer },
19214 .cap_mixer = alc680_capture_mixer,
19215 .init_verbs = { alc680_init_verbs },
19216 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19217 .dac_nids = alc680_dac_nids,
19218 .num_adc_nids = ARRAY_SIZE(alc680_adc_nids),
19219 .adc_nids = alc680_adc_nids,
19221 .dig_out_nid = ALC680_DIGOUT_NID,
19222 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19223 .channel_mode = alc680_modes,
19224 .input_mux = &alc680_capture_source,
19228 static int patch_alc680(struct hda_codec *codec)
19230 struct alc_spec *spec;
19234 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19238 codec->spec = spec;
19240 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19244 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19245 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19247 board_config = ALC680_AUTO;
19250 if (board_config == ALC680_AUTO) {
19251 /* automatic parse from the BIOS config */
19252 err = alc680_parse_auto_config(codec);
19258 "hda_codec: Cannot set up configuration "
19259 "from BIOS. Using base mode...\n");
19260 board_config = ALC680_BASE;
19264 if (board_config != ALC680_AUTO)
19265 setup_preset(codec, &alc680_presets[board_config]);
19267 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19268 spec->stream_analog_capture = &alc680_pcm_analog_capture;
19269 spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture;
19270 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19272 if (!spec->adc_nids) {
19273 spec->adc_nids = alc680_adc_nids;
19274 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19277 if (!spec->cap_mixer)
19278 set_capture_mixer(codec);
19280 spec->vmaster_nid = 0x02;
19282 codec->patch_ops = alc_patch_ops;
19283 if (board_config == ALC680_AUTO)
19284 spec->init_hook = alc680_auto_init;
19292 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19293 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19294 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19295 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19296 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19297 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19298 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19299 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19300 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19301 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19302 .patch = patch_alc861 },
19303 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19304 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19305 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19306 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19307 .patch = patch_alc882 },
19308 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19309 .patch = patch_alc662 },
19310 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19311 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19312 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19313 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19314 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19315 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19316 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19317 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19318 .patch = patch_alc882 },
19319 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19320 .patch = patch_alc882 },
19321 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19322 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19323 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19324 .patch = patch_alc882 },
19325 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19326 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19327 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19328 {} /* terminator */
19331 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19333 MODULE_LICENSE("GPL");
19334 MODULE_DESCRIPTION("Realtek HD-audio codec");
19336 static struct hda_codec_preset_list realtek_list = {
19337 .preset = snd_hda_preset_realtek,
19338 .owner = THIS_MODULE,
19341 static int __init patch_realtek_init(void)
19343 return snd_hda_add_codec_preset(&realtek_list);
19346 static void __exit patch_realtek_exit(void)
19348 snd_hda_delete_codec_preset(&realtek_list);
19351 module_init(patch_realtek_init)
19352 module_exit(patch_realtek_exit)