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) {
850 pincap = snd_hda_query_pin_caps(codec, nid);
851 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
852 if (pincap & AC_PINCAP_VREF_80)
854 else if (pincap & AC_PINCAP_VREF_50)
856 else if (pincap & AC_PINCAP_VREF_100)
858 else if (pincap & AC_PINCAP_VREF_GRD)
861 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
866 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
868 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
870 spec->mixers[spec->num_mixers++] = mix;
873 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
875 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
877 spec->init_verbs[spec->num_init_verbs++] = verb;
881 * set up from the preset table
883 static void setup_preset(struct hda_codec *codec,
884 const struct alc_config_preset *preset)
886 struct alc_spec *spec = codec->spec;
889 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
890 add_mixer(spec, preset->mixers[i]);
891 spec->cap_mixer = preset->cap_mixer;
892 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
894 add_verb(spec, preset->init_verbs[i]);
896 spec->channel_mode = preset->channel_mode;
897 spec->num_channel_mode = preset->num_channel_mode;
898 spec->need_dac_fix = preset->need_dac_fix;
899 spec->const_channel_count = preset->const_channel_count;
901 if (preset->const_channel_count)
902 spec->multiout.max_channels = preset->const_channel_count;
904 spec->multiout.max_channels = spec->channel_mode[0].channels;
905 spec->ext_channel_count = spec->channel_mode[0].channels;
907 spec->multiout.num_dacs = preset->num_dacs;
908 spec->multiout.dac_nids = preset->dac_nids;
909 spec->multiout.dig_out_nid = preset->dig_out_nid;
910 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
911 spec->multiout.hp_nid = preset->hp_nid;
913 spec->num_mux_defs = preset->num_mux_defs;
914 if (!spec->num_mux_defs)
915 spec->num_mux_defs = 1;
916 spec->input_mux = preset->input_mux;
918 spec->num_adc_nids = preset->num_adc_nids;
919 spec->adc_nids = preset->adc_nids;
920 spec->capsrc_nids = preset->capsrc_nids;
921 spec->dig_in_nid = preset->dig_in_nid;
923 spec->unsol_event = preset->unsol_event;
924 spec->init_hook = preset->init_hook;
925 #ifdef CONFIG_SND_HDA_POWER_SAVE
926 spec->power_hook = preset->power_hook;
927 spec->loopback.amplist = preset->loopbacks;
931 preset->setup(codec);
934 /* Enable GPIO mask and set output */
935 static struct hda_verb alc_gpio1_init_verbs[] = {
936 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
937 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
938 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
942 static struct hda_verb alc_gpio2_init_verbs[] = {
943 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
944 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
945 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
949 static struct hda_verb alc_gpio3_init_verbs[] = {
950 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
951 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
952 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
957 * Fix hardware PLL issue
958 * On some codecs, the analog PLL gating control must be off while
959 * the default value is 1.
961 static void alc_fix_pll(struct hda_codec *codec)
963 struct alc_spec *spec = codec->spec;
968 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
970 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
971 AC_VERB_GET_PROC_COEF, 0);
972 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
974 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
975 val & ~(1 << spec->pll_coef_bit));
978 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
979 unsigned int coef_idx, unsigned int coef_bit)
981 struct alc_spec *spec = codec->spec;
983 spec->pll_coef_idx = coef_idx;
984 spec->pll_coef_bit = coef_bit;
988 static void alc_automute_pin(struct hda_codec *codec)
990 struct alc_spec *spec = codec->spec;
991 unsigned int nid = spec->autocfg.hp_pins[0];
996 spec->jack_present = snd_hda_jack_detect(codec, nid);
997 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
998 nid = spec->autocfg.speaker_pins[i];
1001 snd_hda_codec_write(codec, nid, 0,
1002 AC_VERB_SET_PIN_WIDGET_CONTROL,
1003 spec->jack_present ? 0 : PIN_OUT);
1007 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1010 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1013 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1014 for (i = 0; i < nums; i++)
1020 /* switch the current ADC according to the jack state */
1021 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1023 struct alc_spec *spec = codec->spec;
1024 unsigned int present;
1027 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1029 spec->cur_adc_idx = 1;
1031 spec->cur_adc_idx = 0;
1032 new_adc = spec->adc_nids[spec->cur_adc_idx];
1033 if (spec->cur_adc && spec->cur_adc != new_adc) {
1034 /* stream is running, let's swap the current ADC */
1035 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
1036 spec->cur_adc = new_adc;
1037 snd_hda_codec_setup_stream(codec, new_adc,
1038 spec->cur_adc_stream_tag, 0,
1039 spec->cur_adc_format);
1043 static void alc_mic_automute(struct hda_codec *codec)
1045 struct alc_spec *spec = codec->spec;
1046 struct alc_mic_route *dead, *alive;
1047 unsigned int present, type;
1050 if (!spec->auto_mic)
1052 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1054 if (snd_BUG_ON(!spec->adc_nids))
1057 if (spec->dual_adc_switch) {
1058 alc_dual_mic_adc_auto_switch(codec);
1062 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1064 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1066 alive = &spec->ext_mic;
1067 dead = &spec->int_mic;
1069 alive = &spec->int_mic;
1070 dead = &spec->ext_mic;
1073 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1074 if (type == AC_WID_AUD_MIX) {
1075 /* Matrix-mixer style (e.g. ALC882) */
1076 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1079 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1081 HDA_AMP_MUTE, HDA_AMP_MUTE);
1083 /* MUX style (e.g. ALC880) */
1084 snd_hda_codec_write_cache(codec, cap_nid, 0,
1085 AC_VERB_SET_CONNECT_SEL,
1089 /* FIXME: analog mixer */
1092 /* unsolicited event for HP jack sensing */
1093 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1095 if (codec->vendor_id == 0x10ec0880)
1100 case ALC880_HP_EVENT:
1101 alc_automute_pin(codec);
1103 case ALC880_MIC_EVENT:
1104 alc_mic_automute(codec);
1109 static void alc_inithook(struct hda_codec *codec)
1111 alc_automute_pin(codec);
1112 alc_mic_automute(codec);
1115 /* additional initialization for ALC888 variants */
1116 static void alc888_coef_init(struct hda_codec *codec)
1120 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1121 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1122 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1123 if ((tmp & 0xf0) == 0x20)
1125 snd_hda_codec_read(codec, 0x20, 0,
1126 AC_VERB_SET_PROC_COEF, 0x830);
1129 snd_hda_codec_read(codec, 0x20, 0,
1130 AC_VERB_SET_PROC_COEF, 0x3030);
1133 static void alc889_coef_init(struct hda_codec *codec)
1137 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1138 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1139 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1140 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1143 /* turn on/off EAPD control (only if available) */
1144 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1146 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1148 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1149 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1153 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1158 case ALC_INIT_GPIO1:
1159 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1161 case ALC_INIT_GPIO2:
1162 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1164 case ALC_INIT_GPIO3:
1165 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1167 case ALC_INIT_DEFAULT:
1168 switch (codec->vendor_id) {
1170 set_eapd(codec, 0x0f, 1);
1171 set_eapd(codec, 0x10, 1);
1184 set_eapd(codec, 0x14, 1);
1185 set_eapd(codec, 0x15, 1);
1188 switch (codec->vendor_id) {
1190 snd_hda_codec_write(codec, 0x1a, 0,
1191 AC_VERB_SET_COEF_INDEX, 7);
1192 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1193 AC_VERB_GET_PROC_COEF, 0);
1194 snd_hda_codec_write(codec, 0x1a, 0,
1195 AC_VERB_SET_COEF_INDEX, 7);
1196 snd_hda_codec_write(codec, 0x1a, 0,
1197 AC_VERB_SET_PROC_COEF,
1207 alc889_coef_init(codec);
1210 alc888_coef_init(codec);
1212 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1215 snd_hda_codec_write(codec, 0x20, 0,
1216 AC_VERB_SET_COEF_INDEX, 7);
1217 tmp = snd_hda_codec_read(codec, 0x20, 0,
1218 AC_VERB_GET_PROC_COEF, 0);
1219 snd_hda_codec_write(codec, 0x20, 0,
1220 AC_VERB_SET_COEF_INDEX, 7);
1221 snd_hda_codec_write(codec, 0x20, 0,
1222 AC_VERB_SET_PROC_COEF,
1231 static void alc_init_auto_hp(struct hda_codec *codec)
1233 struct alc_spec *spec = codec->spec;
1235 if (!spec->autocfg.hp_pins[0])
1238 if (!spec->autocfg.speaker_pins[0]) {
1239 if (spec->autocfg.line_out_pins[0] &&
1240 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1241 spec->autocfg.speaker_pins[0] =
1242 spec->autocfg.line_out_pins[0];
1247 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1248 spec->autocfg.hp_pins[0]);
1249 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1250 AC_VERB_SET_UNSOLICITED_ENABLE,
1251 AC_USRSP_EN | ALC880_HP_EVENT);
1252 spec->unsol_event = alc_sku_unsol_event;
1255 static void alc_init_auto_mic(struct hda_codec *codec)
1257 struct alc_spec *spec = codec->spec;
1258 struct auto_pin_cfg *cfg = &spec->autocfg;
1259 hda_nid_t fixed, ext;
1262 /* there must be only two mic inputs exclusively */
1263 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1264 if (cfg->input_pins[i])
1268 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1269 hda_nid_t nid = cfg->input_pins[i];
1270 unsigned int defcfg;
1273 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1274 switch (get_defcfg_connect(defcfg)) {
1275 case AC_JACK_PORT_FIXED:
1277 return; /* already occupied */
1280 case AC_JACK_PORT_COMPLEX:
1282 return; /* already occupied */
1286 return; /* invalid entry */
1291 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1292 return; /* no unsol support */
1293 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1295 spec->ext_mic.pin = ext;
1296 spec->int_mic.pin = fixed;
1297 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1298 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1300 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1301 AC_VERB_SET_UNSOLICITED_ENABLE,
1302 AC_USRSP_EN | ALC880_MIC_EVENT);
1303 spec->unsol_event = alc_sku_unsol_event;
1306 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1308 unsigned int ass, tmp, i;
1310 struct alc_spec *spec = codec->spec;
1312 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1314 ass = codec->subsystem_id & 0xffff;
1315 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1319 if (codec->vendor_id == 0x10ec0260)
1321 ass = snd_hda_codec_get_pincfg(codec, nid);
1324 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1325 codec->chip_name, ass);
1331 for (i = 1; i < 16; i++) {
1335 if (((ass >> 16) & 0xf) != tmp)
1338 spec->cdefine.port_connectivity = ass >> 30;
1339 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1340 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1341 spec->cdefine.customization = ass >> 8;
1343 spec->cdefine.sku_cfg = ass;
1344 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1345 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1346 spec->cdefine.swap = (ass & 0x2) >> 1;
1347 spec->cdefine.override = ass & 0x1;
1349 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1350 nid, spec->cdefine.sku_cfg);
1351 snd_printd("SKU: port_connectivity=0x%x\n",
1352 spec->cdefine.port_connectivity);
1353 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1354 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1355 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1356 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1357 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1358 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1359 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1364 /* check subsystem ID and set up device-specific initialization;
1365 * return 1 if initialized, 0 if invalid SSID
1367 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1368 * 31 ~ 16 : Manufacture ID
1370 * 7 ~ 0 : Assembly ID
1371 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1373 static int alc_subsystem_id(struct hda_codec *codec,
1374 hda_nid_t porta, hda_nid_t porte,
1375 hda_nid_t portd, hda_nid_t porti)
1377 unsigned int ass, tmp, i;
1379 struct alc_spec *spec = codec->spec;
1381 ass = codec->subsystem_id & 0xffff;
1382 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1385 /* invalid SSID, check the special NID pin defcfg instead */
1387 * 31~30 : port connectivity
1390 * 19~16 : Check sum (15:1)
1395 if (codec->vendor_id == 0x10ec0260)
1397 ass = snd_hda_codec_get_pincfg(codec, nid);
1398 snd_printd("realtek: No valid SSID, "
1399 "checking pincfg 0x%08x for NID 0x%x\n",
1403 if ((ass >> 30) != 1) /* no physical connection */
1408 for (i = 1; i < 16; i++) {
1412 if (((ass >> 16) & 0xf) != tmp)
1415 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1416 ass & 0xffff, codec->vendor_id);
1420 * 2 : 0 --> Desktop, 1 --> Laptop
1421 * 3~5 : External Amplifier control
1424 tmp = (ass & 0x38) >> 3; /* external Amp control */
1427 spec->init_amp = ALC_INIT_GPIO1;
1430 spec->init_amp = ALC_INIT_GPIO2;
1433 spec->init_amp = ALC_INIT_GPIO3;
1436 spec->init_amp = ALC_INIT_DEFAULT;
1440 /* is laptop or Desktop and enable the function "Mute internal speaker
1441 * when the external headphone out jack is plugged"
1443 if (!(ass & 0x8000))
1446 * 10~8 : Jack location
1447 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1449 * 15 : 1 --> enable the function "Mute internal speaker
1450 * when the external headphone out jack is plugged"
1452 if (!spec->autocfg.hp_pins[0]) {
1454 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1465 for (i = 0; i < spec->autocfg.line_outs; i++)
1466 if (spec->autocfg.line_out_pins[i] == nid)
1468 spec->autocfg.hp_pins[0] = nid;
1471 alc_init_auto_hp(codec);
1472 alc_init_auto_mic(codec);
1476 static void alc_ssid_check(struct hda_codec *codec,
1477 hda_nid_t porta, hda_nid_t porte,
1478 hda_nid_t portd, hda_nid_t porti)
1480 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1481 struct alc_spec *spec = codec->spec;
1482 snd_printd("realtek: "
1483 "Enable default setup for auto mode as fallback\n");
1484 spec->init_amp = ALC_INIT_DEFAULT;
1485 alc_init_auto_hp(codec);
1486 alc_init_auto_mic(codec);
1491 * Fix-up pin default configurations and add default verbs
1500 const struct alc_pincfg *pins;
1501 const struct hda_verb *verbs;
1504 static void alc_pick_fixup(struct hda_codec *codec,
1505 const struct snd_pci_quirk *quirk,
1506 const struct alc_fixup *fix,
1509 const struct alc_pincfg *cfg;
1511 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1514 fix += quirk->value;
1516 if (pre_init && cfg) {
1517 #ifdef CONFIG_SND_DEBUG_VERBOSE
1518 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1519 codec->chip_name, quirk->name);
1521 for (; cfg->nid; cfg++)
1522 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1524 if (!pre_init && fix->verbs) {
1525 #ifdef CONFIG_SND_DEBUG_VERBOSE
1526 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1527 codec->chip_name, quirk->name);
1529 add_verb(codec->spec, fix->verbs);
1533 static int alc_read_coef_idx(struct hda_codec *codec,
1534 unsigned int coef_idx)
1537 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1539 val = snd_hda_codec_read(codec, 0x20, 0,
1540 AC_VERB_GET_PROC_COEF, 0);
1544 /* set right pin controls for digital I/O */
1545 static void alc_auto_init_digital(struct hda_codec *codec)
1547 struct alc_spec *spec = codec->spec;
1551 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1552 pin = spec->autocfg.dig_out_pins[i];
1554 snd_hda_codec_write(codec, pin, 0,
1555 AC_VERB_SET_PIN_WIDGET_CONTROL,
1559 pin = spec->autocfg.dig_in_pin;
1561 snd_hda_codec_write(codec, pin, 0,
1562 AC_VERB_SET_PIN_WIDGET_CONTROL,
1566 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1567 static void alc_auto_parse_digital(struct hda_codec *codec)
1569 struct alc_spec *spec = codec->spec;
1573 /* support multiple SPDIFs; the secondary is set up as a slave */
1574 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1575 err = snd_hda_get_connections(codec,
1576 spec->autocfg.dig_out_pins[i],
1581 spec->multiout.dig_out_nid = dig_nid;
1582 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1584 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1585 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1587 spec->slave_dig_outs[i - 1] = dig_nid;
1591 if (spec->autocfg.dig_in_pin) {
1593 err = snd_hda_get_connections(codec,
1594 spec->autocfg.dig_in_pin,
1597 spec->dig_in_nid = dig_nid;
1608 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1609 /* Mic-in jack as mic in */
1610 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1611 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1612 /* Line-in jack as Line in */
1613 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1614 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1615 /* Line-Out as Front */
1616 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1623 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1624 /* Mic-in jack as mic in */
1625 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1626 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1627 /* Line-in jack as Surround */
1628 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1629 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1630 /* Line-Out as Front */
1631 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1638 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1639 /* Mic-in jack as CLFE */
1640 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1641 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1642 /* Line-in jack as Surround */
1643 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1644 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1645 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1646 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1653 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1654 /* Mic-in jack as CLFE */
1655 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1656 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1657 /* Line-in jack as Surround */
1658 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1659 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1660 /* Line-Out as Side */
1661 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1665 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1666 { 2, alc888_4ST_ch2_intel_init },
1667 { 4, alc888_4ST_ch4_intel_init },
1668 { 6, alc888_4ST_ch6_intel_init },
1669 { 8, alc888_4ST_ch8_intel_init },
1673 * ALC888 Fujitsu Siemens Amillo xa3530
1676 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1677 /* Front Mic: set to PIN_IN (empty by default) */
1678 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1679 /* Connect Internal HP to Front */
1680 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1682 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1683 /* Connect Bass HP to Front */
1684 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1685 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1686 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1687 /* Connect Line-Out side jack (SPDIF) to Side */
1688 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1691 /* Connect Mic jack to CLFE */
1692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1695 /* Connect Line-in jack to Surround */
1696 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1698 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1699 /* Connect HP out jack to Front */
1700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1701 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1702 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1703 /* Enable unsolicited event for HP jack and Line-out jack */
1704 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1705 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1709 static void alc_automute_amp(struct hda_codec *codec)
1711 struct alc_spec *spec = codec->spec;
1716 spec->jack_present = 0;
1717 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1718 nid = spec->autocfg.hp_pins[i];
1721 if (snd_hda_jack_detect(codec, nid)) {
1722 spec->jack_present = 1;
1727 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1728 /* Toggle internal speakers muting */
1729 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1730 nid = spec->autocfg.speaker_pins[i];
1733 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1734 HDA_AMP_MUTE, mute);
1738 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1741 if (codec->vendor_id == 0x10ec0880)
1745 if (res == ALC880_HP_EVENT)
1746 alc_automute_amp(codec);
1749 static void alc889_automute_setup(struct hda_codec *codec)
1751 struct alc_spec *spec = codec->spec;
1753 spec->autocfg.hp_pins[0] = 0x15;
1754 spec->autocfg.speaker_pins[0] = 0x14;
1755 spec->autocfg.speaker_pins[1] = 0x16;
1756 spec->autocfg.speaker_pins[2] = 0x17;
1757 spec->autocfg.speaker_pins[3] = 0x19;
1758 spec->autocfg.speaker_pins[4] = 0x1a;
1761 static void alc889_intel_init_hook(struct hda_codec *codec)
1763 alc889_coef_init(codec);
1764 alc_automute_amp(codec);
1767 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1769 struct alc_spec *spec = codec->spec;
1771 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1772 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1773 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1774 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1778 * ALC888 Acer Aspire 4930G model
1781 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1782 /* Front Mic: set to PIN_IN (empty by default) */
1783 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1784 /* Unselect Front Mic by default in input mixer 3 */
1785 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1786 /* Enable unsolicited event for HP jack */
1787 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1788 /* Connect Internal HP to front */
1789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1791 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1792 /* Connect HP out to front */
1793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1795 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1800 * ALC888 Acer Aspire 6530G model
1803 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1804 /* Route to built-in subwoofer as well as speakers */
1805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1806 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1807 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1808 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1809 /* Bias voltage on for external mic port */
1810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1811 /* Front Mic: set to PIN_IN (empty by default) */
1812 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1813 /* Unselect Front Mic by default in input mixer 3 */
1814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1815 /* Enable unsolicited event for HP jack */
1816 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1817 /* Enable speaker output */
1818 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1819 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1820 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1821 /* Enable headphone output */
1822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1824 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1825 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1830 * ALC889 Acer Aspire 8930G model
1833 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1834 /* Front Mic: set to PIN_IN (empty by default) */
1835 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1836 /* Unselect Front Mic by default in input mixer 3 */
1837 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1838 /* Enable unsolicited event for HP jack */
1839 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1840 /* Connect Internal Front to Front */
1841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1842 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1843 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1844 /* Connect Internal Rear to Rear */
1845 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1846 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1847 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1848 /* Connect Internal CLFE to CLFE */
1849 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1850 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1851 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1852 /* Connect HP out to Front */
1853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1856 /* Enable all DACs */
1857 /* DAC DISABLE/MUTE 1? */
1858 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1859 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1860 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1861 /* DAC DISABLE/MUTE 2? */
1862 /* some bit here disables the other DACs. Init=0x4900 */
1863 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1864 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1866 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1867 * which makes the stereo useless. However, either the mic or the ALC889
1868 * makes the signal become a difference/sum signal instead of standard
1869 * stereo, which is annoying. So instead we flip this bit which makes the
1870 * codec replicate the sum signal to both channels, turning it into a
1873 /* DMIC_CONTROL? Init value = 0x0001 */
1874 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1875 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1879 static struct hda_input_mux alc888_2_capture_sources[2] = {
1880 /* Front mic only available on one ADC */
1887 { "Front Mic", 0xb },
1900 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1901 /* Interal mic only available on one ADC */
1908 { "Input Mix", 0xa },
1918 { "Input Mix", 0xa },
1923 static struct hda_input_mux alc889_capture_sources[3] = {
1924 /* Digital mic only available on first "ADC" */
1931 { "Front Mic", 0xb },
1932 { "Input Mix", 0xa },
1941 { "Input Mix", 0xa },
1950 { "Input Mix", 0xa },
1955 static struct snd_kcontrol_new alc888_base_mixer[] = {
1956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1957 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1958 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1959 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1960 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1962 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1963 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1964 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1965 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1966 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1972 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1977 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1978 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1979 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1980 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1981 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1982 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1990 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1991 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1996 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1998 struct alc_spec *spec = codec->spec;
2000 spec->autocfg.hp_pins[0] = 0x15;
2001 spec->autocfg.speaker_pins[0] = 0x14;
2002 spec->autocfg.speaker_pins[1] = 0x16;
2003 spec->autocfg.speaker_pins[2] = 0x17;
2006 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2008 struct alc_spec *spec = codec->spec;
2010 spec->autocfg.hp_pins[0] = 0x15;
2011 spec->autocfg.speaker_pins[0] = 0x14;
2012 spec->autocfg.speaker_pins[1] = 0x16;
2013 spec->autocfg.speaker_pins[2] = 0x17;
2016 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2018 struct alc_spec *spec = codec->spec;
2020 spec->autocfg.hp_pins[0] = 0x15;
2021 spec->autocfg.speaker_pins[0] = 0x14;
2022 spec->autocfg.speaker_pins[1] = 0x16;
2023 spec->autocfg.speaker_pins[2] = 0x1b;
2027 * ALC880 3-stack model
2029 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2030 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2031 * F-Mic = 0x1b, HP = 0x19
2034 static hda_nid_t alc880_dac_nids[4] = {
2035 /* front, rear, clfe, rear_surr */
2036 0x02, 0x05, 0x04, 0x03
2039 static hda_nid_t alc880_adc_nids[3] = {
2044 /* The datasheet says the node 0x07 is connected from inputs,
2045 * but it shows zero connection in the real implementation on some devices.
2046 * Note: this is a 915GAV bug, fixed on 915GLV
2048 static hda_nid_t alc880_adc_nids_alt[2] = {
2053 #define ALC880_DIGOUT_NID 0x06
2054 #define ALC880_DIGIN_NID 0x0a
2056 static struct hda_input_mux alc880_capture_source = {
2060 { "Front Mic", 0x3 },
2066 /* channel source setting (2/6 channel selection for 3-stack) */
2068 static struct hda_verb alc880_threestack_ch2_init[] = {
2069 /* set line-in to input, mute it */
2070 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2071 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2072 /* set mic-in to input vref 80%, mute it */
2073 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2074 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2079 static struct hda_verb alc880_threestack_ch6_init[] = {
2080 /* set line-in to output, unmute it */
2081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2083 /* set mic-in to output, unmute it */
2084 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2085 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2089 static struct hda_channel_mode alc880_threestack_modes[2] = {
2090 { 2, alc880_threestack_ch2_init },
2091 { 6, alc880_threestack_ch6_init },
2094 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2095 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2096 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2097 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2098 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2099 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2100 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2102 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2106 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2109 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2110 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2114 .name = "Channel Mode",
2115 .info = alc_ch_mode_info,
2116 .get = alc_ch_mode_get,
2117 .put = alc_ch_mode_put,
2122 /* capture mixer elements */
2123 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2124 struct snd_ctl_elem_info *uinfo)
2126 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2127 struct alc_spec *spec = codec->spec;
2130 mutex_lock(&codec->control_mutex);
2131 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2133 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2134 mutex_unlock(&codec->control_mutex);
2138 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2139 unsigned int size, unsigned int __user *tlv)
2141 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2142 struct alc_spec *spec = codec->spec;
2145 mutex_lock(&codec->control_mutex);
2146 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2148 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2149 mutex_unlock(&codec->control_mutex);
2153 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2154 struct snd_ctl_elem_value *ucontrol);
2156 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2157 struct snd_ctl_elem_value *ucontrol,
2160 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2161 struct alc_spec *spec = codec->spec;
2162 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2165 mutex_lock(&codec->control_mutex);
2166 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2168 err = func(kcontrol, ucontrol);
2169 mutex_unlock(&codec->control_mutex);
2173 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2174 struct snd_ctl_elem_value *ucontrol)
2176 return alc_cap_getput_caller(kcontrol, ucontrol,
2177 snd_hda_mixer_amp_volume_get);
2180 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2181 struct snd_ctl_elem_value *ucontrol)
2183 return alc_cap_getput_caller(kcontrol, ucontrol,
2184 snd_hda_mixer_amp_volume_put);
2187 /* capture mixer elements */
2188 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2190 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2191 struct snd_ctl_elem_value *ucontrol)
2193 return alc_cap_getput_caller(kcontrol, ucontrol,
2194 snd_hda_mixer_amp_switch_get);
2197 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2198 struct snd_ctl_elem_value *ucontrol)
2200 return alc_cap_getput_caller(kcontrol, ucontrol,
2201 snd_hda_mixer_amp_switch_put);
2204 #define _DEFINE_CAPMIX(num) \
2206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2207 .name = "Capture Switch", \
2208 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2210 .info = alc_cap_sw_info, \
2211 .get = alc_cap_sw_get, \
2212 .put = alc_cap_sw_put, \
2215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2216 .name = "Capture Volume", \
2217 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2218 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2219 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2221 .info = alc_cap_vol_info, \
2222 .get = alc_cap_vol_get, \
2223 .put = alc_cap_vol_put, \
2224 .tlv = { .c = alc_cap_vol_tlv }, \
2227 #define _DEFINE_CAPSRC(num) \
2229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2230 /* .name = "Capture Source", */ \
2231 .name = "Input Source", \
2233 .info = alc_mux_enum_info, \
2234 .get = alc_mux_enum_get, \
2235 .put = alc_mux_enum_put, \
2238 #define DEFINE_CAPMIX(num) \
2239 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2240 _DEFINE_CAPMIX(num), \
2241 _DEFINE_CAPSRC(num), \
2245 #define DEFINE_CAPMIX_NOSRC(num) \
2246 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2247 _DEFINE_CAPMIX(num), \
2251 /* up to three ADCs */
2255 DEFINE_CAPMIX_NOSRC(1);
2256 DEFINE_CAPMIX_NOSRC(2);
2257 DEFINE_CAPMIX_NOSRC(3);
2260 * ALC880 5-stack model
2262 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2264 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2265 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2268 /* additional mixers to alc880_three_stack_mixer */
2269 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2270 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2271 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2275 /* channel source setting (6/8 channel selection for 5-stack) */
2277 static struct hda_verb alc880_fivestack_ch6_init[] = {
2278 /* set line-in to input, mute it */
2279 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2280 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2285 static struct hda_verb alc880_fivestack_ch8_init[] = {
2286 /* set line-in to output, unmute it */
2287 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2288 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2292 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2293 { 6, alc880_fivestack_ch6_init },
2294 { 8, alc880_fivestack_ch8_init },
2299 * ALC880 6-stack model
2301 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2302 * Side = 0x05 (0x0f)
2303 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2304 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2307 static hda_nid_t alc880_6st_dac_nids[4] = {
2308 /* front, rear, clfe, rear_surr */
2309 0x02, 0x03, 0x04, 0x05
2312 static struct hda_input_mux alc880_6stack_capture_source = {
2316 { "Front Mic", 0x1 },
2322 /* fixed 8-channels */
2323 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2327 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2328 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2329 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2330 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2331 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2332 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2333 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2335 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2336 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2337 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2338 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2339 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2340 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2341 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2345 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2348 .name = "Channel Mode",
2349 .info = alc_ch_mode_info,
2350 .get = alc_ch_mode_get,
2351 .put = alc_ch_mode_put,
2360 * W810 has rear IO for:
2363 * Center/LFE (DAC 04)
2366 * The system also has a pair of internal speakers, and a headphone jack.
2367 * These are both connected to Line2 on the codec, hence to DAC 02.
2369 * There is a variable resistor to control the speaker or headphone
2370 * volume. This is a hardware-only device without a software API.
2372 * Plugging headphones in will disable the internal speakers. This is
2373 * implemented in hardware, not via the driver using jack sense. In
2374 * a similar fashion, plugging into the rear socket marked "front" will
2375 * disable both the speakers and headphones.
2377 * For input, there's a microphone jack, and an "audio in" jack.
2378 * These may not do anything useful with this driver yet, because I
2379 * haven't setup any initialization verbs for these yet...
2382 static hda_nid_t alc880_w810_dac_nids[3] = {
2383 /* front, rear/surround, clfe */
2387 /* fixed 6 channels */
2388 static struct hda_channel_mode alc880_w810_modes[1] = {
2392 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2393 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2394 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2395 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2396 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2397 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2398 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2399 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2400 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2401 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2402 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2410 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2411 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2415 static hda_nid_t alc880_z71v_dac_nids[1] = {
2418 #define ALC880_Z71V_HP_DAC 0x03
2420 /* fixed 2 channels */
2421 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2425 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2426 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2427 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2428 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2429 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2430 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2431 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2439 * ALC880 F1734 model
2441 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2442 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2445 static hda_nid_t alc880_f1734_dac_nids[1] = {
2448 #define ALC880_F1734_HP_DAC 0x02
2450 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2451 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2452 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2453 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2454 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2455 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2456 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2462 static struct hda_input_mux alc880_f1734_capture_source = {
2474 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2475 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2476 * Mic = 0x18, Line = 0x1a
2479 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2480 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2482 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2485 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2486 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2487 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2488 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2489 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2490 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2491 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2492 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2498 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2499 .name = "Channel Mode",
2500 .info = alc_ch_mode_info,
2501 .get = alc_ch_mode_get,
2502 .put = alc_ch_mode_put,
2508 * ALC880 ASUS W1V model
2510 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2511 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2512 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2515 /* additional mixers to alc880_asus_mixer */
2516 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2517 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2518 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2523 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2524 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2525 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2526 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2527 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2528 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2531 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2532 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2537 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2538 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2539 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2540 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2541 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2542 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2543 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2544 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2545 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2552 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2553 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2555 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2556 .name = "Channel Mode",
2557 .info = alc_ch_mode_info,
2558 .get = alc_ch_mode_get,
2559 .put = alc_ch_mode_put,
2564 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2565 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2566 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2567 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2568 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2569 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2570 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2571 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2572 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2573 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2574 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2578 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2579 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2580 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2581 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2582 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2589 * virtual master controls
2593 * slave controls for virtual master
2595 static const char *alc_slave_vols[] = {
2596 "Front Playback Volume",
2597 "Surround Playback Volume",
2598 "Center Playback Volume",
2599 "LFE Playback Volume",
2600 "Side Playback Volume",
2601 "Headphone Playback Volume",
2602 "Speaker Playback Volume",
2603 "Mono Playback Volume",
2604 "Line-Out Playback Volume",
2605 "PCM Playback Volume",
2609 static const char *alc_slave_sws[] = {
2610 "Front Playback Switch",
2611 "Surround Playback Switch",
2612 "Center Playback Switch",
2613 "LFE Playback Switch",
2614 "Side Playback Switch",
2615 "Headphone Playback Switch",
2616 "Speaker Playback Switch",
2617 "Mono Playback Switch",
2618 "IEC958 Playback Switch",
2619 "Line-Out Playback Switch",
2620 "PCM Playback Switch",
2625 * build control elements
2628 #define NID_MAPPING (-1)
2630 #define SUBDEV_SPEAKER_ (0 << 6)
2631 #define SUBDEV_HP_ (1 << 6)
2632 #define SUBDEV_LINE_ (2 << 6)
2633 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2634 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2635 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2637 static void alc_free_kctls(struct hda_codec *codec);
2639 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2640 /* additional beep mixers; the actual parameters are overwritten at build */
2641 static struct snd_kcontrol_new alc_beep_mixer[] = {
2642 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2643 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2648 static int alc_build_controls(struct hda_codec *codec)
2650 struct alc_spec *spec = codec->spec;
2651 struct snd_kcontrol *kctl = NULL;
2652 struct snd_kcontrol_new *knew;
2657 for (i = 0; i < spec->num_mixers; i++) {
2658 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2662 if (spec->cap_mixer) {
2663 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2667 if (spec->multiout.dig_out_nid) {
2668 err = snd_hda_create_spdif_out_ctls(codec,
2669 spec->multiout.dig_out_nid);
2672 if (!spec->no_analog) {
2673 err = snd_hda_create_spdif_share_sw(codec,
2677 spec->multiout.share_spdif = 1;
2680 if (spec->dig_in_nid) {
2681 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2686 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2687 /* create beep controls if needed */
2688 if (spec->beep_amp) {
2689 struct snd_kcontrol_new *knew;
2690 for (knew = alc_beep_mixer; knew->name; knew++) {
2691 struct snd_kcontrol *kctl;
2692 kctl = snd_ctl_new1(knew, codec);
2695 kctl->private_value = spec->beep_amp;
2696 err = snd_hda_ctl_add(codec, 0, kctl);
2703 /* if we have no master control, let's create it */
2704 if (!spec->no_analog &&
2705 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2706 unsigned int vmaster_tlv[4];
2707 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2708 HDA_OUTPUT, vmaster_tlv);
2709 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2710 vmaster_tlv, alc_slave_vols);
2714 if (!spec->no_analog &&
2715 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2716 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2717 NULL, alc_slave_sws);
2722 /* assign Capture Source enums to NID */
2723 if (spec->capsrc_nids || spec->adc_nids) {
2724 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2726 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2727 for (i = 0; kctl && i < kctl->count; i++) {
2728 hda_nid_t *nids = spec->capsrc_nids;
2730 nids = spec->adc_nids;
2731 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2736 if (spec->cap_mixer) {
2737 const char *kname = kctl ? kctl->id.name : NULL;
2738 for (knew = spec->cap_mixer; knew->name; knew++) {
2739 if (kname && strcmp(knew->name, kname) == 0)
2741 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2742 for (i = 0; kctl && i < kctl->count; i++) {
2743 err = snd_hda_add_nid(codec, kctl, i,
2751 /* other nid->control mapping */
2752 for (i = 0; i < spec->num_mixers; i++) {
2753 for (knew = spec->mixers[i]; knew->name; knew++) {
2754 if (knew->iface != NID_MAPPING)
2756 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2759 u = knew->subdevice;
2760 for (j = 0; j < 4; j++, u >>= 8) {
2765 case SUBDEV_SPEAKER_:
2766 nid = spec->autocfg.speaker_pins[nid];
2769 nid = spec->autocfg.line_out_pins[nid];
2772 nid = spec->autocfg.hp_pins[nid];
2777 err = snd_hda_add_nid(codec, kctl, 0, nid);
2781 u = knew->private_value;
2782 for (j = 0; j < 4; j++, u >>= 8) {
2786 err = snd_hda_add_nid(codec, kctl, 0, nid);
2793 alc_free_kctls(codec); /* no longer needed */
2800 * initialize the codec volumes, etc
2804 * generic initialization of ADC, input mixers and output mixers
2806 static struct hda_verb alc880_volume_init_verbs[] = {
2808 * Unmute ADC0-2 and set the default input to mic-in
2810 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2811 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2812 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2813 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2814 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2815 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2817 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2819 * Note: PASD motherboards uses the Line In 2 as the input for front
2822 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2823 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2824 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2825 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2826 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2832 * Set up output mixers (0x0c - 0x0f)
2834 /* set vol=0 to output mixers */
2835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2836 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2837 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2838 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2839 /* set up input amps for analog loopback */
2840 /* Amp Indices: DAC = 0, mixer = 1 */
2841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2847 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2854 * 3-stack pin configuration:
2855 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2857 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2859 * preset connection lists of input pins
2860 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2862 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2863 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2864 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2867 * Set pin mode and muting
2869 /* set front pin widgets 0x14 for output */
2870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2872 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2873 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2875 /* Mic2 (as headphone out) for HP output */
2876 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2877 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 /* Line In pin widget for input */
2879 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2880 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2881 /* Line2 (as front mic) pin widget for input and vref at 80% */
2882 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2883 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2884 /* CD pin widget for input */
2885 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2891 * 5-stack pin configuration:
2892 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2893 * line-in/side = 0x1a, f-mic = 0x1b
2895 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2897 * preset connection lists of input pins
2898 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2900 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2901 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2904 * Set pin mode and muting
2906 /* set pin widgets 0x14-0x17 for output */
2907 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2908 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2910 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2911 /* unmute pins for output (no gain on this amp) */
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2913 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2914 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2915 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2918 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2919 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2920 /* Mic2 (as headphone out) for HP output */
2921 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2922 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2923 /* Line In pin widget for input */
2924 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2926 /* Line2 (as front mic) pin widget for input and vref at 80% */
2927 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2928 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2929 /* CD pin widget for input */
2930 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2936 * W810 pin configuration:
2937 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2939 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2940 /* hphone/speaker input selector: front DAC */
2941 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2944 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2947 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2948 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2950 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2951 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2957 * Z71V pin configuration:
2958 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2960 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2961 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2962 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2966 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2967 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2968 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2969 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2975 * 6-stack pin configuration:
2976 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2977 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2979 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2980 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2987 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2988 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3005 * Uniwill pin configuration:
3006 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3009 static struct hda_verb alc880_uniwill_init_verbs[] = {
3010 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3014 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3016 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3017 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3018 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3022 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3023 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3027 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3028 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3029 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3030 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3031 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3032 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3033 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3034 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3037 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3038 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3045 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3047 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3048 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3050 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3059 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3063 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3064 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3065 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3066 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3070 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3071 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3076 static struct hda_verb alc880_beep_init_verbs[] = {
3077 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3081 /* auto-toggle front mic */
3082 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3084 unsigned int present;
3087 present = snd_hda_jack_detect(codec, 0x18);
3088 bits = present ? HDA_AMP_MUTE : 0;
3089 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3092 static void alc880_uniwill_setup(struct hda_codec *codec)
3094 struct alc_spec *spec = codec->spec;
3096 spec->autocfg.hp_pins[0] = 0x14;
3097 spec->autocfg.speaker_pins[0] = 0x15;
3098 spec->autocfg.speaker_pins[0] = 0x16;
3101 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3103 alc_automute_amp(codec);
3104 alc880_uniwill_mic_automute(codec);
3107 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3110 /* Looks like the unsol event is incompatible with the standard
3111 * definition. 4bit tag is placed at 28 bit!
3113 switch (res >> 28) {
3114 case ALC880_MIC_EVENT:
3115 alc880_uniwill_mic_automute(codec);
3118 alc_automute_amp_unsol_event(codec, res);
3123 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3125 struct alc_spec *spec = codec->spec;
3127 spec->autocfg.hp_pins[0] = 0x14;
3128 spec->autocfg.speaker_pins[0] = 0x15;
3131 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3133 unsigned int present;
3135 present = snd_hda_codec_read(codec, 0x21, 0,
3136 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3137 present &= HDA_AMP_VOLMASK;
3138 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3139 HDA_AMP_VOLMASK, present);
3140 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3141 HDA_AMP_VOLMASK, present);
3144 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3147 /* Looks like the unsol event is incompatible with the standard
3148 * definition. 4bit tag is placed at 28 bit!
3150 if ((res >> 28) == ALC880_DCVOL_EVENT)
3151 alc880_uniwill_p53_dcvol_automute(codec);
3153 alc_automute_amp_unsol_event(codec, res);
3157 * F1734 pin configuration:
3158 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3160 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3161 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3162 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3163 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3164 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3165 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3168 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3172 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3173 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3174 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3175 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3176 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3177 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3178 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3179 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3180 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3182 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3183 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3189 * ASUS pin configuration:
3190 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3192 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3193 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3194 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3195 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3196 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3199 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3201 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3202 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3203 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3204 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3205 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3207 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3209 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3210 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3211 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3212 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3214 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3215 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3220 /* Enable GPIO mask and set output */
3221 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3222 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3223 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3225 /* Clevo m520g init */
3226 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3227 /* headphone output */
3228 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3231 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3233 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3236 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3237 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3238 /* Mic1 (rear panel) */
3239 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3240 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3241 /* Mic2 (front panel) */
3242 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3245 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3246 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3247 /* change to EAPD mode */
3248 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3249 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3254 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3255 /* change to EAPD mode */
3256 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3257 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3259 /* Headphone output */
3260 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3262 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3263 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3265 /* Line In pin widget for input */
3266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3267 /* CD pin widget for input */
3268 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3269 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3272 /* change to EAPD mode */
3273 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3274 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3280 * LG m1 express dual
3283 * Rear Line-In/Out (blue): 0x14
3284 * Build-in Mic-In: 0x15
3286 * HP-Out (green): 0x1b
3287 * Mic-In/Out (red): 0x19
3291 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3292 static hda_nid_t alc880_lg_dac_nids[3] = {
3296 /* seems analog CD is not working */
3297 static struct hda_input_mux alc880_lg_capture_source = {
3302 { "Internal Mic", 0x6 },
3306 /* 2,4,6 channel modes */
3307 static struct hda_verb alc880_lg_ch2_init[] = {
3308 /* set line-in and mic-in to input */
3309 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3310 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3314 static struct hda_verb alc880_lg_ch4_init[] = {
3315 /* set line-in to out and mic-in to input */
3316 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3317 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3321 static struct hda_verb alc880_lg_ch6_init[] = {
3322 /* set line-in and mic-in to output */
3323 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3324 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3328 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3329 { 2, alc880_lg_ch2_init },
3330 { 4, alc880_lg_ch4_init },
3331 { 6, alc880_lg_ch6_init },
3334 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3335 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3336 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3337 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3338 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3339 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3340 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3341 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3342 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3344 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3345 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3346 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3347 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3348 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3350 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3351 .name = "Channel Mode",
3352 .info = alc_ch_mode_info,
3353 .get = alc_ch_mode_get,
3354 .put = alc_ch_mode_put,
3359 static struct hda_verb alc880_lg_init_verbs[] = {
3360 /* set capture source to mic-in */
3361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3362 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3364 /* mute all amp mixer inputs */
3365 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3368 /* line-in to input */
3369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3370 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3375 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3376 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3377 /* mic-in to input */
3378 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3379 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3380 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3382 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3383 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3384 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3386 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3390 /* toggle speaker-output according to the hp-jack state */
3391 static void alc880_lg_setup(struct hda_codec *codec)
3393 struct alc_spec *spec = codec->spec;
3395 spec->autocfg.hp_pins[0] = 0x1b;
3396 spec->autocfg.speaker_pins[0] = 0x17;
3405 * Built-in Mic-In: 0x19
3411 static struct hda_input_mux alc880_lg_lw_capture_source = {
3415 { "Internal Mic", 0x1 },
3420 #define alc880_lg_lw_modes alc880_threestack_modes
3422 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3424 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3425 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3426 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3427 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3428 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3429 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3430 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3435 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3436 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3439 .name = "Channel Mode",
3440 .info = alc_ch_mode_info,
3441 .get = alc_ch_mode_get,
3442 .put = alc_ch_mode_put,
3447 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3448 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3449 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3450 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3452 /* set capture source to mic-in */
3453 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3454 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3455 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3462 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3463 /* mic-in to input */
3464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3467 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3468 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3470 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3474 /* toggle speaker-output according to the hp-jack state */
3475 static void alc880_lg_lw_setup(struct hda_codec *codec)
3477 struct alc_spec *spec = codec->spec;
3479 spec->autocfg.hp_pins[0] = 0x1b;
3480 spec->autocfg.speaker_pins[0] = 0x14;
3483 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3484 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3485 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3486 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3487 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3488 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3489 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3493 static struct hda_input_mux alc880_medion_rim_capture_source = {
3497 { "Internal Mic", 0x1 },
3501 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3502 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3504 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3507 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3508 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3509 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3510 /* Mic2 (as headphone out) for HP output */
3511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3513 /* Internal Speaker */
3514 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3515 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3517 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3518 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3520 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3524 /* toggle speaker-output according to the hp-jack state */
3525 static void alc880_medion_rim_automute(struct hda_codec *codec)
3527 struct alc_spec *spec = codec->spec;
3528 alc_automute_amp(codec);
3530 if (spec->jack_present)
3531 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3533 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3536 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3539 /* Looks like the unsol event is incompatible with the standard
3540 * definition. 4bit tag is placed at 28 bit!
3542 if ((res >> 28) == ALC880_HP_EVENT)
3543 alc880_medion_rim_automute(codec);
3546 static void alc880_medion_rim_setup(struct hda_codec *codec)
3548 struct alc_spec *spec = codec->spec;
3550 spec->autocfg.hp_pins[0] = 0x14;
3551 spec->autocfg.speaker_pins[0] = 0x1b;
3554 #ifdef CONFIG_SND_HDA_POWER_SAVE
3555 static struct hda_amp_list alc880_loopbacks[] = {
3556 { 0x0b, HDA_INPUT, 0 },
3557 { 0x0b, HDA_INPUT, 1 },
3558 { 0x0b, HDA_INPUT, 2 },
3559 { 0x0b, HDA_INPUT, 3 },
3560 { 0x0b, HDA_INPUT, 4 },
3564 static struct hda_amp_list alc880_lg_loopbacks[] = {
3565 { 0x0b, HDA_INPUT, 1 },
3566 { 0x0b, HDA_INPUT, 6 },
3567 { 0x0b, HDA_INPUT, 7 },
3576 static int alc_init(struct hda_codec *codec)
3578 struct alc_spec *spec = codec->spec;
3582 alc_auto_init_amp(codec, spec->init_amp);
3584 for (i = 0; i < spec->num_init_verbs; i++)
3585 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3587 if (spec->init_hook)
3588 spec->init_hook(codec);
3590 #ifdef CONFIG_SND_HDA_POWER_SAVE
3591 if (codec->patch_ops.check_power_status)
3592 codec->patch_ops.check_power_status(codec, 0x01);
3597 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3599 struct alc_spec *spec = codec->spec;
3601 if (spec->unsol_event)
3602 spec->unsol_event(codec, res);
3605 #ifdef CONFIG_SND_HDA_POWER_SAVE
3606 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3608 struct alc_spec *spec = codec->spec;
3609 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3614 * Analog playback callbacks
3616 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3617 struct hda_codec *codec,
3618 struct snd_pcm_substream *substream)
3620 struct alc_spec *spec = codec->spec;
3621 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3625 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3626 struct hda_codec *codec,
3627 unsigned int stream_tag,
3628 unsigned int format,
3629 struct snd_pcm_substream *substream)
3631 struct alc_spec *spec = codec->spec;
3632 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3633 stream_tag, format, substream);
3636 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3637 struct hda_codec *codec,
3638 struct snd_pcm_substream *substream)
3640 struct alc_spec *spec = codec->spec;
3641 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3647 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3648 struct hda_codec *codec,
3649 struct snd_pcm_substream *substream)
3651 struct alc_spec *spec = codec->spec;
3652 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3655 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3656 struct hda_codec *codec,
3657 unsigned int stream_tag,
3658 unsigned int format,
3659 struct snd_pcm_substream *substream)
3661 struct alc_spec *spec = codec->spec;
3662 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3663 stream_tag, format, substream);
3666 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3667 struct hda_codec *codec,
3668 struct snd_pcm_substream *substream)
3670 struct alc_spec *spec = codec->spec;
3671 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3674 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3675 struct hda_codec *codec,
3676 struct snd_pcm_substream *substream)
3678 struct alc_spec *spec = codec->spec;
3679 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3685 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3686 struct hda_codec *codec,
3687 unsigned int stream_tag,
3688 unsigned int format,
3689 struct snd_pcm_substream *substream)
3691 struct alc_spec *spec = codec->spec;
3693 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3694 stream_tag, 0, format);
3698 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3699 struct hda_codec *codec,
3700 struct snd_pcm_substream *substream)
3702 struct alc_spec *spec = codec->spec;
3704 snd_hda_codec_cleanup_stream(codec,
3705 spec->adc_nids[substream->number + 1]);
3709 /* analog capture with dynamic dual-adc changes */
3710 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3711 struct hda_codec *codec,
3712 unsigned int stream_tag,
3713 unsigned int format,
3714 struct snd_pcm_substream *substream)
3716 struct alc_spec *spec = codec->spec;
3717 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3718 spec->cur_adc_stream_tag = stream_tag;
3719 spec->cur_adc_format = format;
3720 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3724 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3725 struct hda_codec *codec,
3726 struct snd_pcm_substream *substream)
3728 struct alc_spec *spec = codec->spec;
3729 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3734 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3738 .nid = 0, /* fill later */
3740 .prepare = dualmic_capture_pcm_prepare,
3741 .cleanup = dualmic_capture_pcm_cleanup
3747 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3751 /* NID is set in alc_build_pcms */
3753 .open = alc880_playback_pcm_open,
3754 .prepare = alc880_playback_pcm_prepare,
3755 .cleanup = alc880_playback_pcm_cleanup
3759 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3763 /* NID is set in alc_build_pcms */
3766 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3770 /* NID is set in alc_build_pcms */
3773 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3774 .substreams = 2, /* can be overridden */
3777 /* NID is set in alc_build_pcms */
3779 .prepare = alc880_alt_capture_pcm_prepare,
3780 .cleanup = alc880_alt_capture_pcm_cleanup
3784 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3788 /* NID is set in alc_build_pcms */
3790 .open = alc880_dig_playback_pcm_open,
3791 .close = alc880_dig_playback_pcm_close,
3792 .prepare = alc880_dig_playback_pcm_prepare,
3793 .cleanup = alc880_dig_playback_pcm_cleanup
3797 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3801 /* NID is set in alc_build_pcms */
3804 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3805 static struct hda_pcm_stream alc_pcm_null_stream = {
3811 static int alc_build_pcms(struct hda_codec *codec)
3813 struct alc_spec *spec = codec->spec;
3814 struct hda_pcm *info = spec->pcm_rec;
3817 codec->num_pcms = 1;
3818 codec->pcm_info = info;
3820 if (spec->no_analog)
3823 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3824 "%s Analog", codec->chip_name);
3825 info->name = spec->stream_name_analog;
3827 if (spec->stream_analog_playback) {
3828 if (snd_BUG_ON(!spec->multiout.dac_nids))
3830 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3831 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3833 if (spec->stream_analog_capture) {
3834 if (snd_BUG_ON(!spec->adc_nids))
3836 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3837 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3840 if (spec->channel_mode) {
3841 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3842 for (i = 0; i < spec->num_channel_mode; i++) {
3843 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3844 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3850 /* SPDIF for stream index #1 */
3851 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3852 snprintf(spec->stream_name_digital,
3853 sizeof(spec->stream_name_digital),
3854 "%s Digital", codec->chip_name);
3855 codec->num_pcms = 2;
3856 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3857 info = spec->pcm_rec + 1;
3858 info->name = spec->stream_name_digital;
3859 if (spec->dig_out_type)
3860 info->pcm_type = spec->dig_out_type;
3862 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3863 if (spec->multiout.dig_out_nid &&
3864 spec->stream_digital_playback) {
3865 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3866 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3868 if (spec->dig_in_nid &&
3869 spec->stream_digital_capture) {
3870 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3871 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3873 /* FIXME: do we need this for all Realtek codec models? */
3874 codec->spdif_status_reset = 1;
3877 if (spec->no_analog)
3880 /* If the use of more than one ADC is requested for the current
3881 * model, configure a second analog capture-only PCM.
3883 /* Additional Analaog capture for index #2 */
3884 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3885 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3886 codec->num_pcms = 3;
3887 info = spec->pcm_rec + 2;
3888 info->name = spec->stream_name_analog;
3889 if (spec->alt_dac_nid) {
3890 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3891 *spec->stream_analog_alt_playback;
3892 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3895 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3896 alc_pcm_null_stream;
3897 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3899 if (spec->num_adc_nids > 1) {
3900 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3901 *spec->stream_analog_alt_capture;
3902 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3904 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3905 spec->num_adc_nids - 1;
3907 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3908 alc_pcm_null_stream;
3909 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3916 static inline void alc_shutup(struct hda_codec *codec)
3918 snd_hda_shutup_pins(codec);
3921 static void alc_free_kctls(struct hda_codec *codec)
3923 struct alc_spec *spec = codec->spec;
3925 if (spec->kctls.list) {
3926 struct snd_kcontrol_new *kctl = spec->kctls.list;
3928 for (i = 0; i < spec->kctls.used; i++)
3929 kfree(kctl[i].name);
3931 snd_array_free(&spec->kctls);
3934 static void alc_free(struct hda_codec *codec)
3936 struct alc_spec *spec = codec->spec;
3942 alc_free_kctls(codec);
3944 snd_hda_detach_beep_device(codec);
3947 #ifdef CONFIG_SND_HDA_POWER_SAVE
3948 static void alc_power_eapd(struct hda_codec *codec)
3950 /* We currently only handle front, HP */
3951 switch (codec->vendor_id) {
3953 set_eapd(codec, 0x0f, 0);
3954 set_eapd(codec, 0x10, 0);
3967 set_eapd(codec, 0x14, 0);
3968 set_eapd(codec, 0x15, 0);
3973 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3975 struct alc_spec *spec = codec->spec;
3977 if (spec && spec->power_hook)
3978 spec->power_hook(codec);
3983 #ifdef SND_HDA_NEEDS_RESUME
3984 static int alc_resume(struct hda_codec *codec)
3986 codec->patch_ops.init(codec);
3987 snd_hda_codec_resume_amp(codec);
3988 snd_hda_codec_resume_cache(codec);
3989 #ifdef CONFIG_SND_HDA_POWER_SAVE
3990 if (codec->patch_ops.check_power_status)
3991 codec->patch_ops.check_power_status(codec, 0x01);
3999 static struct hda_codec_ops alc_patch_ops = {
4000 .build_controls = alc_build_controls,
4001 .build_pcms = alc_build_pcms,
4004 .unsol_event = alc_unsol_event,
4005 #ifdef SND_HDA_NEEDS_RESUME
4006 .resume = alc_resume,
4008 #ifdef CONFIG_SND_HDA_POWER_SAVE
4009 .suspend = alc_suspend,
4010 .check_power_status = alc_check_power_status,
4012 .reboot_notify = alc_shutup,
4015 /* replace the codec chip_name with the given string */
4016 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4018 kfree(codec->chip_name);
4019 codec->chip_name = kstrdup(name, GFP_KERNEL);
4020 if (!codec->chip_name) {
4028 * Test configuration for debugging
4030 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4033 #ifdef CONFIG_SND_DEBUG
4034 static hda_nid_t alc880_test_dac_nids[4] = {
4035 0x02, 0x03, 0x04, 0x05
4038 static struct hda_input_mux alc880_test_capture_source = {
4047 { "Surround", 0x6 },
4051 static struct hda_channel_mode alc880_test_modes[4] = {
4058 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4059 struct snd_ctl_elem_info *uinfo)
4061 static char *texts[] = {
4062 "N/A", "Line Out", "HP Out",
4063 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4065 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4067 uinfo->value.enumerated.items = 8;
4068 if (uinfo->value.enumerated.item >= 8)
4069 uinfo->value.enumerated.item = 7;
4070 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4074 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4075 struct snd_ctl_elem_value *ucontrol)
4077 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4078 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4079 unsigned int pin_ctl, item = 0;
4081 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4082 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4083 if (pin_ctl & AC_PINCTL_OUT_EN) {
4084 if (pin_ctl & AC_PINCTL_HP_EN)
4088 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4089 switch (pin_ctl & AC_PINCTL_VREFEN) {
4090 case AC_PINCTL_VREF_HIZ: item = 3; break;
4091 case AC_PINCTL_VREF_50: item = 4; break;
4092 case AC_PINCTL_VREF_GRD: item = 5; break;
4093 case AC_PINCTL_VREF_80: item = 6; break;
4094 case AC_PINCTL_VREF_100: item = 7; break;
4097 ucontrol->value.enumerated.item[0] = item;
4101 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4102 struct snd_ctl_elem_value *ucontrol)
4104 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4105 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4106 static unsigned int ctls[] = {
4107 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4108 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4109 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4110 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4111 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4112 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4114 unsigned int old_ctl, new_ctl;
4116 old_ctl = snd_hda_codec_read(codec, nid, 0,
4117 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4118 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4119 if (old_ctl != new_ctl) {
4121 snd_hda_codec_write_cache(codec, nid, 0,
4122 AC_VERB_SET_PIN_WIDGET_CONTROL,
4124 val = ucontrol->value.enumerated.item[0] >= 3 ?
4126 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4133 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4134 struct snd_ctl_elem_info *uinfo)
4136 static char *texts[] = {
4137 "Front", "Surround", "CLFE", "Side"
4139 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4141 uinfo->value.enumerated.items = 4;
4142 if (uinfo->value.enumerated.item >= 4)
4143 uinfo->value.enumerated.item = 3;
4144 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4148 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4149 struct snd_ctl_elem_value *ucontrol)
4151 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4152 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4155 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4156 ucontrol->value.enumerated.item[0] = sel & 3;
4160 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4161 struct snd_ctl_elem_value *ucontrol)
4163 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4164 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4167 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4168 if (ucontrol->value.enumerated.item[0] != sel) {
4169 sel = ucontrol->value.enumerated.item[0] & 3;
4170 snd_hda_codec_write_cache(codec, nid, 0,
4171 AC_VERB_SET_CONNECT_SEL, sel);
4177 #define PIN_CTL_TEST(xname,nid) { \
4178 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4180 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4181 .info = alc_test_pin_ctl_info, \
4182 .get = alc_test_pin_ctl_get, \
4183 .put = alc_test_pin_ctl_put, \
4184 .private_value = nid \
4187 #define PIN_SRC_TEST(xname,nid) { \
4188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4190 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4191 .info = alc_test_pin_src_info, \
4192 .get = alc_test_pin_src_get, \
4193 .put = alc_test_pin_src_put, \
4194 .private_value = nid \
4197 static struct snd_kcontrol_new alc880_test_mixer[] = {
4198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4199 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4200 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4201 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4203 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4204 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4205 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4206 PIN_CTL_TEST("Front Pin Mode", 0x14),
4207 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4208 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4209 PIN_CTL_TEST("Side Pin Mode", 0x17),
4210 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4211 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4212 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4213 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4214 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4215 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4216 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4217 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4218 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4219 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4220 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4221 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4222 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4223 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4224 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4225 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4230 .name = "Channel Mode",
4231 .info = alc_ch_mode_info,
4232 .get = alc_ch_mode_get,
4233 .put = alc_ch_mode_put,
4238 static struct hda_verb alc880_test_init_verbs[] = {
4239 /* Unmute inputs of 0x0c - 0x0f */
4240 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4242 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4246 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4247 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4248 /* Vol output for 0x0c-0x0f */
4249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4251 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4252 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4253 /* Set output pins 0x14-0x17 */
4254 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4256 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4257 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4258 /* Unmute output pins 0x14-0x17 */
4259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4262 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4263 /* Set input pins 0x18-0x1c */
4264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4265 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4267 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4268 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4269 /* Mute input pins 0x18-0x1b */
4270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4271 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4272 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4273 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4276 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4277 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4278 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4279 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4280 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4281 /* Analog input/passthru */
4282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4294 static const char *alc880_models[ALC880_MODEL_LAST] = {
4295 [ALC880_3ST] = "3stack",
4296 [ALC880_TCL_S700] = "tcl",
4297 [ALC880_3ST_DIG] = "3stack-digout",
4298 [ALC880_CLEVO] = "clevo",
4299 [ALC880_5ST] = "5stack",
4300 [ALC880_5ST_DIG] = "5stack-digout",
4301 [ALC880_W810] = "w810",
4302 [ALC880_Z71V] = "z71v",
4303 [ALC880_6ST] = "6stack",
4304 [ALC880_6ST_DIG] = "6stack-digout",
4305 [ALC880_ASUS] = "asus",
4306 [ALC880_ASUS_W1V] = "asus-w1v",
4307 [ALC880_ASUS_DIG] = "asus-dig",
4308 [ALC880_ASUS_DIG2] = "asus-dig2",
4309 [ALC880_UNIWILL_DIG] = "uniwill",
4310 [ALC880_UNIWILL_P53] = "uniwill-p53",
4311 [ALC880_FUJITSU] = "fujitsu",
4312 [ALC880_F1734] = "F1734",
4314 [ALC880_LG_LW] = "lg-lw",
4315 [ALC880_MEDION_RIM] = "medion",
4316 #ifdef CONFIG_SND_DEBUG
4317 [ALC880_TEST] = "test",
4319 [ALC880_AUTO] = "auto",
4322 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4323 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4324 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4325 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4326 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4327 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4328 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4329 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4330 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4331 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4332 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4333 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4334 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4335 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4336 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4337 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4338 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4339 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4340 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4341 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4342 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4343 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4344 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4345 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4346 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4347 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4348 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4349 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4350 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4351 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4352 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4353 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4354 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4355 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4356 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4357 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4358 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4359 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4360 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4361 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4362 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4363 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4364 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4365 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4366 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4367 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4368 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4369 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4370 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4371 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4372 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4373 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4374 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4375 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4376 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4377 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4378 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4379 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4380 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4381 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4382 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4383 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4384 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4385 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4386 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4387 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4388 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4389 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4390 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4392 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4393 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4394 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4399 * ALC880 codec presets
4401 static struct alc_config_preset alc880_presets[] = {
4403 .mixers = { alc880_three_stack_mixer },
4404 .init_verbs = { alc880_volume_init_verbs,
4405 alc880_pin_3stack_init_verbs },
4406 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4407 .dac_nids = alc880_dac_nids,
4408 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4409 .channel_mode = alc880_threestack_modes,
4411 .input_mux = &alc880_capture_source,
4413 [ALC880_3ST_DIG] = {
4414 .mixers = { alc880_three_stack_mixer },
4415 .init_verbs = { alc880_volume_init_verbs,
4416 alc880_pin_3stack_init_verbs },
4417 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4418 .dac_nids = alc880_dac_nids,
4419 .dig_out_nid = ALC880_DIGOUT_NID,
4420 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4421 .channel_mode = alc880_threestack_modes,
4423 .input_mux = &alc880_capture_source,
4425 [ALC880_TCL_S700] = {
4426 .mixers = { alc880_tcl_s700_mixer },
4427 .init_verbs = { alc880_volume_init_verbs,
4428 alc880_pin_tcl_S700_init_verbs,
4429 alc880_gpio2_init_verbs },
4430 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4431 .dac_nids = alc880_dac_nids,
4432 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4433 .num_adc_nids = 1, /* single ADC */
4435 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4436 .channel_mode = alc880_2_jack_modes,
4437 .input_mux = &alc880_capture_source,
4440 .mixers = { alc880_three_stack_mixer,
4441 alc880_five_stack_mixer},
4442 .init_verbs = { alc880_volume_init_verbs,
4443 alc880_pin_5stack_init_verbs },
4444 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4445 .dac_nids = alc880_dac_nids,
4446 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4447 .channel_mode = alc880_fivestack_modes,
4448 .input_mux = &alc880_capture_source,
4450 [ALC880_5ST_DIG] = {
4451 .mixers = { alc880_three_stack_mixer,
4452 alc880_five_stack_mixer },
4453 .init_verbs = { alc880_volume_init_verbs,
4454 alc880_pin_5stack_init_verbs },
4455 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4456 .dac_nids = alc880_dac_nids,
4457 .dig_out_nid = ALC880_DIGOUT_NID,
4458 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4459 .channel_mode = alc880_fivestack_modes,
4460 .input_mux = &alc880_capture_source,
4463 .mixers = { alc880_six_stack_mixer },
4464 .init_verbs = { alc880_volume_init_verbs,
4465 alc880_pin_6stack_init_verbs },
4466 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4467 .dac_nids = alc880_6st_dac_nids,
4468 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4469 .channel_mode = alc880_sixstack_modes,
4470 .input_mux = &alc880_6stack_capture_source,
4472 [ALC880_6ST_DIG] = {
4473 .mixers = { alc880_six_stack_mixer },
4474 .init_verbs = { alc880_volume_init_verbs,
4475 alc880_pin_6stack_init_verbs },
4476 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4477 .dac_nids = alc880_6st_dac_nids,
4478 .dig_out_nid = ALC880_DIGOUT_NID,
4479 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4480 .channel_mode = alc880_sixstack_modes,
4481 .input_mux = &alc880_6stack_capture_source,
4484 .mixers = { alc880_w810_base_mixer },
4485 .init_verbs = { alc880_volume_init_verbs,
4486 alc880_pin_w810_init_verbs,
4487 alc880_gpio2_init_verbs },
4488 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4489 .dac_nids = alc880_w810_dac_nids,
4490 .dig_out_nid = ALC880_DIGOUT_NID,
4491 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4492 .channel_mode = alc880_w810_modes,
4493 .input_mux = &alc880_capture_source,
4496 .mixers = { alc880_z71v_mixer },
4497 .init_verbs = { alc880_volume_init_verbs,
4498 alc880_pin_z71v_init_verbs },
4499 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4500 .dac_nids = alc880_z71v_dac_nids,
4501 .dig_out_nid = ALC880_DIGOUT_NID,
4503 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4504 .channel_mode = alc880_2_jack_modes,
4505 .input_mux = &alc880_capture_source,
4508 .mixers = { alc880_f1734_mixer },
4509 .init_verbs = { alc880_volume_init_verbs,
4510 alc880_pin_f1734_init_verbs },
4511 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4512 .dac_nids = alc880_f1734_dac_nids,
4514 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4515 .channel_mode = alc880_2_jack_modes,
4516 .input_mux = &alc880_f1734_capture_source,
4517 .unsol_event = alc880_uniwill_p53_unsol_event,
4518 .setup = alc880_uniwill_p53_setup,
4519 .init_hook = alc_automute_amp,
4522 .mixers = { alc880_asus_mixer },
4523 .init_verbs = { alc880_volume_init_verbs,
4524 alc880_pin_asus_init_verbs,
4525 alc880_gpio1_init_verbs },
4526 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4527 .dac_nids = alc880_asus_dac_nids,
4528 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4529 .channel_mode = alc880_asus_modes,
4531 .input_mux = &alc880_capture_source,
4533 [ALC880_ASUS_DIG] = {
4534 .mixers = { alc880_asus_mixer },
4535 .init_verbs = { alc880_volume_init_verbs,
4536 alc880_pin_asus_init_verbs,
4537 alc880_gpio1_init_verbs },
4538 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4539 .dac_nids = alc880_asus_dac_nids,
4540 .dig_out_nid = ALC880_DIGOUT_NID,
4541 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4542 .channel_mode = alc880_asus_modes,
4544 .input_mux = &alc880_capture_source,
4546 [ALC880_ASUS_DIG2] = {
4547 .mixers = { alc880_asus_mixer },
4548 .init_verbs = { alc880_volume_init_verbs,
4549 alc880_pin_asus_init_verbs,
4550 alc880_gpio2_init_verbs }, /* use GPIO2 */
4551 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4552 .dac_nids = alc880_asus_dac_nids,
4553 .dig_out_nid = ALC880_DIGOUT_NID,
4554 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4555 .channel_mode = alc880_asus_modes,
4557 .input_mux = &alc880_capture_source,
4559 [ALC880_ASUS_W1V] = {
4560 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4561 .init_verbs = { alc880_volume_init_verbs,
4562 alc880_pin_asus_init_verbs,
4563 alc880_gpio1_init_verbs },
4564 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4565 .dac_nids = alc880_asus_dac_nids,
4566 .dig_out_nid = ALC880_DIGOUT_NID,
4567 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4568 .channel_mode = alc880_asus_modes,
4570 .input_mux = &alc880_capture_source,
4572 [ALC880_UNIWILL_DIG] = {
4573 .mixers = { alc880_asus_mixer },
4574 .init_verbs = { alc880_volume_init_verbs,
4575 alc880_pin_asus_init_verbs },
4576 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4577 .dac_nids = alc880_asus_dac_nids,
4578 .dig_out_nid = ALC880_DIGOUT_NID,
4579 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4580 .channel_mode = alc880_asus_modes,
4582 .input_mux = &alc880_capture_source,
4584 [ALC880_UNIWILL] = {
4585 .mixers = { alc880_uniwill_mixer },
4586 .init_verbs = { alc880_volume_init_verbs,
4587 alc880_uniwill_init_verbs },
4588 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4589 .dac_nids = alc880_asus_dac_nids,
4590 .dig_out_nid = ALC880_DIGOUT_NID,
4591 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4592 .channel_mode = alc880_threestack_modes,
4594 .input_mux = &alc880_capture_source,
4595 .unsol_event = alc880_uniwill_unsol_event,
4596 .setup = alc880_uniwill_setup,
4597 .init_hook = alc880_uniwill_init_hook,
4599 [ALC880_UNIWILL_P53] = {
4600 .mixers = { alc880_uniwill_p53_mixer },
4601 .init_verbs = { alc880_volume_init_verbs,
4602 alc880_uniwill_p53_init_verbs },
4603 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4604 .dac_nids = alc880_asus_dac_nids,
4605 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4606 .channel_mode = alc880_threestack_modes,
4607 .input_mux = &alc880_capture_source,
4608 .unsol_event = alc880_uniwill_p53_unsol_event,
4609 .setup = alc880_uniwill_p53_setup,
4610 .init_hook = alc_automute_amp,
4612 [ALC880_FUJITSU] = {
4613 .mixers = { alc880_fujitsu_mixer },
4614 .init_verbs = { alc880_volume_init_verbs,
4615 alc880_uniwill_p53_init_verbs,
4616 alc880_beep_init_verbs },
4617 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4618 .dac_nids = alc880_dac_nids,
4619 .dig_out_nid = ALC880_DIGOUT_NID,
4620 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4621 .channel_mode = alc880_2_jack_modes,
4622 .input_mux = &alc880_capture_source,
4623 .unsol_event = alc880_uniwill_p53_unsol_event,
4624 .setup = alc880_uniwill_p53_setup,
4625 .init_hook = alc_automute_amp,
4628 .mixers = { alc880_three_stack_mixer },
4629 .init_verbs = { alc880_volume_init_verbs,
4630 alc880_pin_clevo_init_verbs },
4631 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4632 .dac_nids = alc880_dac_nids,
4634 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4635 .channel_mode = alc880_threestack_modes,
4637 .input_mux = &alc880_capture_source,
4640 .mixers = { alc880_lg_mixer },
4641 .init_verbs = { alc880_volume_init_verbs,
4642 alc880_lg_init_verbs },
4643 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4644 .dac_nids = alc880_lg_dac_nids,
4645 .dig_out_nid = ALC880_DIGOUT_NID,
4646 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4647 .channel_mode = alc880_lg_ch_modes,
4649 .input_mux = &alc880_lg_capture_source,
4650 .unsol_event = alc_automute_amp_unsol_event,
4651 .setup = alc880_lg_setup,
4652 .init_hook = alc_automute_amp,
4653 #ifdef CONFIG_SND_HDA_POWER_SAVE
4654 .loopbacks = alc880_lg_loopbacks,
4658 .mixers = { alc880_lg_lw_mixer },
4659 .init_verbs = { alc880_volume_init_verbs,
4660 alc880_lg_lw_init_verbs },
4661 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4662 .dac_nids = alc880_dac_nids,
4663 .dig_out_nid = ALC880_DIGOUT_NID,
4664 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4665 .channel_mode = alc880_lg_lw_modes,
4666 .input_mux = &alc880_lg_lw_capture_source,
4667 .unsol_event = alc_automute_amp_unsol_event,
4668 .setup = alc880_lg_lw_setup,
4669 .init_hook = alc_automute_amp,
4671 [ALC880_MEDION_RIM] = {
4672 .mixers = { alc880_medion_rim_mixer },
4673 .init_verbs = { alc880_volume_init_verbs,
4674 alc880_medion_rim_init_verbs,
4675 alc_gpio2_init_verbs },
4676 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4677 .dac_nids = alc880_dac_nids,
4678 .dig_out_nid = ALC880_DIGOUT_NID,
4679 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4680 .channel_mode = alc880_2_jack_modes,
4681 .input_mux = &alc880_medion_rim_capture_source,
4682 .unsol_event = alc880_medion_rim_unsol_event,
4683 .setup = alc880_medion_rim_setup,
4684 .init_hook = alc880_medion_rim_automute,
4686 #ifdef CONFIG_SND_DEBUG
4688 .mixers = { alc880_test_mixer },
4689 .init_verbs = { alc880_test_init_verbs },
4690 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4691 .dac_nids = alc880_test_dac_nids,
4692 .dig_out_nid = ALC880_DIGOUT_NID,
4693 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4694 .channel_mode = alc880_test_modes,
4695 .input_mux = &alc880_test_capture_source,
4701 * Automatic parse of I/O pins from the BIOS configuration
4706 ALC_CTL_WIDGET_MUTE,
4709 static struct snd_kcontrol_new alc880_control_templates[] = {
4710 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4711 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4712 HDA_BIND_MUTE(NULL, 0, 0, 0),
4715 /* add dynamic controls */
4716 static int add_control(struct alc_spec *spec, int type, const char *name,
4719 struct snd_kcontrol_new *knew;
4721 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4722 knew = snd_array_new(&spec->kctls);
4725 *knew = alc880_control_templates[type];
4726 knew->name = kstrdup(name, GFP_KERNEL);
4729 if (get_amp_nid_(val))
4730 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4731 knew->private_value = val;
4735 static int add_control_with_pfx(struct alc_spec *spec, int type,
4736 const char *pfx, const char *dir,
4737 const char *sfx, unsigned long val)
4740 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4741 return add_control(spec, type, name, val);
4744 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4745 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4746 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4747 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4749 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4750 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4751 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4752 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4753 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4754 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4755 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4756 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4757 #define ALC880_PIN_CD_NID 0x1c
4759 /* fill in the dac_nids table from the parsed pin configuration */
4760 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4761 const struct auto_pin_cfg *cfg)
4767 memset(assigned, 0, sizeof(assigned));
4768 spec->multiout.dac_nids = spec->private_dac_nids;
4770 /* check the pins hardwired to audio widget */
4771 for (i = 0; i < cfg->line_outs; i++) {
4772 nid = cfg->line_out_pins[i];
4773 if (alc880_is_fixed_pin(nid)) {
4774 int idx = alc880_fixed_pin_idx(nid);
4775 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4779 /* left pins can be connect to any audio widget */
4780 for (i = 0; i < cfg->line_outs; i++) {
4781 nid = cfg->line_out_pins[i];
4782 if (alc880_is_fixed_pin(nid))
4784 /* search for an empty channel */
4785 for (j = 0; j < cfg->line_outs; j++) {
4787 spec->multiout.dac_nids[i] =
4788 alc880_idx_to_dac(j);
4794 spec->multiout.num_dacs = cfg->line_outs;
4798 /* add playback controls from the parsed DAC table */
4799 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4800 const struct auto_pin_cfg *cfg)
4802 static const char *chname[4] = {
4803 "Front", "Surround", NULL /*CLFE*/, "Side"
4808 for (i = 0; i < cfg->line_outs; i++) {
4809 if (!spec->multiout.dac_nids[i])
4811 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4814 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4816 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4820 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4822 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4826 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4828 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4832 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4834 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4840 if (cfg->line_outs == 1 &&
4841 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4845 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4846 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4850 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4851 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4860 /* add playback controls for speaker and HP outputs */
4861 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4870 if (alc880_is_fixed_pin(pin)) {
4871 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4872 /* specify the DAC as the extra output */
4873 if (!spec->multiout.hp_nid)
4874 spec->multiout.hp_nid = nid;
4876 spec->multiout.extra_out_nid[0] = nid;
4877 /* control HP volume/switch on the output mixer amp */
4878 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4879 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4880 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4883 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4884 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4887 } else if (alc880_is_multi_pin(pin)) {
4888 /* set manual connection */
4889 /* we have only a switch on HP-out PIN */
4890 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4891 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4898 /* create input playback/capture controls for the given pin */
4899 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4900 const char *ctlname,
4901 int idx, hda_nid_t mix_nid)
4905 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4906 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4909 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4910 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4916 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4918 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4919 return (pincap & AC_PINCAP_IN) != 0;
4922 /* create playback/capture controls for input pins */
4923 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4924 const struct auto_pin_cfg *cfg,
4926 hda_nid_t cap1, hda_nid_t cap2)
4928 struct alc_spec *spec = codec->spec;
4929 struct hda_input_mux *imux = &spec->private_imux[0];
4932 for (i = 0; i < AUTO_PIN_LAST; i++) {
4935 pin = cfg->input_pins[i];
4936 if (!alc_is_input_pin(codec, pin))
4940 idx = get_connection_index(codec, mixer, pin);
4942 err = new_analog_input(spec, pin,
4943 auto_pin_cfg_labels[i],
4952 idx = get_connection_index(codec, cap1, pin);
4953 if (idx < 0 && cap2)
4954 idx = get_connection_index(codec, cap2, pin);
4956 imux->items[imux->num_items].label =
4957 auto_pin_cfg_labels[i];
4958 imux->items[imux->num_items].index = idx;
4965 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4966 const struct auto_pin_cfg *cfg)
4968 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4971 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4972 unsigned int pin_type)
4974 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4977 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4981 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4982 hda_nid_t nid, int pin_type,
4985 alc_set_pin_output(codec, nid, pin_type);
4986 /* need the manual connection? */
4987 if (alc880_is_multi_pin(nid)) {
4988 struct alc_spec *spec = codec->spec;
4989 int idx = alc880_multi_pin_idx(nid);
4990 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4991 AC_VERB_SET_CONNECT_SEL,
4992 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4996 static int get_pin_type(int line_out_type)
4998 if (line_out_type == AUTO_PIN_HP_OUT)
5004 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5006 struct alc_spec *spec = codec->spec;
5009 for (i = 0; i < spec->autocfg.line_outs; i++) {
5010 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5011 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5012 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5016 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5018 struct alc_spec *spec = codec->spec;
5021 pin = spec->autocfg.speaker_pins[0];
5022 if (pin) /* connect to front */
5023 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5024 pin = spec->autocfg.hp_pins[0];
5025 if (pin) /* connect to front */
5026 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5029 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5031 struct alc_spec *spec = codec->spec;
5034 for (i = 0; i < AUTO_PIN_LAST; i++) {
5035 hda_nid_t nid = spec->autocfg.input_pins[i];
5036 if (alc_is_input_pin(codec, nid)) {
5037 alc_set_input_pin(codec, nid, i);
5038 if (nid != ALC880_PIN_CD_NID &&
5039 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5040 snd_hda_codec_write(codec, nid, 0,
5041 AC_VERB_SET_AMP_GAIN_MUTE,
5047 static void alc880_auto_init_input_src(struct hda_codec *codec)
5049 struct alc_spec *spec = codec->spec;
5052 for (c = 0; c < spec->num_adc_nids; c++) {
5053 unsigned int mux_idx;
5054 const struct hda_input_mux *imux;
5055 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5056 imux = &spec->input_mux[mux_idx];
5057 if (!imux->num_items && mux_idx > 0)
5058 imux = &spec->input_mux[0];
5060 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5061 AC_VERB_SET_CONNECT_SEL,
5062 imux->items[0].index);
5066 /* parse the BIOS configuration and set up the alc_spec */
5067 /* return 1 if successful, 0 if the proper config is not found,
5068 * or a negative error code
5070 static int alc880_parse_auto_config(struct hda_codec *codec)
5072 struct alc_spec *spec = codec->spec;
5074 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5076 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5080 if (!spec->autocfg.line_outs)
5081 return 0; /* can't find valid BIOS pin config */
5083 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5086 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5089 err = alc880_auto_create_extra_out(spec,
5090 spec->autocfg.speaker_pins[0],
5094 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5098 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5102 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5104 alc_auto_parse_digital(codec);
5106 if (spec->kctls.list)
5107 add_mixer(spec, spec->kctls.list);
5109 add_verb(spec, alc880_volume_init_verbs);
5111 spec->num_mux_defs = 1;
5112 spec->input_mux = &spec->private_imux[0];
5114 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5119 /* additional initialization for auto-configuration model */
5120 static void alc880_auto_init(struct hda_codec *codec)
5122 struct alc_spec *spec = codec->spec;
5123 alc880_auto_init_multi_out(codec);
5124 alc880_auto_init_extra_out(codec);
5125 alc880_auto_init_analog_input(codec);
5126 alc880_auto_init_input_src(codec);
5127 alc_auto_init_digital(codec);
5128 if (spec->unsol_event)
5129 alc_inithook(codec);
5132 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5133 * one of two digital mic pins, e.g. on ALC272
5135 static void fixup_automic_adc(struct hda_codec *codec)
5137 struct alc_spec *spec = codec->spec;
5140 for (i = 0; i < spec->num_adc_nids; i++) {
5141 hda_nid_t cap = spec->capsrc_nids ?
5142 spec->capsrc_nids[i] : spec->adc_nids[i];
5145 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5148 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5151 spec->int_mic.mux_idx = iidx;
5152 spec->ext_mic.mux_idx = eidx;
5153 if (spec->capsrc_nids)
5154 spec->capsrc_nids += i;
5155 spec->adc_nids += i;
5156 spec->num_adc_nids = 1;
5159 snd_printd(KERN_INFO "hda_codec: %s: "
5160 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5161 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5162 spec->auto_mic = 0; /* disable auto-mic to be sure */
5165 /* set the default connection to that pin */
5166 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5168 struct alc_spec *spec = codec->spec;
5171 for (i = 0; i < spec->num_adc_nids; i++) {
5172 hda_nid_t cap = spec->capsrc_nids ?
5173 spec->capsrc_nids[i] : spec->adc_nids[i];
5176 idx = get_connection_index(codec, cap, pin);
5179 /* select or unmute this route */
5180 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5181 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5184 snd_hda_codec_write_cache(codec, cap, 0,
5185 AC_VERB_SET_CONNECT_SEL, idx);
5187 return i; /* return the found index */
5189 return -1; /* not found */
5192 /* choose the ADC/MUX containing the input pin and initialize the setup */
5193 static void fixup_single_adc(struct hda_codec *codec)
5195 struct alc_spec *spec = codec->spec;
5199 /* search for the input pin; there must be only one */
5200 for (i = 0; i < AUTO_PIN_LAST; i++) {
5201 if (spec->autocfg.input_pins[i]) {
5202 pin = spec->autocfg.input_pins[i];
5208 i = init_capsrc_for_pin(codec, pin);
5210 /* use only this ADC */
5211 if (spec->capsrc_nids)
5212 spec->capsrc_nids += i;
5213 spec->adc_nids += i;
5214 spec->num_adc_nids = 1;
5218 /* initialize dual adcs */
5219 static void fixup_dual_adc_switch(struct hda_codec *codec)
5221 struct alc_spec *spec = codec->spec;
5222 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5223 init_capsrc_for_pin(codec, spec->int_mic.pin);
5226 static void set_capture_mixer(struct hda_codec *codec)
5228 struct alc_spec *spec = codec->spec;
5229 static struct snd_kcontrol_new *caps[2][3] = {
5230 { alc_capture_mixer_nosrc1,
5231 alc_capture_mixer_nosrc2,
5232 alc_capture_mixer_nosrc3 },
5233 { alc_capture_mixer1,
5235 alc_capture_mixer3 },
5237 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5239 int num_adcs = spec->num_adc_nids;
5240 if (spec->dual_adc_switch)
5241 fixup_dual_adc_switch(codec);
5242 else if (spec->auto_mic)
5243 fixup_automic_adc(codec);
5244 else if (spec->input_mux) {
5245 if (spec->input_mux->num_items > 1)
5247 else if (spec->input_mux->num_items == 1)
5248 fixup_single_adc(codec);
5250 if (spec->dual_adc_switch)
5252 spec->cap_mixer = caps[mux][num_adcs - 1];
5256 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5257 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5260 struct alc_spec *spec = codec->spec;
5262 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5264 for (n = 0; n < num_nids; n++) {
5266 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5270 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5273 nconns = snd_hda_get_connections(codec, cap, conn,
5277 nconns = snd_hda_get_connections(codec, cap, conn,
5282 if (!fallback_adc) {
5286 for (i = 0; i < AUTO_PIN_LAST; i++) {
5287 hda_nid_t nid = spec->autocfg.input_pins[i];
5290 for (j = 0; j < nconns; j++) {
5297 if (i >= AUTO_PIN_LAST) {
5298 int num_adcs = spec->num_adc_nids;
5299 spec->private_adc_nids[num_adcs] = adc;
5300 spec->private_capsrc_nids[num_adcs] = cap;
5301 spec->num_adc_nids++;
5302 spec->adc_nids = spec->private_adc_nids;
5304 spec->capsrc_nids = spec->private_capsrc_nids;
5307 if (!spec->num_adc_nids) {
5308 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5309 " using fallback 0x%x\n",
5310 codec->chip_name, fallback_adc);
5311 spec->private_adc_nids[0] = fallback_adc;
5312 spec->adc_nids = spec->private_adc_nids;
5313 if (fallback_adc != fallback_cap) {
5314 spec->private_capsrc_nids[0] = fallback_cap;
5315 spec->capsrc_nids = spec->private_adc_nids;
5320 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5321 #define set_beep_amp(spec, nid, idx, dir) \
5322 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5324 static struct snd_pci_quirk beep_white_list[] = {
5325 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5329 static inline int has_cdefine_beep(struct hda_codec *codec)
5331 struct alc_spec *spec = codec->spec;
5332 const struct snd_pci_quirk *q;
5333 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5336 return spec->cdefine.enable_pcbeep;
5339 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5340 #define has_cdefine_beep(codec) 0
5344 * OK, here we have finally the patch for ALC880
5347 static int patch_alc880(struct hda_codec *codec)
5349 struct alc_spec *spec;
5353 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5359 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5362 if (board_config < 0) {
5363 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5365 board_config = ALC880_AUTO;
5368 if (board_config == ALC880_AUTO) {
5369 /* automatic parse from the BIOS config */
5370 err = alc880_parse_auto_config(codec);
5376 "hda_codec: Cannot set up configuration "
5377 "from BIOS. Using 3-stack mode...\n");
5378 board_config = ALC880_3ST;
5382 err = snd_hda_attach_beep_device(codec, 0x1);
5388 if (board_config != ALC880_AUTO)
5389 setup_preset(codec, &alc880_presets[board_config]);
5391 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5392 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5393 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5395 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5396 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5398 if (!spec->adc_nids && spec->input_mux) {
5399 /* check whether NID 0x07 is valid */
5400 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5402 wcap = get_wcaps_type(wcap);
5403 if (wcap != AC_WID_AUD_IN) {
5404 spec->adc_nids = alc880_adc_nids_alt;
5405 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5407 spec->adc_nids = alc880_adc_nids;
5408 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5411 set_capture_mixer(codec);
5412 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5414 spec->vmaster_nid = 0x0c;
5416 codec->patch_ops = alc_patch_ops;
5417 if (board_config == ALC880_AUTO)
5418 spec->init_hook = alc880_auto_init;
5419 #ifdef CONFIG_SND_HDA_POWER_SAVE
5420 if (!spec->loopback.amplist)
5421 spec->loopback.amplist = alc880_loopbacks;
5432 static hda_nid_t alc260_dac_nids[1] = {
5437 static hda_nid_t alc260_adc_nids[1] = {
5442 static hda_nid_t alc260_adc_nids_alt[1] = {
5447 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5448 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5450 static hda_nid_t alc260_dual_adc_nids[2] = {
5455 #define ALC260_DIGOUT_NID 0x03
5456 #define ALC260_DIGIN_NID 0x06
5458 static struct hda_input_mux alc260_capture_source = {
5462 { "Front Mic", 0x1 },
5468 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5469 * headphone jack and the internal CD lines since these are the only pins at
5470 * which audio can appear. For flexibility, also allow the option of
5471 * recording the mixer output on the second ADC (ADC0 doesn't have a
5472 * connection to the mixer output).
5474 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5478 { "Mic/Line", 0x0 },
5480 { "Headphone", 0x2 },
5486 { "Mic/Line", 0x0 },
5488 { "Headphone", 0x2 },
5495 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5496 * the Fujitsu S702x, but jacks are marked differently.
5498 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5505 { "Headphone", 0x5 },
5514 { "Headphone", 0x6 },
5520 /* Maxdata Favorit 100XS */
5521 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5525 { "Line/Mic", 0x0 },
5532 { "Line/Mic", 0x0 },
5540 * This is just place-holder, so there's something for alc_build_pcms to look
5541 * at when it calculates the maximum number of channels. ALC260 has no mixer
5542 * element which allows changing the channel mode, so the verb list is
5545 static struct hda_channel_mode alc260_modes[1] = {
5550 /* Mixer combinations
5552 * basic: base_output + input + pc_beep + capture
5553 * HP: base_output + input + capture_alt
5554 * HP_3013: hp_3013 + input + capture
5555 * fujitsu: fujitsu + capture
5556 * acer: acer + capture
5559 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5560 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5561 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5562 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5563 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5564 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5565 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5569 static struct snd_kcontrol_new alc260_input_mixer[] = {
5570 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5571 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5572 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5573 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5574 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5575 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5576 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5577 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5581 /* update HP, line and mono out pins according to the master switch */
5582 static void alc260_hp_master_update(struct hda_codec *codec,
5583 hda_nid_t hp, hda_nid_t line,
5586 struct alc_spec *spec = codec->spec;
5587 unsigned int val = spec->master_sw ? PIN_HP : 0;
5588 /* change HP and line-out pins */
5589 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5591 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5593 /* mono (speaker) depending on the HP jack sense */
5594 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5595 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5599 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5600 struct snd_ctl_elem_value *ucontrol)
5602 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5603 struct alc_spec *spec = codec->spec;
5604 *ucontrol->value.integer.value = spec->master_sw;
5608 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5609 struct snd_ctl_elem_value *ucontrol)
5611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5612 struct alc_spec *spec = codec->spec;
5613 int val = !!*ucontrol->value.integer.value;
5614 hda_nid_t hp, line, mono;
5616 if (val == spec->master_sw)
5618 spec->master_sw = val;
5619 hp = (kcontrol->private_value >> 16) & 0xff;
5620 line = (kcontrol->private_value >> 8) & 0xff;
5621 mono = kcontrol->private_value & 0xff;
5622 alc260_hp_master_update(codec, hp, line, mono);
5626 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5628 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5629 .name = "Master Playback Switch",
5630 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5631 .info = snd_ctl_boolean_mono_info,
5632 .get = alc260_hp_master_sw_get,
5633 .put = alc260_hp_master_sw_put,
5634 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5636 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5637 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5638 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5639 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5640 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5642 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5646 static struct hda_verb alc260_hp_unsol_verbs[] = {
5647 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5651 static void alc260_hp_automute(struct hda_codec *codec)
5653 struct alc_spec *spec = codec->spec;
5655 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5656 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5659 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5661 if ((res >> 26) == ALC880_HP_EVENT)
5662 alc260_hp_automute(codec);
5665 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5667 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5668 .name = "Master Playback Switch",
5669 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5670 .info = snd_ctl_boolean_mono_info,
5671 .get = alc260_hp_master_sw_get,
5672 .put = alc260_hp_master_sw_put,
5673 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5675 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5676 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5677 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5678 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5679 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5680 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5681 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5682 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5686 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5687 .ops = &snd_hda_bind_vol,
5689 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5690 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5691 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5696 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5697 .ops = &snd_hda_bind_sw,
5699 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5700 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5705 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5706 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5707 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5708 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5709 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5713 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5714 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5718 static void alc260_hp_3013_automute(struct hda_codec *codec)
5720 struct alc_spec *spec = codec->spec;
5722 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5723 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5726 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5729 if ((res >> 26) == ALC880_HP_EVENT)
5730 alc260_hp_3013_automute(codec);
5733 static void alc260_hp_3012_automute(struct hda_codec *codec)
5735 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5737 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5739 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5741 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5745 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5748 if ((res >> 26) == ALC880_HP_EVENT)
5749 alc260_hp_3012_automute(codec);
5752 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5753 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5755 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5756 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5757 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5758 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5759 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5760 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5761 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5762 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5763 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5764 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5765 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5769 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5770 * versions of the ALC260 don't act on requests to enable mic bias from NID
5771 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5772 * datasheet doesn't mention this restriction. At this stage it's not clear
5773 * whether this behaviour is intentional or is a hardware bug in chip
5774 * revisions available in early 2006. Therefore for now allow the
5775 * "Headphone Jack Mode" control to span all choices, but if it turns out
5776 * that the lack of mic bias for this NID is intentional we could change the
5777 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5779 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5780 * don't appear to make the mic bias available from the "line" jack, even
5781 * though the NID used for this jack (0x14) can supply it. The theory is
5782 * that perhaps Acer have included blocking capacitors between the ALC260
5783 * and the output jack. If this turns out to be the case for all such
5784 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5785 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5787 * The C20x Tablet series have a mono internal speaker which is controlled
5788 * via the chip's Mono sum widget and pin complex, so include the necessary
5789 * controls for such models. On models without a "mono speaker" the control
5790 * won't do anything.
5792 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5793 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5794 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5795 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5796 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5798 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5800 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5801 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5803 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5804 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5805 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5806 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5807 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5811 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5813 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5814 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5815 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5816 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5817 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5818 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5819 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5823 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5824 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5826 static struct snd_kcontrol_new alc260_will_mixer[] = {
5827 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5828 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5830 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5831 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5832 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5833 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5834 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5835 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5836 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5840 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5841 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5843 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5844 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5845 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5847 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5848 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5849 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5850 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5851 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5852 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5853 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5858 * initialization verbs
5860 static struct hda_verb alc260_init_verbs[] = {
5861 /* Line In pin widget for input */
5862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5863 /* CD pin widget for input */
5864 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5865 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5866 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5867 /* Mic2 (front panel) pin widget for input and vref at 80% */
5868 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5869 /* LINE-2 is used for line-out in rear */
5870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5871 /* select line-out */
5872 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5874 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5876 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5878 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5879 /* mute capture amp left and right */
5880 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5881 /* set connection select to line in (default select for this ADC) */
5882 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5883 /* mute capture amp left and right */
5884 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5885 /* set connection select to line in (default select for this ADC) */
5886 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5887 /* set vol=0 Line-Out mixer amp left and right */
5888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5889 /* unmute pin widget amp left and right (no gain on this amp) */
5890 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5891 /* set vol=0 HP mixer amp left and right */
5892 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5893 /* unmute pin widget amp left and right (no gain on this amp) */
5894 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5895 /* set vol=0 Mono mixer amp left and right */
5896 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5897 /* unmute pin widget amp left and right (no gain on this amp) */
5898 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5899 /* unmute LINE-2 out pin */
5900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5901 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5904 /* mute analog inputs */
5905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5910 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5911 /* mute Front out path */
5912 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5914 /* mute Headphone out path */
5915 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5916 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5917 /* mute Mono out path */
5918 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5919 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5923 #if 0 /* should be identical with alc260_init_verbs? */
5924 static struct hda_verb alc260_hp_init_verbs[] = {
5925 /* Headphone and output */
5926 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5928 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5929 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5930 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5931 /* Mic2 (front panel) pin widget for input and vref at 80% */
5932 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5933 /* Line In pin widget for input */
5934 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5935 /* Line-2 pin widget for output */
5936 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5937 /* CD pin widget for input */
5938 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5939 /* unmute amp left and right */
5940 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5941 /* set connection select to line in (default select for this ADC) */
5942 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5943 /* unmute Line-Out mixer amp left and right (volume = 0) */
5944 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5945 /* mute pin widget amp left and right (no gain on this amp) */
5946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5947 /* unmute HP mixer amp left and right (volume = 0) */
5948 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5949 /* mute pin widget amp left and right (no gain on this amp) */
5950 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5951 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5954 /* mute analog inputs */
5955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5958 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5959 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5960 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5961 /* Unmute Front out path */
5962 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5963 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5964 /* Unmute Headphone out path */
5965 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5966 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5967 /* Unmute Mono out path */
5968 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5969 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5974 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5975 /* Line out and output */
5976 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5978 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5979 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5980 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5981 /* Mic2 (front panel) pin widget for input and vref at 80% */
5982 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5983 /* Line In pin widget for input */
5984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5985 /* Headphone pin widget for output */
5986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5987 /* CD pin widget for input */
5988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5989 /* unmute amp left and right */
5990 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5991 /* set connection select to line in (default select for this ADC) */
5992 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5993 /* unmute Line-Out mixer amp left and right (volume = 0) */
5994 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5995 /* mute pin widget amp left and right (no gain on this amp) */
5996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5997 /* unmute HP mixer amp left and right (volume = 0) */
5998 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5999 /* mute pin widget amp left and right (no gain on this amp) */
6000 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6001 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6004 /* mute analog inputs */
6005 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6006 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6008 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6010 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6011 /* Unmute Front out path */
6012 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6013 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6014 /* Unmute Headphone out path */
6015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6017 /* Unmute Mono out path */
6018 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6019 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6023 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6024 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6025 * audio = 0x16, internal speaker = 0x10.
6027 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6028 /* Disable all GPIOs */
6029 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6030 /* Internal speaker is connected to headphone pin */
6031 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6032 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6034 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6035 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6036 /* Ensure all other unused pins are disabled and muted. */
6037 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6038 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6039 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6040 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6041 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6042 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6043 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6046 /* Disable digital (SPDIF) pins */
6047 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6048 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6050 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6051 * when acting as an output.
6053 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6055 /* Start with output sum widgets muted and their output gains at min */
6056 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6057 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6059 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6062 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6064 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6066 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6067 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6068 /* Unmute Line1 pin widget output buffer since it starts as an output.
6069 * If the pin mode is changed by the user the pin mode control will
6070 * take care of enabling the pin's input/output buffers as needed.
6071 * Therefore there's no need to enable the input buffer at this
6074 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6075 /* Unmute input buffer of pin widget used for Line-in (no equiv
6078 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6080 /* Mute capture amp left and right */
6081 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6082 /* Set ADC connection select to match default mixer setting - line
6085 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6087 /* Do the same for the second ADC: mute capture input amp and
6088 * set ADC connection to line in (on mic1 pin)
6090 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6091 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6093 /* Mute all inputs to mixer widget (even unconnected ones) */
6094 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6095 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6106 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6107 * similar laptops (adapted from Fujitsu init verbs).
6109 static struct hda_verb alc260_acer_init_verbs[] = {
6110 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6111 * the headphone jack. Turn this on and rely on the standard mute
6112 * methods whenever the user wants to turn these outputs off.
6114 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6115 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6116 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6117 /* Internal speaker/Headphone jack is connected to Line-out pin */
6118 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6119 /* Internal microphone/Mic jack is connected to Mic1 pin */
6120 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6121 /* Line In jack is connected to Line1 pin */
6122 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6123 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6124 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6125 /* Ensure all other unused pins are disabled and muted. */
6126 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6128 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6129 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6132 /* Disable digital (SPDIF) pins */
6133 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6134 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6136 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6137 * bus when acting as outputs.
6139 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6140 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6142 /* Start with output sum widgets muted and their output gains at min */
6143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6144 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6145 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6146 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6149 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6150 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6151 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6153 /* Unmute Line-out pin widget amp left and right
6154 * (no equiv mixer ctrl)
6156 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6157 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6158 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6159 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6160 * inputs. If the pin mode is changed by the user the pin mode control
6161 * will take care of enabling the pin's input/output buffers as needed.
6162 * Therefore there's no need to enable the input buffer at this
6165 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6166 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6168 /* Mute capture amp left and right */
6169 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6170 /* Set ADC connection select to match default mixer setting - mic
6173 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6175 /* Do similar with the second ADC: mute capture input amp and
6176 * set ADC connection to mic to match ALSA's default state.
6178 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6179 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6181 /* Mute all inputs to mixer widget (even unconnected ones) */
6182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6189 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6194 /* Initialisation sequence for Maxdata Favorit 100XS
6195 * (adapted from Acer init verbs).
6197 static struct hda_verb alc260_favorit100_init_verbs[] = {
6198 /* GPIO 0 enables the output jack.
6199 * Turn this on and rely on the standard mute
6200 * methods whenever the user wants to turn these outputs off.
6202 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6203 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6204 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6205 /* Line/Mic input jack is connected to Mic1 pin */
6206 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6207 /* Ensure all other unused pins are disabled and muted. */
6208 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6209 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6210 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6211 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6212 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6213 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6214 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6215 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6216 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6218 /* Disable digital (SPDIF) pins */
6219 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6220 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6222 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6223 * bus when acting as outputs.
6225 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6226 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6228 /* Start with output sum widgets muted and their output gains at min */
6229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6230 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6231 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6232 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6234 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6235 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6236 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6237 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6239 /* Unmute Line-out pin widget amp left and right
6240 * (no equiv mixer ctrl)
6242 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6243 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6244 * inputs. If the pin mode is changed by the user the pin mode control
6245 * will take care of enabling the pin's input/output buffers as needed.
6246 * Therefore there's no need to enable the input buffer at this
6249 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6251 /* Mute capture amp left and right */
6252 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6253 /* Set ADC connection select to match default mixer setting - mic
6256 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6258 /* Do similar with the second ADC: mute capture input amp and
6259 * set ADC connection to mic to match ALSA's default state.
6261 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6262 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6264 /* Mute all inputs to mixer widget (even unconnected ones) */
6265 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6266 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6267 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6277 static struct hda_verb alc260_will_verbs[] = {
6278 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6279 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6280 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6281 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6282 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6283 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6287 static struct hda_verb alc260_replacer_672v_verbs[] = {
6288 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6289 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6290 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6292 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6293 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6294 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6296 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6300 /* toggle speaker-output according to the hp-jack state */
6301 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6303 unsigned int present;
6305 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6306 present = snd_hda_jack_detect(codec, 0x0f);
6308 snd_hda_codec_write_cache(codec, 0x01, 0,
6309 AC_VERB_SET_GPIO_DATA, 1);
6310 snd_hda_codec_write_cache(codec, 0x0f, 0,
6311 AC_VERB_SET_PIN_WIDGET_CONTROL,
6314 snd_hda_codec_write_cache(codec, 0x01, 0,
6315 AC_VERB_SET_GPIO_DATA, 0);
6316 snd_hda_codec_write_cache(codec, 0x0f, 0,
6317 AC_VERB_SET_PIN_WIDGET_CONTROL,
6322 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6325 if ((res >> 26) == ALC880_HP_EVENT)
6326 alc260_replacer_672v_automute(codec);
6329 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6330 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6331 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6332 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6333 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6334 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6336 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6337 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6338 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6339 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6343 /* Test configuration for debugging, modelled after the ALC880 test
6346 #ifdef CONFIG_SND_DEBUG
6347 static hda_nid_t alc260_test_dac_nids[1] = {
6350 static hda_nid_t alc260_test_adc_nids[2] = {
6353 /* For testing the ALC260, each input MUX needs its own definition since
6354 * the signal assignments are different. This assumes that the first ADC
6357 static struct hda_input_mux alc260_test_capture_sources[2] = {
6361 { "MIC1 pin", 0x0 },
6362 { "MIC2 pin", 0x1 },
6363 { "LINE1 pin", 0x2 },
6364 { "LINE2 pin", 0x3 },
6366 { "LINE-OUT pin", 0x5 },
6367 { "HP-OUT pin", 0x6 },
6373 { "MIC1 pin", 0x0 },
6374 { "MIC2 pin", 0x1 },
6375 { "LINE1 pin", 0x2 },
6376 { "LINE2 pin", 0x3 },
6379 { "LINE-OUT pin", 0x6 },
6380 { "HP-OUT pin", 0x7 },
6384 static struct snd_kcontrol_new alc260_test_mixer[] = {
6385 /* Output driver widgets */
6386 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6387 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6388 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6389 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6390 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6391 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6393 /* Modes for retasking pin widgets
6394 * Note: the ALC260 doesn't seem to act on requests to enable mic
6395 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6396 * mention this restriction. At this stage it's not clear whether
6397 * this behaviour is intentional or is a hardware bug in chip
6398 * revisions available at least up until early 2006. Therefore for
6399 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6400 * choices, but if it turns out that the lack of mic bias for these
6401 * NIDs is intentional we could change their modes from
6402 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6404 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6405 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6406 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6407 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6408 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6409 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6411 /* Loopback mixer controls */
6412 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6413 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6414 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6415 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6416 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6417 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6418 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6419 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6420 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6421 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6422 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6423 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6424 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6425 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6427 /* Controls for GPIO pins, assuming they are configured as outputs */
6428 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6429 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6430 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6431 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6433 /* Switches to allow the digital IO pins to be enabled. The datasheet
6434 * is ambigious as to which NID is which; testing on laptops which
6435 * make this output available should provide clarification.
6437 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6438 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6440 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6441 * this output to turn on an external amplifier.
6443 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6444 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6448 static struct hda_verb alc260_test_init_verbs[] = {
6449 /* Enable all GPIOs as outputs with an initial value of 0 */
6450 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6451 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6452 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6454 /* Enable retasking pins as output, initially without power amp */
6455 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6456 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6457 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6459 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6460 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6462 /* Disable digital (SPDIF) pins initially, but users can enable
6463 * them via a mixer switch. In the case of SPDIF-out, this initverb
6464 * payload also sets the generation to 0, output to be in "consumer"
6465 * PCM format, copyright asserted, no pre-emphasis and no validity
6468 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6469 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6471 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6472 * OUT1 sum bus when acting as an output.
6474 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6475 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6476 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6477 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6479 /* Start with output sum widgets muted and their output gains at min */
6480 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6482 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6484 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6486 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6487 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6488 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6490 /* Unmute retasking pin widget output buffers since the default
6491 * state appears to be output. As the pin mode is changed by the
6492 * user the pin mode control will take care of enabling the pin's
6493 * input/output buffers as needed.
6495 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6496 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6499 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6500 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6501 /* Also unmute the mono-out pin widget */
6502 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6504 /* Mute capture amp left and right */
6505 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6506 /* Set ADC connection select to match default mixer setting (mic1
6509 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6511 /* Do the same for the second ADC: mute capture input amp and
6512 * set ADC connection to mic1 pin
6514 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6515 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6517 /* Mute all inputs to mixer widget (even unconnected ones) */
6518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6519 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6520 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6531 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6532 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6534 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6535 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6538 * for BIOS auto-configuration
6541 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6542 const char *pfx, int *vol_bits)
6545 unsigned long vol_val, sw_val;
6548 if (nid >= 0x0f && nid < 0x11) {
6549 nid_vol = nid - 0x7;
6550 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6551 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6552 } else if (nid == 0x11) {
6553 nid_vol = nid - 0x7;
6554 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6555 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6556 } else if (nid >= 0x12 && nid <= 0x15) {
6558 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6559 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6563 if (!(*vol_bits & (1 << nid_vol))) {
6564 /* first control for the volume widget */
6565 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6568 *vol_bits |= (1 << nid_vol);
6570 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6576 /* add playback controls from the parsed DAC table */
6577 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6578 const struct auto_pin_cfg *cfg)
6584 spec->multiout.num_dacs = 1;
6585 spec->multiout.dac_nids = spec->private_dac_nids;
6586 spec->multiout.dac_nids[0] = 0x02;
6588 nid = cfg->line_out_pins[0];
6591 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6593 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6597 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6602 nid = cfg->speaker_pins[0];
6604 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6609 nid = cfg->hp_pins[0];
6611 err = alc260_add_playback_controls(spec, nid, "Headphone",
6619 /* create playback/capture controls for input pins */
6620 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6621 const struct auto_pin_cfg *cfg)
6623 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6626 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6627 hda_nid_t nid, int pin_type,
6630 alc_set_pin_output(codec, nid, pin_type);
6631 /* need the manual connection? */
6633 int idx = nid - 0x12;
6634 snd_hda_codec_write(codec, idx + 0x0b, 0,
6635 AC_VERB_SET_CONNECT_SEL, sel_idx);
6639 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6641 struct alc_spec *spec = codec->spec;
6644 nid = spec->autocfg.line_out_pins[0];
6646 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6647 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6650 nid = spec->autocfg.speaker_pins[0];
6652 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6654 nid = spec->autocfg.hp_pins[0];
6656 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6659 #define ALC260_PIN_CD_NID 0x16
6660 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6662 struct alc_spec *spec = codec->spec;
6665 for (i = 0; i < AUTO_PIN_LAST; i++) {
6666 hda_nid_t nid = spec->autocfg.input_pins[i];
6668 alc_set_input_pin(codec, nid, i);
6669 if (nid != ALC260_PIN_CD_NID &&
6670 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6671 snd_hda_codec_write(codec, nid, 0,
6672 AC_VERB_SET_AMP_GAIN_MUTE,
6678 #define alc260_auto_init_input_src alc880_auto_init_input_src
6681 * generic initialization of ADC, input mixers and output mixers
6683 static struct hda_verb alc260_volume_init_verbs[] = {
6685 * Unmute ADC0-1 and set the default input to mic-in
6687 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6688 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6689 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6690 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6692 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6694 * Note: PASD motherboards uses the Line In 2 as the input for
6695 * front panel mic (mic 2)
6697 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6698 /* mute analog inputs */
6699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6706 * Set up output mixers (0x08 - 0x0a)
6708 /* set vol=0 to output mixers */
6709 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6710 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6711 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6712 /* set up input amps for analog loopback */
6713 /* Amp Indices: DAC = 0, mixer = 1 */
6714 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6716 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6718 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6719 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6724 static int alc260_parse_auto_config(struct hda_codec *codec)
6726 struct alc_spec *spec = codec->spec;
6728 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6730 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6734 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6737 if (!spec->kctls.list)
6738 return 0; /* can't find valid BIOS pin config */
6739 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6743 spec->multiout.max_channels = 2;
6745 if (spec->autocfg.dig_outs)
6746 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6747 if (spec->kctls.list)
6748 add_mixer(spec, spec->kctls.list);
6750 add_verb(spec, alc260_volume_init_verbs);
6752 spec->num_mux_defs = 1;
6753 spec->input_mux = &spec->private_imux[0];
6755 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6760 /* additional initialization for auto-configuration model */
6761 static void alc260_auto_init(struct hda_codec *codec)
6763 struct alc_spec *spec = codec->spec;
6764 alc260_auto_init_multi_out(codec);
6765 alc260_auto_init_analog_input(codec);
6766 alc260_auto_init_input_src(codec);
6767 alc_auto_init_digital(codec);
6768 if (spec->unsol_event)
6769 alc_inithook(codec);
6772 #ifdef CONFIG_SND_HDA_POWER_SAVE
6773 static struct hda_amp_list alc260_loopbacks[] = {
6774 { 0x07, HDA_INPUT, 0 },
6775 { 0x07, HDA_INPUT, 1 },
6776 { 0x07, HDA_INPUT, 2 },
6777 { 0x07, HDA_INPUT, 3 },
6778 { 0x07, HDA_INPUT, 4 },
6784 * ALC260 configurations
6786 static const char *alc260_models[ALC260_MODEL_LAST] = {
6787 [ALC260_BASIC] = "basic",
6789 [ALC260_HP_3013] = "hp-3013",
6790 [ALC260_HP_DC7600] = "hp-dc7600",
6791 [ALC260_FUJITSU_S702X] = "fujitsu",
6792 [ALC260_ACER] = "acer",
6793 [ALC260_WILL] = "will",
6794 [ALC260_REPLACER_672V] = "replacer",
6795 [ALC260_FAVORIT100] = "favorit100",
6796 #ifdef CONFIG_SND_DEBUG
6797 [ALC260_TEST] = "test",
6799 [ALC260_AUTO] = "auto",
6802 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6803 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6804 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6805 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6806 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6807 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6808 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6809 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6810 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6811 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6812 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6813 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6814 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6815 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6816 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6817 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6818 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6819 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6820 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6821 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6822 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6826 static struct alc_config_preset alc260_presets[] = {
6828 .mixers = { alc260_base_output_mixer,
6829 alc260_input_mixer },
6830 .init_verbs = { alc260_init_verbs },
6831 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6832 .dac_nids = alc260_dac_nids,
6833 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6834 .adc_nids = alc260_dual_adc_nids,
6835 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6836 .channel_mode = alc260_modes,
6837 .input_mux = &alc260_capture_source,
6840 .mixers = { alc260_hp_output_mixer,
6841 alc260_input_mixer },
6842 .init_verbs = { alc260_init_verbs,
6843 alc260_hp_unsol_verbs },
6844 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6845 .dac_nids = alc260_dac_nids,
6846 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6847 .adc_nids = alc260_adc_nids_alt,
6848 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6849 .channel_mode = alc260_modes,
6850 .input_mux = &alc260_capture_source,
6851 .unsol_event = alc260_hp_unsol_event,
6852 .init_hook = alc260_hp_automute,
6854 [ALC260_HP_DC7600] = {
6855 .mixers = { alc260_hp_dc7600_mixer,
6856 alc260_input_mixer },
6857 .init_verbs = { alc260_init_verbs,
6858 alc260_hp_dc7600_verbs },
6859 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6860 .dac_nids = alc260_dac_nids,
6861 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6862 .adc_nids = alc260_adc_nids_alt,
6863 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6864 .channel_mode = alc260_modes,
6865 .input_mux = &alc260_capture_source,
6866 .unsol_event = alc260_hp_3012_unsol_event,
6867 .init_hook = alc260_hp_3012_automute,
6869 [ALC260_HP_3013] = {
6870 .mixers = { alc260_hp_3013_mixer,
6871 alc260_input_mixer },
6872 .init_verbs = { alc260_hp_3013_init_verbs,
6873 alc260_hp_3013_unsol_verbs },
6874 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6875 .dac_nids = alc260_dac_nids,
6876 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6877 .adc_nids = alc260_adc_nids_alt,
6878 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6879 .channel_mode = alc260_modes,
6880 .input_mux = &alc260_capture_source,
6881 .unsol_event = alc260_hp_3013_unsol_event,
6882 .init_hook = alc260_hp_3013_automute,
6884 [ALC260_FUJITSU_S702X] = {
6885 .mixers = { alc260_fujitsu_mixer },
6886 .init_verbs = { alc260_fujitsu_init_verbs },
6887 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6888 .dac_nids = alc260_dac_nids,
6889 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6890 .adc_nids = alc260_dual_adc_nids,
6891 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6892 .channel_mode = alc260_modes,
6893 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6894 .input_mux = alc260_fujitsu_capture_sources,
6897 .mixers = { alc260_acer_mixer },
6898 .init_verbs = { alc260_acer_init_verbs },
6899 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6900 .dac_nids = alc260_dac_nids,
6901 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6902 .adc_nids = alc260_dual_adc_nids,
6903 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6904 .channel_mode = alc260_modes,
6905 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6906 .input_mux = alc260_acer_capture_sources,
6908 [ALC260_FAVORIT100] = {
6909 .mixers = { alc260_favorit100_mixer },
6910 .init_verbs = { alc260_favorit100_init_verbs },
6911 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6912 .dac_nids = alc260_dac_nids,
6913 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6914 .adc_nids = alc260_dual_adc_nids,
6915 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6916 .channel_mode = alc260_modes,
6917 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6918 .input_mux = alc260_favorit100_capture_sources,
6921 .mixers = { alc260_will_mixer },
6922 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6923 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6924 .dac_nids = alc260_dac_nids,
6925 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6926 .adc_nids = alc260_adc_nids,
6927 .dig_out_nid = ALC260_DIGOUT_NID,
6928 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6929 .channel_mode = alc260_modes,
6930 .input_mux = &alc260_capture_source,
6932 [ALC260_REPLACER_672V] = {
6933 .mixers = { alc260_replacer_672v_mixer },
6934 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6935 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6936 .dac_nids = alc260_dac_nids,
6937 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6938 .adc_nids = alc260_adc_nids,
6939 .dig_out_nid = ALC260_DIGOUT_NID,
6940 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6941 .channel_mode = alc260_modes,
6942 .input_mux = &alc260_capture_source,
6943 .unsol_event = alc260_replacer_672v_unsol_event,
6944 .init_hook = alc260_replacer_672v_automute,
6946 #ifdef CONFIG_SND_DEBUG
6948 .mixers = { alc260_test_mixer },
6949 .init_verbs = { alc260_test_init_verbs },
6950 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6951 .dac_nids = alc260_test_dac_nids,
6952 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6953 .adc_nids = alc260_test_adc_nids,
6954 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6955 .channel_mode = alc260_modes,
6956 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6957 .input_mux = alc260_test_capture_sources,
6962 static int patch_alc260(struct hda_codec *codec)
6964 struct alc_spec *spec;
6965 int err, board_config;
6967 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6973 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6976 if (board_config < 0) {
6977 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6979 board_config = ALC260_AUTO;
6982 if (board_config == ALC260_AUTO) {
6983 /* automatic parse from the BIOS config */
6984 err = alc260_parse_auto_config(codec);
6990 "hda_codec: Cannot set up configuration "
6991 "from BIOS. Using base mode...\n");
6992 board_config = ALC260_BASIC;
6996 err = snd_hda_attach_beep_device(codec, 0x1);
7002 if (board_config != ALC260_AUTO)
7003 setup_preset(codec, &alc260_presets[board_config]);
7005 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7006 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7008 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7009 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7011 if (!spec->adc_nids && spec->input_mux) {
7012 /* check whether NID 0x04 is valid */
7013 unsigned int wcap = get_wcaps(codec, 0x04);
7014 wcap = get_wcaps_type(wcap);
7016 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7017 spec->adc_nids = alc260_adc_nids_alt;
7018 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7020 spec->adc_nids = alc260_adc_nids;
7021 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7024 set_capture_mixer(codec);
7025 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7027 spec->vmaster_nid = 0x08;
7029 codec->patch_ops = alc_patch_ops;
7030 if (board_config == ALC260_AUTO)
7031 spec->init_hook = alc260_auto_init;
7032 #ifdef CONFIG_SND_HDA_POWER_SAVE
7033 if (!spec->loopback.amplist)
7034 spec->loopback.amplist = alc260_loopbacks;
7042 * ALC882/883/885/888/889 support
7044 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7045 * configuration. Each pin widget can choose any input DACs and a mixer.
7046 * Each ADC is connected from a mixer of all inputs. This makes possible
7047 * 6-channel independent captures.
7049 * In addition, an independent DAC for the multi-playback (not used in this
7052 #define ALC882_DIGOUT_NID 0x06
7053 #define ALC882_DIGIN_NID 0x0a
7054 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7055 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7056 #define ALC1200_DIGOUT_NID 0x10
7059 static struct hda_channel_mode alc882_ch_modes[1] = {
7064 static hda_nid_t alc882_dac_nids[4] = {
7065 /* front, rear, clfe, rear_surr */
7066 0x02, 0x03, 0x04, 0x05
7068 #define alc883_dac_nids alc882_dac_nids
7071 #define alc882_adc_nids alc880_adc_nids
7072 #define alc882_adc_nids_alt alc880_adc_nids_alt
7073 #define alc883_adc_nids alc882_adc_nids_alt
7074 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7075 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7076 #define alc889_adc_nids alc880_adc_nids
7078 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7079 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7080 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7081 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7082 #define alc889_capsrc_nids alc882_capsrc_nids
7085 /* FIXME: should be a matrix-type input source selection */
7087 static struct hda_input_mux alc882_capture_source = {
7091 { "Front Mic", 0x1 },
7097 #define alc883_capture_source alc882_capture_source
7099 static struct hda_input_mux alc889_capture_source = {
7102 { "Front Mic", 0x0 },
7108 static struct hda_input_mux mb5_capture_source = {
7117 static struct hda_input_mux macmini3_capture_source = {
7125 static struct hda_input_mux alc883_3stack_6ch_intel = {
7129 { "Front Mic", 0x0 },
7135 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7143 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7153 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7161 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7165 { "Front Mic", 0x1 },
7170 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7178 static struct hda_input_mux alc889A_mb31_capture_source = {
7182 /* Front Mic (0x01) unused */
7184 /* Line 2 (0x03) unused */
7185 /* CD (0x04) unused? */
7189 static struct hda_input_mux alc889A_imac91_capture_source = {
7193 { "Line", 0x2 }, /* Not sure! */
7200 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7207 static struct hda_verb alc882_3ST_ch2_init[] = {
7208 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7209 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7210 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7211 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7218 static struct hda_verb alc882_3ST_ch4_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_OUT },
7222 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7223 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7230 static struct hda_verb alc882_3ST_ch6_init[] = {
7231 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7232 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7233 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7234 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7235 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7236 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7240 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7241 { 2, alc882_3ST_ch2_init },
7242 { 4, alc882_3ST_ch4_init },
7243 { 6, alc882_3ST_ch6_init },
7246 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7251 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7252 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7253 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7254 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7255 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7256 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7263 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7264 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7265 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7266 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7267 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7268 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7269 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7276 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7277 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7278 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7279 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7280 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7281 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7282 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7283 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7287 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7288 { 2, alc883_3ST_ch2_clevo_init },
7289 { 4, alc883_3ST_ch4_clevo_init },
7290 { 6, alc883_3ST_ch6_clevo_init },
7297 static struct hda_verb alc882_sixstack_ch6_init[] = {
7298 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7299 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7300 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7301 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7308 static struct hda_verb alc882_sixstack_ch8_init[] = {
7309 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
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 },
7316 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7317 { 6, alc882_sixstack_ch6_init },
7318 { 8, alc882_sixstack_ch8_init },
7322 /* Macbook Air 2,1 */
7324 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7329 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7335 static struct hda_verb alc885_mbp_ch2_init[] = {
7336 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7337 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7338 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7345 static struct hda_verb alc885_mbp_ch4_init[] = {
7346 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7347 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7348 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7349 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7350 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7354 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7355 { 2, alc885_mbp_ch2_init },
7356 { 4, alc885_mbp_ch4_init },
7361 * Speakers/Woofer/HP = Front
7364 static struct hda_verb alc885_mb5_ch2_init[] = {
7365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7372 * Speakers/HP = Front
7376 static struct hda_verb alc885_mb5_ch6_init[] = {
7377 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7378 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7379 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7383 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7384 { 2, alc885_mb5_ch2_init },
7385 { 6, alc885_mb5_ch6_init },
7388 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7393 static struct hda_verb alc883_4ST_ch2_init[] = {
7394 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7395 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7396 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7397 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7398 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7399 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7406 static struct hda_verb alc883_4ST_ch4_init[] = {
7407 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7408 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7409 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7410 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7411 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7412 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7413 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7420 static struct hda_verb alc883_4ST_ch6_init[] = {
7421 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7422 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7423 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7424 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7425 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7426 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7427 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7428 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7435 static struct hda_verb alc883_4ST_ch8_init[] = {
7436 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7437 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7438 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7439 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7440 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7441 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7442 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7443 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7444 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7448 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7449 { 2, alc883_4ST_ch2_init },
7450 { 4, alc883_4ST_ch4_init },
7451 { 6, alc883_4ST_ch6_init },
7452 { 8, alc883_4ST_ch8_init },
7459 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7460 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7461 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7470 static struct hda_verb alc883_3ST_ch4_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_OUT },
7474 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7475 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7482 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7483 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7484 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7485 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7486 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7487 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7488 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7492 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7493 { 2, alc883_3ST_ch2_intel_init },
7494 { 4, alc883_3ST_ch4_intel_init },
7495 { 6, alc883_3ST_ch6_intel_init },
7501 static struct hda_verb alc889_ch2_intel_init[] = {
7502 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7503 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7504 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7505 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7506 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7507 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7514 static struct hda_verb alc889_ch6_intel_init[] = {
7515 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7516 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7517 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7518 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7519 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7520 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7527 static struct hda_verb alc889_ch8_intel_init[] = {
7528 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7529 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7530 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7531 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7532 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7533 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7534 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7538 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7539 { 2, alc889_ch2_intel_init },
7540 { 6, alc889_ch6_intel_init },
7541 { 8, alc889_ch8_intel_init },
7547 static struct hda_verb alc883_sixstack_ch6_init[] = {
7548 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7549 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7550 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7551 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7558 static struct hda_verb alc883_sixstack_ch8_init[] = {
7559 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
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 },
7566 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7567 { 6, alc883_sixstack_ch6_init },
7568 { 8, alc883_sixstack_ch8_init },
7572 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7573 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7575 static struct snd_kcontrol_new alc882_base_mixer[] = {
7576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7578 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7579 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7580 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7581 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7582 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7583 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7584 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7585 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7586 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7587 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7588 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7589 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7590 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7591 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7594 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7595 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7596 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7600 /* Macbook Air 2,1 same control for HP and internal Speaker */
7602 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7603 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7604 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7609 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7610 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7611 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7612 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7613 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7614 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7615 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7616 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7617 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7618 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7619 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7620 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7624 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7626 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7627 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7628 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7629 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7630 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7632 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7633 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7634 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7636 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7637 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7638 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7642 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7643 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7644 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7646 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7647 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7648 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7649 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7650 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7652 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7653 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7657 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7658 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7659 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7664 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7665 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7666 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7677 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7678 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7679 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7680 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7681 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7682 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7684 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7688 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7690 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7694 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7695 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7697 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7698 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7699 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7701 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7702 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7703 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7706 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7707 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7710 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7714 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7715 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7716 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7717 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7718 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7719 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7720 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7721 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7724 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7728 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7731 .name = "Channel Mode",
7732 .info = alc_ch_mode_info,
7733 .get = alc_ch_mode_get,
7734 .put = alc_ch_mode_put,
7739 static struct hda_verb alc882_base_init_verbs[] = {
7740 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7745 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7753 /* Front Pin: output 0 (0x0c) */
7754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7755 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7756 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7757 /* Rear Pin: output 1 (0x0d) */
7758 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7760 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7761 /* CLFE Pin: output 2 (0x0e) */
7762 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7763 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7764 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7765 /* Side Pin: output 3 (0x0f) */
7766 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7767 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7768 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7769 /* Mic (rear) pin: input vref at 80% */
7770 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7772 /* Front Mic pin: input vref at 80% */
7773 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7774 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7775 /* Line In pin: input */
7776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7778 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7779 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7780 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7781 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7782 /* CD pin widget for input */
7783 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7785 /* FIXME: use matrix-type input source selection */
7786 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7788 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7791 /* ADC2: mute amp left and right */
7792 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7793 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7794 /* ADC3: mute amp left and right */
7795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7796 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7801 static struct hda_verb alc882_adc1_init_verbs[] = {
7802 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7803 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7804 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7805 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7807 /* ADC1: mute amp left and right */
7808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7809 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7813 static struct hda_verb alc882_eapd_verbs[] = {
7814 /* change to EAPD mode */
7815 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7816 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7820 static struct hda_verb alc889_eapd_verbs[] = {
7821 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7822 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7826 static struct hda_verb alc_hp15_unsol_verbs[] = {
7827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7832 static struct hda_verb alc885_init_verbs[] = {
7833 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7834 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7835 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7837 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7838 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7840 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7846 /* Front HP Pin: output 0 (0x0c) */
7847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7848 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7849 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7850 /* Front Pin: output 0 (0x0c) */
7851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7852 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7853 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7854 /* Rear Pin: output 1 (0x0d) */
7855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7856 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7857 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7858 /* CLFE Pin: output 2 (0x0e) */
7859 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7860 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7861 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7862 /* Side Pin: output 3 (0x0f) */
7863 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7864 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7865 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7866 /* Mic (rear) pin: input vref at 80% */
7867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7868 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7869 /* Front Mic pin: input vref at 80% */
7870 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7872 /* Line In pin: input */
7873 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7874 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7876 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7878 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7880 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7883 /* ADC2: mute amp left and right */
7884 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7885 /* ADC3: mute amp left and right */
7886 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7891 static struct hda_verb alc885_init_input_verbs[] = {
7892 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7899 /* Unmute Selector 24h and set the default input to front mic */
7900 static struct hda_verb alc889_init_input_verbs[] = {
7901 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7902 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7907 #define alc883_init_verbs alc882_base_init_verbs
7910 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7912 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7914 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7915 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7916 /* FIXME: this looks suspicious...
7917 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7918 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7923 static struct hda_verb alc882_macpro_init_verbs[] = {
7924 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7928 /* Front Pin: output 0 (0x0c) */
7929 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7932 /* Front Mic pin: input vref at 80% */
7933 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7934 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7935 /* Speaker: output */
7936 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7937 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7938 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7939 /* Headphone output (output 0 - 0x0c) */
7940 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7942 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7944 /* FIXME: use matrix-type input source selection */
7945 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7946 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7947 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7952 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7953 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7958 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7959 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7961 /* ADC1: mute amp left and right */
7962 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7963 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7964 /* ADC2: mute amp left and right */
7965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7966 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7967 /* ADC3: mute amp left and right */
7968 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7969 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7975 static struct hda_verb alc885_mb5_init_verbs[] = {
7977 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7978 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7979 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7980 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7984 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7985 /* Surround mixer */
7986 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7987 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7988 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7991 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7992 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7995 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7996 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7997 /* Front Pin (0x0c) */
7998 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8000 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8001 /* LFE Pin (0x0e) */
8002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8004 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8006 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8008 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8009 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8010 /* Front Mic pin: input vref at 80% */
8011 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8012 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8014 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8017 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8018 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8019 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8024 static struct hda_verb alc885_macmini3_init_verbs[] = {
8026 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8027 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8028 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8029 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8034 /* Surround mixer */
8035 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8036 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8039 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8040 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8043 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8044 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8045 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8046 /* Front Pin (0x0c) */
8047 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8048 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8049 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8050 /* LFE Pin (0x0e) */
8051 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8052 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8053 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8057 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8058 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8061 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8071 static struct hda_verb alc885_mba21_init_verbs[] = {
8072 /*Internal and HP Speaker Mixer*/
8073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8076 /*Internal Speaker Pin (0x0c)*/
8077 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8078 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8079 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8080 /* HP Pin: output 0 (0x0e) */
8081 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8082 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8083 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8085 /* Line in (is hp when jack connected)*/
8086 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8087 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8093 /* Macbook Pro rev3 */
8094 static struct hda_verb alc885_mbp3_init_verbs[] = {
8095 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8102 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8104 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8105 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8106 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8107 /* Front Pin: output 0 (0x0c) */
8108 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8109 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8110 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8111 /* HP Pin: output 0 (0x0e) */
8112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8115 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8116 /* Mic (rear) pin: input vref at 80% */
8117 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8118 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8119 /* Front Mic pin: input vref at 80% */
8120 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8121 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8122 /* Line In pin: use output 1 when in LineOut mode */
8123 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8124 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8125 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8127 /* FIXME: use matrix-type input source selection */
8128 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8129 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8135 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8136 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8137 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8143 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8144 /* ADC1: mute amp left and right */
8145 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8146 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8147 /* ADC2: mute amp left and right */
8148 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8149 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8150 /* ADC3: mute amp left and right */
8151 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8152 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8158 static struct hda_verb alc885_imac91_init_verbs[] = {
8159 /* Internal Speaker Pin (0x0c) */
8160 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8161 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8162 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8164 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8165 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8167 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8168 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8169 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8170 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8172 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8174 /* Front Mic pin: input vref at 80% */
8175 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8176 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8178 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8179 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8181 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8185 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8187 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8189 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8190 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8191 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8195 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8199 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8200 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8202 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8203 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8205 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8206 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8208 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8212 /* iMac 24 mixer. */
8213 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8214 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8215 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8219 /* iMac 24 init verbs. */
8220 static struct hda_verb alc885_imac24_init_verbs[] = {
8221 /* Internal speakers: output 0 (0x0c) */
8222 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8223 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8224 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8225 /* Internal speakers: output 0 (0x0c) */
8226 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8227 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8228 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8229 /* Headphone: output 0 (0x0c) */
8230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8231 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8232 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8233 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8234 /* Front Mic: input vref at 80% */
8235 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8236 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8240 /* Toggle speaker-output according to the hp-jack state */
8241 static void alc885_imac24_setup(struct hda_codec *codec)
8243 struct alc_spec *spec = codec->spec;
8245 spec->autocfg.hp_pins[0] = 0x14;
8246 spec->autocfg.speaker_pins[0] = 0x18;
8247 spec->autocfg.speaker_pins[1] = 0x1a;
8250 #define alc885_mb5_setup alc885_imac24_setup
8251 #define alc885_macmini3_setup alc885_imac24_setup
8253 /* Macbook Air 2,1 */
8254 static void alc885_mba21_setup(struct hda_codec *codec)
8256 struct alc_spec *spec = codec->spec;
8258 spec->autocfg.hp_pins[0] = 0x14;
8259 spec->autocfg.speaker_pins[0] = 0x18;
8264 static void alc885_mbp3_setup(struct hda_codec *codec)
8266 struct alc_spec *spec = codec->spec;
8268 spec->autocfg.hp_pins[0] = 0x15;
8269 spec->autocfg.speaker_pins[0] = 0x14;
8272 static void alc885_imac91_setup(struct hda_codec *codec)
8274 struct alc_spec *spec = codec->spec;
8276 spec->autocfg.hp_pins[0] = 0x14;
8277 spec->autocfg.speaker_pins[0] = 0x18;
8278 spec->autocfg.speaker_pins[1] = 0x1a;
8281 static struct hda_verb alc882_targa_verbs[] = {
8282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8286 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8288 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8289 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8290 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8292 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8296 /* toggle speaker-output according to the hp-jack state */
8297 static void alc882_targa_automute(struct hda_codec *codec)
8299 struct alc_spec *spec = codec->spec;
8300 alc_automute_amp(codec);
8301 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8302 spec->jack_present ? 1 : 3);
8305 static void alc882_targa_setup(struct hda_codec *codec)
8307 struct alc_spec *spec = codec->spec;
8309 spec->autocfg.hp_pins[0] = 0x14;
8310 spec->autocfg.speaker_pins[0] = 0x1b;
8313 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8315 if ((res >> 26) == ALC880_HP_EVENT)
8316 alc882_targa_automute(codec);
8319 static struct hda_verb alc882_asus_a7j_verbs[] = {
8320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8325 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8327 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8328 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8329 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8331 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8332 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8333 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8337 static struct hda_verb alc882_asus_a7m_verbs[] = {
8338 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8339 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8342 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8343 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8345 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8346 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8347 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8349 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8350 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8351 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8355 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8357 unsigned int gpiostate, gpiomask, gpiodir;
8359 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8360 AC_VERB_GET_GPIO_DATA, 0);
8363 gpiostate |= (1 << pin);
8365 gpiostate &= ~(1 << pin);
8367 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8368 AC_VERB_GET_GPIO_MASK, 0);
8369 gpiomask |= (1 << pin);
8371 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8372 AC_VERB_GET_GPIO_DIRECTION, 0);
8373 gpiodir |= (1 << pin);
8376 snd_hda_codec_write(codec, codec->afg, 0,
8377 AC_VERB_SET_GPIO_MASK, gpiomask);
8378 snd_hda_codec_write(codec, codec->afg, 0,
8379 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8383 snd_hda_codec_write(codec, codec->afg, 0,
8384 AC_VERB_SET_GPIO_DATA, gpiostate);
8387 /* set up GPIO at initialization */
8388 static void alc885_macpro_init_hook(struct hda_codec *codec)
8390 alc882_gpio_mute(codec, 0, 0);
8391 alc882_gpio_mute(codec, 1, 0);
8394 /* set up GPIO and update auto-muting at initialization */
8395 static void alc885_imac24_init_hook(struct hda_codec *codec)
8397 alc885_macpro_init_hook(codec);
8398 alc_automute_amp(codec);
8402 * generic initialization of ADC, input mixers and output mixers
8404 static struct hda_verb alc883_auto_init_verbs[] = {
8406 * Unmute ADC0-2 and set the default input to mic-in
8408 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8409 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8410 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8411 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8414 * Set up output mixers (0x0c - 0x0f)
8416 /* set vol=0 to output mixers */
8417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8420 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8421 /* set up input amps for analog loopback */
8422 /* Amp Indices: DAC = 0, mixer = 1 */
8423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8425 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8427 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8431 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8432 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8434 /* FIXME: use matrix-type input source selection */
8435 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8437 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8443 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8444 static struct hda_verb alc889A_mb31_ch2_init[] = {
8445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8446 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8447 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8448 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8452 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8453 static struct hda_verb alc889A_mb31_ch4_init[] = {
8454 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8455 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8456 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8457 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8461 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8462 static struct hda_verb alc889A_mb31_ch5_init[] = {
8463 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8464 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8465 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8466 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8470 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8471 static struct hda_verb alc889A_mb31_ch6_init[] = {
8472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8473 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8474 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8475 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8479 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8480 { 2, alc889A_mb31_ch2_init },
8481 { 4, alc889A_mb31_ch4_init },
8482 { 5, alc889A_mb31_ch5_init },
8483 { 6, alc889A_mb31_ch6_init },
8486 static struct hda_verb alc883_medion_eapd_verbs[] = {
8487 /* eanable EAPD on medion laptop */
8488 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8489 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8493 #define alc883_base_mixer alc882_base_mixer
8495 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8496 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8497 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8499 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8500 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8501 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8502 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8504 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8506 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8507 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8508 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8512 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8513 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8514 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8515 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8516 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8518 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8520 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8521 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8522 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8526 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8527 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8528 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8529 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8530 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8532 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8534 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8535 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8536 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8540 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8541 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8542 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8544 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8545 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8546 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8547 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8549 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8551 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8552 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8553 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8557 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8558 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8559 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8560 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8561 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8562 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8563 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8564 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8565 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8566 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8567 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8568 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8569 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8570 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8571 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8572 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8573 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8574 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8575 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8576 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8580 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8581 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8582 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8583 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8584 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8585 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8587 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8588 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8589 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8591 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8592 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8593 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8594 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8596 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8598 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8599 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8604 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8605 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8606 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8607 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8608 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8609 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8611 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8612 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8613 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8614 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8615 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8617 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8618 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8620 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8622 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8623 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8624 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8628 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8629 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8630 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8631 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8632 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8633 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8634 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8635 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8636 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8637 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8638 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8639 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8646 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8651 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8652 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8653 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8654 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8655 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8656 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8657 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8658 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8659 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8660 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8661 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8662 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8663 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8667 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8672 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8673 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8674 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8675 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8676 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8677 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8678 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8680 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8682 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8683 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8684 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8688 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8689 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8690 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8691 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8692 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8693 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8697 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8698 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8699 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8700 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8701 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8702 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8704 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8709 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8710 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8711 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8712 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8713 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8714 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8715 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8717 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8718 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8722 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8723 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8724 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8725 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8726 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8727 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8728 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8729 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8735 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8736 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8737 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8738 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8739 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8740 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8741 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8745 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8746 /* Unmute front mixer */
8747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8750 /* Set speaker pin to front mixer */
8751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8753 /* Init headphone pin */
8754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8756 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8757 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8762 /* toggle speaker-output according to the hp-jack state */
8763 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8765 struct alc_spec *spec = codec->spec;
8767 spec->autocfg.hp_pins[0] = 0x1a;
8768 spec->autocfg.speaker_pins[0] = 0x15;
8771 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8772 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8773 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8778 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8783 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8784 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8785 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 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("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8789 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8791 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8792 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8796 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8797 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8798 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8800 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8801 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8802 0x0d, 1, 0x0, HDA_OUTPUT),
8803 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8804 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8805 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8806 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8807 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8808 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8809 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8810 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8811 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8812 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8813 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8815 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8816 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8817 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8821 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8823 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8824 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8825 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8826 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8827 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8829 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8830 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8831 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8832 /* Output switches */
8833 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8834 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8835 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8838 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8841 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8842 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8843 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8847 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8848 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8849 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8852 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8857 static struct hda_bind_ctls alc883_bind_cap_vol = {
8858 .ops = &snd_hda_bind_vol,
8860 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8861 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8866 static struct hda_bind_ctls alc883_bind_cap_switch = {
8867 .ops = &snd_hda_bind_sw,
8869 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8870 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8875 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8877 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8878 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8879 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8880 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8881 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8882 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8887 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8888 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8889 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8891 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8892 /* .name = "Capture Source", */
8893 .name = "Input Source",
8895 .info = alc_mux_enum_info,
8896 .get = alc_mux_enum_get,
8897 .put = alc_mux_enum_put,
8902 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8905 .name = "Channel Mode",
8906 .info = alc_ch_mode_info,
8907 .get = alc_ch_mode_get,
8908 .put = alc_ch_mode_put,
8913 /* toggle speaker-output according to the hp-jack state */
8914 static void alc883_mitac_setup(struct hda_codec *codec)
8916 struct alc_spec *spec = codec->spec;
8918 spec->autocfg.hp_pins[0] = 0x15;
8919 spec->autocfg.speaker_pins[0] = 0x14;
8920 spec->autocfg.speaker_pins[1] = 0x17;
8923 /* auto-toggle front mic */
8925 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8927 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8929 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8933 static struct hda_verb alc883_mitac_verbs[] = {
8935 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8936 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8938 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8939 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8941 /* enable unsolicited event */
8942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8943 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8948 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8950 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8953 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8955 /* enable unsolicited event */
8957 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8958 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8964 static struct hda_verb alc883_clevo_m720_verbs[] = {
8966 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8969 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8970 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8972 /* enable unsolicited event */
8973 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8974 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8979 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8981 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8984 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8987 /* enable unsolicited event */
8988 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8993 static struct hda_verb alc883_targa_verbs[] = {
8994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9000 /* Connect Line-Out side jack (SPDIF) to Side */
9001 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9002 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9003 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9004 /* Connect Mic jack to CLFE */
9005 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9006 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9007 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9008 /* Connect Line-in jack to Surround */
9009 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9010 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9011 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9012 /* Connect HP out jack to Front */
9013 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9015 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9017 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9022 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9023 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9024 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9025 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9029 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9031 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9032 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9037 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9039 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9040 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9041 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9042 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9046 static struct hda_verb alc883_haier_w66_verbs[] = {
9047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9050 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9052 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9054 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9055 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9059 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9062 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9063 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9066 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9067 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9071 static struct hda_verb alc888_6st_dell_verbs[] = {
9072 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9076 static struct hda_verb alc883_vaiott_verbs[] = {
9078 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9079 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9081 /* enable unsolicited event */
9082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9087 static void alc888_3st_hp_setup(struct hda_codec *codec)
9089 struct alc_spec *spec = codec->spec;
9091 spec->autocfg.hp_pins[0] = 0x1b;
9092 spec->autocfg.speaker_pins[0] = 0x14;
9093 spec->autocfg.speaker_pins[1] = 0x16;
9094 spec->autocfg.speaker_pins[2] = 0x18;
9097 static struct hda_verb alc888_3st_hp_verbs[] = {
9098 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9099 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9100 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9101 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9108 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9109 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9110 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9111 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9112 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9119 static struct hda_verb alc888_3st_hp_4ch_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_OUT },
9123 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9124 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9131 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9132 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9133 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9134 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9135 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9136 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9137 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9141 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9142 { 2, alc888_3st_hp_2ch_init },
9143 { 4, alc888_3st_hp_4ch_init },
9144 { 6, alc888_3st_hp_6ch_init },
9147 /* toggle front-jack and RCA according to the hp-jack state */
9148 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9150 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9152 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9153 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9154 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9155 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9158 /* toggle RCA according to the front-jack state */
9159 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9161 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9163 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9164 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9167 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9170 if ((res >> 26) == ALC880_HP_EVENT)
9171 alc888_lenovo_ms7195_front_automute(codec);
9172 if ((res >> 26) == ALC880_FRONT_EVENT)
9173 alc888_lenovo_ms7195_rca_automute(codec);
9176 static struct hda_verb alc883_medion_md2_verbs[] = {
9177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9182 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9186 /* toggle speaker-output according to the hp-jack state */
9187 static void alc883_medion_md2_setup(struct hda_codec *codec)
9189 struct alc_spec *spec = codec->spec;
9191 spec->autocfg.hp_pins[0] = 0x14;
9192 spec->autocfg.speaker_pins[0] = 0x15;
9195 /* toggle speaker-output according to the hp-jack state */
9196 #define alc883_targa_init_hook alc882_targa_init_hook
9197 #define alc883_targa_unsol_event alc882_targa_unsol_event
9199 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9201 unsigned int present;
9203 present = snd_hda_jack_detect(codec, 0x18);
9204 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9205 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9208 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9210 struct alc_spec *spec = codec->spec;
9212 spec->autocfg.hp_pins[0] = 0x15;
9213 spec->autocfg.speaker_pins[0] = 0x14;
9216 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9218 alc_automute_amp(codec);
9219 alc883_clevo_m720_mic_automute(codec);
9222 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9225 switch (res >> 26) {
9226 case ALC880_MIC_EVENT:
9227 alc883_clevo_m720_mic_automute(codec);
9230 alc_automute_amp_unsol_event(codec, res);
9235 /* toggle speaker-output according to the hp-jack state */
9236 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9238 struct alc_spec *spec = codec->spec;
9240 spec->autocfg.hp_pins[0] = 0x14;
9241 spec->autocfg.speaker_pins[0] = 0x15;
9244 static void alc883_haier_w66_setup(struct hda_codec *codec)
9246 struct alc_spec *spec = codec->spec;
9248 spec->autocfg.hp_pins[0] = 0x1b;
9249 spec->autocfg.speaker_pins[0] = 0x14;
9252 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9254 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9256 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9257 HDA_AMP_MUTE, bits);
9260 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9262 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9264 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9265 HDA_AMP_MUTE, bits);
9266 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9267 HDA_AMP_MUTE, bits);
9270 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9273 if ((res >> 26) == ALC880_HP_EVENT)
9274 alc883_lenovo_101e_all_automute(codec);
9275 if ((res >> 26) == ALC880_FRONT_EVENT)
9276 alc883_lenovo_101e_ispeaker_automute(codec);
9279 /* toggle speaker-output according to the hp-jack state */
9280 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9282 struct alc_spec *spec = codec->spec;
9284 spec->autocfg.hp_pins[0] = 0x14;
9285 spec->autocfg.speaker_pins[0] = 0x15;
9286 spec->autocfg.speaker_pins[1] = 0x16;
9289 static struct hda_verb alc883_acer_eapd_verbs[] = {
9290 /* HP Pin: output 0 (0x0c) */
9291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9293 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9294 /* Front Pin: output 0 (0x0c) */
9295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9296 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9297 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9298 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9299 /* eanable EAPD on medion laptop */
9300 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9301 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9302 /* enable unsolicited event */
9303 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9307 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9308 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9309 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9310 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9314 static void alc888_6st_dell_setup(struct hda_codec *codec)
9316 struct alc_spec *spec = codec->spec;
9318 spec->autocfg.hp_pins[0] = 0x1b;
9319 spec->autocfg.speaker_pins[0] = 0x14;
9320 spec->autocfg.speaker_pins[1] = 0x15;
9321 spec->autocfg.speaker_pins[2] = 0x16;
9322 spec->autocfg.speaker_pins[3] = 0x17;
9325 static void alc888_lenovo_sky_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;
9334 spec->autocfg.speaker_pins[4] = 0x1a;
9337 static void alc883_vaiott_setup(struct hda_codec *codec)
9339 struct alc_spec *spec = codec->spec;
9341 spec->autocfg.hp_pins[0] = 0x15;
9342 spec->autocfg.speaker_pins[0] = 0x14;
9343 spec->autocfg.speaker_pins[1] = 0x17;
9346 static struct hda_verb alc888_asus_m90v_verbs[] = {
9347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9350 /* enable unsolicited event */
9351 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9352 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9356 static void alc883_mode2_setup(struct hda_codec *codec)
9358 struct alc_spec *spec = codec->spec;
9360 spec->autocfg.hp_pins[0] = 0x1b;
9361 spec->autocfg.speaker_pins[0] = 0x14;
9362 spec->autocfg.speaker_pins[1] = 0x15;
9363 spec->autocfg.speaker_pins[2] = 0x16;
9364 spec->ext_mic.pin = 0x18;
9365 spec->int_mic.pin = 0x19;
9366 spec->ext_mic.mux_idx = 0;
9367 spec->int_mic.mux_idx = 1;
9371 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9373 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9377 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9378 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9379 /* enable unsolicited event */
9380 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9384 static void alc883_eee1601_inithook(struct hda_codec *codec)
9386 struct alc_spec *spec = codec->spec;
9388 spec->autocfg.hp_pins[0] = 0x14;
9389 spec->autocfg.speaker_pins[0] = 0x1b;
9390 alc_automute_pin(codec);
9393 static struct hda_verb alc889A_mb31_verbs[] = {
9394 /* Init rear pin (used as headphone output) */
9395 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9397 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9398 /* Init line pin (used as output in 4ch and 6ch mode) */
9399 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9400 /* Init line 2 pin (used as headphone out by default) */
9401 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9402 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9406 /* Mute speakers according to the headphone jack state */
9407 static void alc889A_mb31_automute(struct hda_codec *codec)
9409 unsigned int present;
9411 /* Mute only in 2ch or 4ch mode */
9412 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9414 present = snd_hda_jack_detect(codec, 0x15);
9415 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9416 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9417 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9418 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9422 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9424 if ((res >> 26) == ALC880_HP_EVENT)
9425 alc889A_mb31_automute(codec);
9429 #ifdef CONFIG_SND_HDA_POWER_SAVE
9430 #define alc882_loopbacks alc880_loopbacks
9433 /* pcm configuration: identical with ALC880 */
9434 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9435 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9436 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9437 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9439 static hda_nid_t alc883_slave_dig_outs[] = {
9440 ALC1200_DIGOUT_NID, 0,
9443 static hda_nid_t alc1200_slave_dig_outs[] = {
9444 ALC883_DIGOUT_NID, 0,
9448 * configuration and preset
9450 static const char *alc882_models[ALC882_MODEL_LAST] = {
9451 [ALC882_3ST_DIG] = "3stack-dig",
9452 [ALC882_6ST_DIG] = "6stack-dig",
9453 [ALC882_ARIMA] = "arima",
9454 [ALC882_W2JC] = "w2jc",
9455 [ALC882_TARGA] = "targa",
9456 [ALC882_ASUS_A7J] = "asus-a7j",
9457 [ALC882_ASUS_A7M] = "asus-a7m",
9458 [ALC885_MACPRO] = "macpro",
9459 [ALC885_MB5] = "mb5",
9460 [ALC885_MACMINI3] = "macmini3",
9461 [ALC885_MBA21] = "mba21",
9462 [ALC885_MBP3] = "mbp3",
9463 [ALC885_IMAC24] = "imac24",
9464 [ALC885_IMAC91] = "imac91",
9465 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9466 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9467 [ALC883_3ST_6ch] = "3stack-6ch",
9468 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9469 [ALC883_TARGA_DIG] = "targa-dig",
9470 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9471 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9472 [ALC883_ACER] = "acer",
9473 [ALC883_ACER_ASPIRE] = "acer-aspire",
9474 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9475 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9476 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9477 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9478 [ALC883_MEDION] = "medion",
9479 [ALC883_MEDION_MD2] = "medion-md2",
9480 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9481 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9482 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9483 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9484 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9485 [ALC888_LENOVO_SKY] = "lenovo-sky",
9486 [ALC883_HAIER_W66] = "haier-w66",
9487 [ALC888_3ST_HP] = "3stack-hp",
9488 [ALC888_6ST_DELL] = "6stack-dell",
9489 [ALC883_MITAC] = "mitac",
9490 [ALC883_CLEVO_M540R] = "clevo-m540r",
9491 [ALC883_CLEVO_M720] = "clevo-m720",
9492 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9493 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9494 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9495 [ALC889A_INTEL] = "intel-alc889a",
9496 [ALC889_INTEL] = "intel-x58",
9497 [ALC1200_ASUS_P5Q] = "asus-p5q",
9498 [ALC889A_MB31] = "mb31",
9499 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9500 [ALC882_AUTO] = "auto",
9503 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9504 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9506 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9507 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9508 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9509 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9510 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9511 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9512 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9513 ALC888_ACER_ASPIRE_4930G),
9514 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9515 ALC888_ACER_ASPIRE_4930G),
9516 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9517 ALC888_ACER_ASPIRE_8930G),
9518 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9519 ALC888_ACER_ASPIRE_8930G),
9520 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9521 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9522 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9523 ALC888_ACER_ASPIRE_6530G),
9524 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9525 ALC888_ACER_ASPIRE_6530G),
9526 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9527 ALC888_ACER_ASPIRE_7730G),
9528 /* default Acer -- disabled as it causes more problems.
9529 * model=auto should work fine now
9531 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9533 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9535 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9536 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9537 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9538 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9539 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9540 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9542 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9543 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9544 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9545 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9546 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9547 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9548 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9549 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9550 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9551 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9552 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9554 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9555 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9556 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9557 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9558 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9559 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9560 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9561 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9562 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9564 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9565 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9566 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9567 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9568 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9569 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9570 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9571 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9572 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9573 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9574 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9575 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9576 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9577 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9578 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9579 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9580 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9581 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9582 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9583 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9584 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9585 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9586 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9587 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9588 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9589 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9590 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9591 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9592 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9593 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9594 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9596 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9597 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9598 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9599 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9600 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9601 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9602 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9603 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9604 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9605 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9606 ALC883_FUJITSU_PI2515),
9607 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9608 ALC888_FUJITSU_XA3530),
9609 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9610 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9611 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9612 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9613 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9614 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9615 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9616 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9617 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9619 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9620 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9621 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9622 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9623 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9624 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9625 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9630 /* codec SSID table for Intel Mac */
9631 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9632 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9633 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9634 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9635 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9636 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9637 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9638 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9639 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9640 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9641 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9642 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9643 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9644 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9645 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9646 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9647 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9648 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9649 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9650 * so apparently no perfect solution yet
9652 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9653 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9654 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9658 static struct alc_config_preset alc882_presets[] = {
9659 [ALC882_3ST_DIG] = {
9660 .mixers = { alc882_base_mixer },
9661 .init_verbs = { alc882_base_init_verbs,
9662 alc882_adc1_init_verbs },
9663 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9664 .dac_nids = alc882_dac_nids,
9665 .dig_out_nid = ALC882_DIGOUT_NID,
9666 .dig_in_nid = ALC882_DIGIN_NID,
9667 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9668 .channel_mode = alc882_ch_modes,
9670 .input_mux = &alc882_capture_source,
9672 [ALC882_6ST_DIG] = {
9673 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9674 .init_verbs = { alc882_base_init_verbs,
9675 alc882_adc1_init_verbs },
9676 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9677 .dac_nids = alc882_dac_nids,
9678 .dig_out_nid = ALC882_DIGOUT_NID,
9679 .dig_in_nid = ALC882_DIGIN_NID,
9680 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9681 .channel_mode = alc882_sixstack_modes,
9682 .input_mux = &alc882_capture_source,
9685 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9686 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9687 alc882_eapd_verbs },
9688 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9689 .dac_nids = alc882_dac_nids,
9690 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9691 .channel_mode = alc882_sixstack_modes,
9692 .input_mux = &alc882_capture_source,
9695 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9696 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9697 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9698 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9699 .dac_nids = alc882_dac_nids,
9700 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9701 .channel_mode = alc880_threestack_modes,
9703 .input_mux = &alc882_capture_source,
9704 .dig_out_nid = ALC882_DIGOUT_NID,
9707 .mixers = { alc885_mba21_mixer },
9708 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9710 .dac_nids = alc882_dac_nids,
9711 .channel_mode = alc885_mba21_ch_modes,
9712 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9713 .input_mux = &alc882_capture_source,
9714 .unsol_event = alc_automute_amp_unsol_event,
9715 .setup = alc885_mba21_setup,
9716 .init_hook = alc_automute_amp,
9719 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9720 .init_verbs = { alc885_mbp3_init_verbs,
9721 alc880_gpio1_init_verbs },
9723 .dac_nids = alc882_dac_nids,
9725 .channel_mode = alc885_mbp_4ch_modes,
9726 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9727 .input_mux = &alc882_capture_source,
9728 .dig_out_nid = ALC882_DIGOUT_NID,
9729 .dig_in_nid = ALC882_DIGIN_NID,
9730 .unsol_event = alc_automute_amp_unsol_event,
9731 .setup = alc885_mbp3_setup,
9732 .init_hook = alc_automute_amp,
9735 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9736 .init_verbs = { alc885_mb5_init_verbs,
9737 alc880_gpio1_init_verbs },
9738 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9739 .dac_nids = alc882_dac_nids,
9740 .channel_mode = alc885_mb5_6ch_modes,
9741 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9742 .input_mux = &mb5_capture_source,
9743 .dig_out_nid = ALC882_DIGOUT_NID,
9744 .dig_in_nid = ALC882_DIGIN_NID,
9745 .unsol_event = alc_automute_amp_unsol_event,
9746 .setup = alc885_mb5_setup,
9747 .init_hook = alc_automute_amp,
9749 [ALC885_MACMINI3] = {
9750 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9751 .init_verbs = { alc885_macmini3_init_verbs,
9752 alc880_gpio1_init_verbs },
9753 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9754 .dac_nids = alc882_dac_nids,
9755 .channel_mode = alc885_macmini3_6ch_modes,
9756 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9757 .input_mux = &macmini3_capture_source,
9758 .dig_out_nid = ALC882_DIGOUT_NID,
9759 .dig_in_nid = ALC882_DIGIN_NID,
9760 .unsol_event = alc_automute_amp_unsol_event,
9761 .setup = alc885_macmini3_setup,
9762 .init_hook = alc_automute_amp,
9765 .mixers = { alc882_macpro_mixer },
9766 .init_verbs = { alc882_macpro_init_verbs },
9767 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9768 .dac_nids = alc882_dac_nids,
9769 .dig_out_nid = ALC882_DIGOUT_NID,
9770 .dig_in_nid = ALC882_DIGIN_NID,
9771 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9772 .channel_mode = alc882_ch_modes,
9773 .input_mux = &alc882_capture_source,
9774 .init_hook = alc885_macpro_init_hook,
9777 .mixers = { alc885_imac24_mixer },
9778 .init_verbs = { alc885_imac24_init_verbs },
9779 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9780 .dac_nids = alc882_dac_nids,
9781 .dig_out_nid = ALC882_DIGOUT_NID,
9782 .dig_in_nid = ALC882_DIGIN_NID,
9783 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9784 .channel_mode = alc882_ch_modes,
9785 .input_mux = &alc882_capture_source,
9786 .unsol_event = alc_automute_amp_unsol_event,
9787 .setup = alc885_imac24_setup,
9788 .init_hook = alc885_imac24_init_hook,
9791 .mixers = {alc885_imac91_mixer},
9792 .init_verbs = { alc885_imac91_init_verbs,
9793 alc880_gpio1_init_verbs },
9794 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9795 .dac_nids = alc882_dac_nids,
9796 .channel_mode = alc885_mba21_ch_modes,
9797 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9798 .input_mux = &alc889A_imac91_capture_source,
9799 .dig_out_nid = ALC882_DIGOUT_NID,
9800 .dig_in_nid = ALC882_DIGIN_NID,
9801 .unsol_event = alc_automute_amp_unsol_event,
9802 .setup = alc885_imac91_setup,
9803 .init_hook = alc_automute_amp,
9806 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9807 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9808 alc880_gpio3_init_verbs, alc882_targa_verbs},
9809 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9810 .dac_nids = alc882_dac_nids,
9811 .dig_out_nid = ALC882_DIGOUT_NID,
9812 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9813 .adc_nids = alc882_adc_nids,
9814 .capsrc_nids = alc882_capsrc_nids,
9815 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9816 .channel_mode = alc882_3ST_6ch_modes,
9818 .input_mux = &alc882_capture_source,
9819 .unsol_event = alc882_targa_unsol_event,
9820 .setup = alc882_targa_setup,
9821 .init_hook = alc882_targa_automute,
9823 [ALC882_ASUS_A7J] = {
9824 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9825 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9826 alc882_asus_a7j_verbs},
9827 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9828 .dac_nids = alc882_dac_nids,
9829 .dig_out_nid = ALC882_DIGOUT_NID,
9830 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9831 .adc_nids = alc882_adc_nids,
9832 .capsrc_nids = alc882_capsrc_nids,
9833 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9834 .channel_mode = alc882_3ST_6ch_modes,
9836 .input_mux = &alc882_capture_source,
9838 [ALC882_ASUS_A7M] = {
9839 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9840 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9841 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9842 alc882_asus_a7m_verbs },
9843 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9844 .dac_nids = alc882_dac_nids,
9845 .dig_out_nid = ALC882_DIGOUT_NID,
9846 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9847 .channel_mode = alc880_threestack_modes,
9849 .input_mux = &alc882_capture_source,
9851 [ALC883_3ST_2ch_DIG] = {
9852 .mixers = { alc883_3ST_2ch_mixer },
9853 .init_verbs = { alc883_init_verbs },
9854 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9855 .dac_nids = alc883_dac_nids,
9856 .dig_out_nid = ALC883_DIGOUT_NID,
9857 .dig_in_nid = ALC883_DIGIN_NID,
9858 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9859 .channel_mode = alc883_3ST_2ch_modes,
9860 .input_mux = &alc883_capture_source,
9862 [ALC883_3ST_6ch_DIG] = {
9863 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_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_6ch_modes),
9870 .channel_mode = alc883_3ST_6ch_modes,
9872 .input_mux = &alc883_capture_source,
9874 [ALC883_3ST_6ch] = {
9875 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9876 .init_verbs = { alc883_init_verbs },
9877 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9878 .dac_nids = alc883_dac_nids,
9879 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9880 .channel_mode = alc883_3ST_6ch_modes,
9882 .input_mux = &alc883_capture_source,
9884 [ALC883_3ST_6ch_INTEL] = {
9885 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9886 .init_verbs = { alc883_init_verbs },
9887 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9888 .dac_nids = alc883_dac_nids,
9889 .dig_out_nid = ALC883_DIGOUT_NID,
9890 .dig_in_nid = ALC883_DIGIN_NID,
9891 .slave_dig_outs = alc883_slave_dig_outs,
9892 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9893 .channel_mode = alc883_3ST_6ch_intel_modes,
9895 .input_mux = &alc883_3stack_6ch_intel,
9898 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9899 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9900 alc_hp15_unsol_verbs },
9901 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9902 .dac_nids = alc883_dac_nids,
9903 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9904 .adc_nids = alc889_adc_nids,
9905 .dig_out_nid = ALC883_DIGOUT_NID,
9906 .dig_in_nid = ALC883_DIGIN_NID,
9907 .slave_dig_outs = alc883_slave_dig_outs,
9908 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9909 .channel_mode = alc889_8ch_intel_modes,
9910 .capsrc_nids = alc889_capsrc_nids,
9911 .input_mux = &alc889_capture_source,
9912 .setup = alc889_automute_setup,
9913 .init_hook = alc_automute_amp,
9914 .unsol_event = alc_automute_amp_unsol_event,
9918 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9919 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9920 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9921 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9922 .dac_nids = alc883_dac_nids,
9923 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9924 .adc_nids = alc889_adc_nids,
9925 .dig_out_nid = ALC883_DIGOUT_NID,
9926 .dig_in_nid = ALC883_DIGIN_NID,
9927 .slave_dig_outs = alc883_slave_dig_outs,
9928 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9929 .channel_mode = alc889_8ch_intel_modes,
9930 .capsrc_nids = alc889_capsrc_nids,
9931 .input_mux = &alc889_capture_source,
9932 .setup = alc889_automute_setup,
9933 .init_hook = alc889_intel_init_hook,
9934 .unsol_event = alc_automute_amp_unsol_event,
9937 [ALC883_6ST_DIG] = {
9938 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9939 .init_verbs = { alc883_init_verbs },
9940 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9941 .dac_nids = alc883_dac_nids,
9942 .dig_out_nid = ALC883_DIGOUT_NID,
9943 .dig_in_nid = ALC883_DIGIN_NID,
9944 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9945 .channel_mode = alc883_sixstack_modes,
9946 .input_mux = &alc883_capture_source,
9948 [ALC883_TARGA_DIG] = {
9949 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9950 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9951 alc883_targa_verbs},
9952 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9953 .dac_nids = alc883_dac_nids,
9954 .dig_out_nid = ALC883_DIGOUT_NID,
9955 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9956 .channel_mode = alc883_3ST_6ch_modes,
9958 .input_mux = &alc883_capture_source,
9959 .unsol_event = alc883_targa_unsol_event,
9960 .setup = alc882_targa_setup,
9961 .init_hook = alc882_targa_automute,
9963 [ALC883_TARGA_2ch_DIG] = {
9964 .mixers = { alc883_targa_2ch_mixer},
9965 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9966 alc883_targa_verbs},
9967 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9968 .dac_nids = alc883_dac_nids,
9969 .adc_nids = alc883_adc_nids_alt,
9970 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9971 .capsrc_nids = alc883_capsrc_nids,
9972 .dig_out_nid = ALC883_DIGOUT_NID,
9973 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9974 .channel_mode = alc883_3ST_2ch_modes,
9975 .input_mux = &alc883_capture_source,
9976 .unsol_event = alc883_targa_unsol_event,
9977 .setup = alc882_targa_setup,
9978 .init_hook = alc882_targa_automute,
9980 [ALC883_TARGA_8ch_DIG] = {
9981 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9982 alc883_chmode_mixer },
9983 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9984 alc883_targa_verbs },
9985 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9986 .dac_nids = alc883_dac_nids,
9987 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9988 .adc_nids = alc883_adc_nids_rev,
9989 .capsrc_nids = alc883_capsrc_nids_rev,
9990 .dig_out_nid = ALC883_DIGOUT_NID,
9991 .dig_in_nid = ALC883_DIGIN_NID,
9992 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9993 .channel_mode = alc883_4ST_8ch_modes,
9995 .input_mux = &alc883_capture_source,
9996 .unsol_event = alc883_targa_unsol_event,
9997 .setup = alc882_targa_setup,
9998 .init_hook = alc882_targa_automute,
10001 .mixers = { alc883_base_mixer },
10002 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10003 * and the headphone jack. Turn this on and rely on the
10004 * standard mute methods whenever the user wants to turn
10005 * these outputs off.
10007 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10008 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10009 .dac_nids = alc883_dac_nids,
10010 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10011 .channel_mode = alc883_3ST_2ch_modes,
10012 .input_mux = &alc883_capture_source,
10014 [ALC883_ACER_ASPIRE] = {
10015 .mixers = { alc883_acer_aspire_mixer },
10016 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10018 .dac_nids = alc883_dac_nids,
10019 .dig_out_nid = ALC883_DIGOUT_NID,
10020 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10021 .channel_mode = alc883_3ST_2ch_modes,
10022 .input_mux = &alc883_capture_source,
10023 .unsol_event = alc_automute_amp_unsol_event,
10024 .setup = alc883_acer_aspire_setup,
10025 .init_hook = alc_automute_amp,
10027 [ALC888_ACER_ASPIRE_4930G] = {
10028 .mixers = { alc888_base_mixer,
10029 alc883_chmode_mixer },
10030 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10031 alc888_acer_aspire_4930g_verbs },
10032 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10033 .dac_nids = alc883_dac_nids,
10034 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10035 .adc_nids = alc883_adc_nids_rev,
10036 .capsrc_nids = alc883_capsrc_nids_rev,
10037 .dig_out_nid = ALC883_DIGOUT_NID,
10038 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10039 .channel_mode = alc883_3ST_6ch_modes,
10041 .const_channel_count = 6,
10043 ARRAY_SIZE(alc888_2_capture_sources),
10044 .input_mux = alc888_2_capture_sources,
10045 .unsol_event = alc_automute_amp_unsol_event,
10046 .setup = alc888_acer_aspire_4930g_setup,
10047 .init_hook = alc_automute_amp,
10049 [ALC888_ACER_ASPIRE_6530G] = {
10050 .mixers = { alc888_acer_aspire_6530_mixer },
10051 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10052 alc888_acer_aspire_6530g_verbs },
10053 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10054 .dac_nids = alc883_dac_nids,
10055 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10056 .adc_nids = alc883_adc_nids_rev,
10057 .capsrc_nids = alc883_capsrc_nids_rev,
10058 .dig_out_nid = ALC883_DIGOUT_NID,
10059 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10060 .channel_mode = alc883_3ST_2ch_modes,
10062 ARRAY_SIZE(alc888_2_capture_sources),
10063 .input_mux = alc888_acer_aspire_6530_sources,
10064 .unsol_event = alc_automute_amp_unsol_event,
10065 .setup = alc888_acer_aspire_6530g_setup,
10066 .init_hook = alc_automute_amp,
10068 [ALC888_ACER_ASPIRE_8930G] = {
10069 .mixers = { alc889_acer_aspire_8930g_mixer,
10070 alc883_chmode_mixer },
10071 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10072 alc889_acer_aspire_8930g_verbs,
10073 alc889_eapd_verbs},
10074 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10075 .dac_nids = alc883_dac_nids,
10076 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10077 .adc_nids = alc889_adc_nids,
10078 .capsrc_nids = alc889_capsrc_nids,
10079 .dig_out_nid = ALC883_DIGOUT_NID,
10080 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10081 .channel_mode = alc883_3ST_6ch_modes,
10083 .const_channel_count = 6,
10085 ARRAY_SIZE(alc889_capture_sources),
10086 .input_mux = alc889_capture_sources,
10087 .unsol_event = alc_automute_amp_unsol_event,
10088 .setup = alc889_acer_aspire_8930g_setup,
10089 .init_hook = alc_automute_amp,
10090 #ifdef CONFIG_SND_HDA_POWER_SAVE
10091 .power_hook = alc_power_eapd,
10094 [ALC888_ACER_ASPIRE_7730G] = {
10095 .mixers = { alc883_3ST_6ch_mixer,
10096 alc883_chmode_mixer },
10097 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10098 alc888_acer_aspire_7730G_verbs },
10099 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10100 .dac_nids = alc883_dac_nids,
10101 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10102 .adc_nids = alc883_adc_nids_rev,
10103 .capsrc_nids = alc883_capsrc_nids_rev,
10104 .dig_out_nid = ALC883_DIGOUT_NID,
10105 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10106 .channel_mode = alc883_3ST_6ch_modes,
10108 .const_channel_count = 6,
10109 .input_mux = &alc883_capture_source,
10110 .unsol_event = alc_automute_amp_unsol_event,
10111 .setup = alc888_acer_aspire_6530g_setup,
10112 .init_hook = alc_automute_amp,
10114 [ALC883_MEDION] = {
10115 .mixers = { alc883_fivestack_mixer,
10116 alc883_chmode_mixer },
10117 .init_verbs = { alc883_init_verbs,
10118 alc883_medion_eapd_verbs },
10119 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10120 .dac_nids = alc883_dac_nids,
10121 .adc_nids = alc883_adc_nids_alt,
10122 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10123 .capsrc_nids = alc883_capsrc_nids,
10124 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10125 .channel_mode = alc883_sixstack_modes,
10126 .input_mux = &alc883_capture_source,
10128 [ALC883_MEDION_MD2] = {
10129 .mixers = { alc883_medion_md2_mixer},
10130 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10131 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10132 .dac_nids = alc883_dac_nids,
10133 .dig_out_nid = ALC883_DIGOUT_NID,
10134 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10135 .channel_mode = alc883_3ST_2ch_modes,
10136 .input_mux = &alc883_capture_source,
10137 .unsol_event = alc_automute_amp_unsol_event,
10138 .setup = alc883_medion_md2_setup,
10139 .init_hook = alc_automute_amp,
10141 [ALC883_MEDION_WIM2160] = {
10142 .mixers = { alc883_medion_wim2160_mixer },
10143 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10144 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10145 .dac_nids = alc883_dac_nids,
10146 .dig_out_nid = ALC883_DIGOUT_NID,
10147 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10148 .adc_nids = alc883_adc_nids,
10149 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10150 .channel_mode = alc883_3ST_2ch_modes,
10151 .input_mux = &alc883_capture_source,
10152 .unsol_event = alc_automute_amp_unsol_event,
10153 .setup = alc883_medion_wim2160_setup,
10154 .init_hook = alc_automute_amp,
10156 [ALC883_LAPTOP_EAPD] = {
10157 .mixers = { alc883_base_mixer },
10158 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10159 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10160 .dac_nids = alc883_dac_nids,
10161 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10162 .channel_mode = alc883_3ST_2ch_modes,
10163 .input_mux = &alc883_capture_source,
10165 [ALC883_CLEVO_M540R] = {
10166 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10167 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10168 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10169 .dac_nids = alc883_dac_nids,
10170 .dig_out_nid = ALC883_DIGOUT_NID,
10171 .dig_in_nid = ALC883_DIGIN_NID,
10172 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10173 .channel_mode = alc883_3ST_6ch_clevo_modes,
10175 .input_mux = &alc883_capture_source,
10176 /* This machine has the hardware HP auto-muting, thus
10177 * we need no software mute via unsol event
10180 [ALC883_CLEVO_M720] = {
10181 .mixers = { alc883_clevo_m720_mixer },
10182 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10183 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10184 .dac_nids = alc883_dac_nids,
10185 .dig_out_nid = ALC883_DIGOUT_NID,
10186 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10187 .channel_mode = alc883_3ST_2ch_modes,
10188 .input_mux = &alc883_capture_source,
10189 .unsol_event = alc883_clevo_m720_unsol_event,
10190 .setup = alc883_clevo_m720_setup,
10191 .init_hook = alc883_clevo_m720_init_hook,
10193 [ALC883_LENOVO_101E_2ch] = {
10194 .mixers = { alc883_lenovo_101e_2ch_mixer},
10195 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10196 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10197 .dac_nids = alc883_dac_nids,
10198 .adc_nids = alc883_adc_nids_alt,
10199 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10200 .capsrc_nids = alc883_capsrc_nids,
10201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10202 .channel_mode = alc883_3ST_2ch_modes,
10203 .input_mux = &alc883_lenovo_101e_capture_source,
10204 .unsol_event = alc883_lenovo_101e_unsol_event,
10205 .init_hook = alc883_lenovo_101e_all_automute,
10207 [ALC883_LENOVO_NB0763] = {
10208 .mixers = { alc883_lenovo_nb0763_mixer },
10209 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10210 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10211 .dac_nids = alc883_dac_nids,
10212 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10213 .channel_mode = alc883_3ST_2ch_modes,
10215 .input_mux = &alc883_lenovo_nb0763_capture_source,
10216 .unsol_event = alc_automute_amp_unsol_event,
10217 .setup = alc883_medion_md2_setup,
10218 .init_hook = alc_automute_amp,
10220 [ALC888_LENOVO_MS7195_DIG] = {
10221 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10222 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10223 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10224 .dac_nids = alc883_dac_nids,
10225 .dig_out_nid = ALC883_DIGOUT_NID,
10226 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10227 .channel_mode = alc883_3ST_6ch_modes,
10229 .input_mux = &alc883_capture_source,
10230 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10231 .init_hook = alc888_lenovo_ms7195_front_automute,
10233 [ALC883_HAIER_W66] = {
10234 .mixers = { alc883_targa_2ch_mixer},
10235 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10237 .dac_nids = alc883_dac_nids,
10238 .dig_out_nid = ALC883_DIGOUT_NID,
10239 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10240 .channel_mode = alc883_3ST_2ch_modes,
10241 .input_mux = &alc883_capture_source,
10242 .unsol_event = alc_automute_amp_unsol_event,
10243 .setup = alc883_haier_w66_setup,
10244 .init_hook = alc_automute_amp,
10246 [ALC888_3ST_HP] = {
10247 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10248 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10249 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10250 .dac_nids = alc883_dac_nids,
10251 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10252 .channel_mode = alc888_3st_hp_modes,
10254 .input_mux = &alc883_capture_source,
10255 .unsol_event = alc_automute_amp_unsol_event,
10256 .setup = alc888_3st_hp_setup,
10257 .init_hook = alc_automute_amp,
10259 [ALC888_6ST_DELL] = {
10260 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10261 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10262 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10263 .dac_nids = alc883_dac_nids,
10264 .dig_out_nid = ALC883_DIGOUT_NID,
10265 .dig_in_nid = ALC883_DIGIN_NID,
10266 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10267 .channel_mode = alc883_sixstack_modes,
10268 .input_mux = &alc883_capture_source,
10269 .unsol_event = alc_automute_amp_unsol_event,
10270 .setup = alc888_6st_dell_setup,
10271 .init_hook = alc_automute_amp,
10274 .mixers = { alc883_mitac_mixer },
10275 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10276 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10277 .dac_nids = alc883_dac_nids,
10278 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10279 .channel_mode = alc883_3ST_2ch_modes,
10280 .input_mux = &alc883_capture_source,
10281 .unsol_event = alc_automute_amp_unsol_event,
10282 .setup = alc883_mitac_setup,
10283 .init_hook = alc_automute_amp,
10285 [ALC883_FUJITSU_PI2515] = {
10286 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10287 .init_verbs = { alc883_init_verbs,
10288 alc883_2ch_fujitsu_pi2515_verbs},
10289 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10290 .dac_nids = alc883_dac_nids,
10291 .dig_out_nid = ALC883_DIGOUT_NID,
10292 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10293 .channel_mode = alc883_3ST_2ch_modes,
10294 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10295 .unsol_event = alc_automute_amp_unsol_event,
10296 .setup = alc883_2ch_fujitsu_pi2515_setup,
10297 .init_hook = alc_automute_amp,
10299 [ALC888_FUJITSU_XA3530] = {
10300 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10301 .init_verbs = { alc883_init_verbs,
10302 alc888_fujitsu_xa3530_verbs },
10303 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10304 .dac_nids = alc883_dac_nids,
10305 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10306 .adc_nids = alc883_adc_nids_rev,
10307 .capsrc_nids = alc883_capsrc_nids_rev,
10308 .dig_out_nid = ALC883_DIGOUT_NID,
10309 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10310 .channel_mode = alc888_4ST_8ch_intel_modes,
10312 ARRAY_SIZE(alc888_2_capture_sources),
10313 .input_mux = alc888_2_capture_sources,
10314 .unsol_event = alc_automute_amp_unsol_event,
10315 .setup = alc888_fujitsu_xa3530_setup,
10316 .init_hook = alc_automute_amp,
10318 [ALC888_LENOVO_SKY] = {
10319 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10320 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10321 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10322 .dac_nids = alc883_dac_nids,
10323 .dig_out_nid = ALC883_DIGOUT_NID,
10324 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10325 .channel_mode = alc883_sixstack_modes,
10327 .input_mux = &alc883_lenovo_sky_capture_source,
10328 .unsol_event = alc_automute_amp_unsol_event,
10329 .setup = alc888_lenovo_sky_setup,
10330 .init_hook = alc_automute_amp,
10332 [ALC888_ASUS_M90V] = {
10333 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10334 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10335 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10336 .dac_nids = alc883_dac_nids,
10337 .dig_out_nid = ALC883_DIGOUT_NID,
10338 .dig_in_nid = ALC883_DIGIN_NID,
10339 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10340 .channel_mode = alc883_3ST_6ch_modes,
10342 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10343 .unsol_event = alc_sku_unsol_event,
10344 .setup = alc883_mode2_setup,
10345 .init_hook = alc_inithook,
10347 [ALC888_ASUS_EEE1601] = {
10348 .mixers = { alc883_asus_eee1601_mixer },
10349 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10350 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10352 .dac_nids = alc883_dac_nids,
10353 .dig_out_nid = ALC883_DIGOUT_NID,
10354 .dig_in_nid = ALC883_DIGIN_NID,
10355 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10356 .channel_mode = alc883_3ST_2ch_modes,
10358 .input_mux = &alc883_asus_eee1601_capture_source,
10359 .unsol_event = alc_sku_unsol_event,
10360 .init_hook = alc883_eee1601_inithook,
10362 [ALC1200_ASUS_P5Q] = {
10363 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10364 .init_verbs = { alc883_init_verbs },
10365 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10366 .dac_nids = alc883_dac_nids,
10367 .dig_out_nid = ALC1200_DIGOUT_NID,
10368 .dig_in_nid = ALC883_DIGIN_NID,
10369 .slave_dig_outs = alc1200_slave_dig_outs,
10370 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10371 .channel_mode = alc883_sixstack_modes,
10372 .input_mux = &alc883_capture_source,
10375 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10376 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10377 alc880_gpio1_init_verbs },
10378 .adc_nids = alc883_adc_nids,
10379 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10380 .capsrc_nids = alc883_capsrc_nids,
10381 .dac_nids = alc883_dac_nids,
10382 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10383 .channel_mode = alc889A_mb31_6ch_modes,
10384 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10385 .input_mux = &alc889A_mb31_capture_source,
10386 .dig_out_nid = ALC883_DIGOUT_NID,
10387 .unsol_event = alc889A_mb31_unsol_event,
10388 .init_hook = alc889A_mb31_automute,
10390 [ALC883_SONY_VAIO_TT] = {
10391 .mixers = { alc883_vaiott_mixer },
10392 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10394 .dac_nids = alc883_dac_nids,
10395 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10396 .channel_mode = alc883_3ST_2ch_modes,
10397 .input_mux = &alc883_capture_source,
10398 .unsol_event = alc_automute_amp_unsol_event,
10399 .setup = alc883_vaiott_setup,
10400 .init_hook = alc_automute_amp,
10409 PINFIX_ABIT_AW9D_MAX
10412 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
10413 { 0x15, 0x01080104 }, /* side */
10414 { 0x16, 0x01011012 }, /* rear */
10415 { 0x17, 0x01016011 }, /* clfe */
10419 static const struct alc_fixup alc882_fixups[] = {
10420 [PINFIX_ABIT_AW9D_MAX] = {
10421 .pins = alc882_abit_aw9d_pinfix
10425 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10426 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10431 * BIOS auto configuration
10433 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10434 const struct auto_pin_cfg *cfg)
10436 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10439 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10440 hda_nid_t nid, int pin_type,
10445 /* set as output */
10446 alc_set_pin_output(codec, nid, pin_type);
10450 else if (dac >= 0x02 && dac <= 0x05)
10454 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10457 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10459 struct alc_spec *spec = codec->spec;
10462 for (i = 0; i <= HDA_SIDE; i++) {
10463 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10464 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10466 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10467 spec->multiout.dac_nids[i]);
10471 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10473 struct alc_spec *spec = codec->spec;
10474 hda_nid_t pin, dac;
10476 pin = spec->autocfg.hp_pins[0];
10478 dac = spec->multiout.hp_nid;
10480 dac = spec->multiout.dac_nids[0]; /* to front */
10481 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10483 pin = spec->autocfg.speaker_pins[0];
10485 dac = spec->multiout.extra_out_nid[0];
10487 dac = spec->multiout.dac_nids[0]; /* to front */
10488 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10492 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10494 struct alc_spec *spec = codec->spec;
10497 for (i = 0; i < AUTO_PIN_LAST; i++) {
10498 hda_nid_t nid = spec->autocfg.input_pins[i];
10501 alc_set_input_pin(codec, nid, i);
10502 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10503 snd_hda_codec_write(codec, nid, 0,
10504 AC_VERB_SET_AMP_GAIN_MUTE,
10509 static void alc882_auto_init_input_src(struct hda_codec *codec)
10511 struct alc_spec *spec = codec->spec;
10514 for (c = 0; c < spec->num_adc_nids; c++) {
10515 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10516 hda_nid_t nid = spec->capsrc_nids[c];
10517 unsigned int mux_idx;
10518 const struct hda_input_mux *imux;
10519 int conns, mute, idx, item;
10521 conns = snd_hda_get_connections(codec, nid, conn_list,
10522 ARRAY_SIZE(conn_list));
10525 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10526 imux = &spec->input_mux[mux_idx];
10527 if (!imux->num_items && mux_idx > 0)
10528 imux = &spec->input_mux[0];
10529 for (idx = 0; idx < conns; idx++) {
10530 /* if the current connection is the selected one,
10531 * unmute it as default - otherwise mute it
10533 mute = AMP_IN_MUTE(idx);
10534 for (item = 0; item < imux->num_items; item++) {
10535 if (imux->items[item].index == idx) {
10536 if (spec->cur_mux[c] == item)
10537 mute = AMP_IN_UNMUTE(idx);
10541 /* check if we have a selector or mixer
10542 * we could check for the widget type instead, but
10543 * just check for Amp-In presence (in case of mixer
10544 * without amp-in there is something wrong, this
10545 * function shouldn't be used or capsrc nid is wrong)
10547 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10548 snd_hda_codec_write(codec, nid, 0,
10549 AC_VERB_SET_AMP_GAIN_MUTE,
10551 else if (mute != AMP_IN_MUTE(idx))
10552 snd_hda_codec_write(codec, nid, 0,
10553 AC_VERB_SET_CONNECT_SEL,
10559 /* add mic boosts if needed */
10560 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10562 struct alc_spec *spec = codec->spec;
10566 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10567 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10568 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10570 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10574 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10575 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10576 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10578 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10585 /* almost identical with ALC880 parser... */
10586 static int alc882_parse_auto_config(struct hda_codec *codec)
10588 struct alc_spec *spec = codec->spec;
10589 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10592 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10596 if (!spec->autocfg.line_outs)
10597 return 0; /* can't find valid BIOS pin config */
10599 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10602 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10605 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10609 err = alc880_auto_create_extra_out(spec,
10610 spec->autocfg.speaker_pins[0],
10614 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10618 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10620 alc_auto_parse_digital(codec);
10622 if (spec->kctls.list)
10623 add_mixer(spec, spec->kctls.list);
10625 add_verb(spec, alc883_auto_init_verbs);
10626 /* if ADC 0x07 is available, initialize it, too */
10627 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10628 add_verb(spec, alc882_adc1_init_verbs);
10630 spec->num_mux_defs = 1;
10631 spec->input_mux = &spec->private_imux[0];
10633 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10635 err = alc_auto_add_mic_boost(codec);
10639 return 1; /* config found */
10642 /* additional initialization for auto-configuration model */
10643 static void alc882_auto_init(struct hda_codec *codec)
10645 struct alc_spec *spec = codec->spec;
10646 alc882_auto_init_multi_out(codec);
10647 alc882_auto_init_hp_out(codec);
10648 alc882_auto_init_analog_input(codec);
10649 alc882_auto_init_input_src(codec);
10650 alc_auto_init_digital(codec);
10651 if (spec->unsol_event)
10652 alc_inithook(codec);
10655 static int patch_alc882(struct hda_codec *codec)
10657 struct alc_spec *spec;
10658 int err, board_config;
10660 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10664 codec->spec = spec;
10666 alc_auto_parse_customize_define(codec);
10668 switch (codec->vendor_id) {
10673 /* ALC883 and variants */
10674 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10678 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10682 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10683 board_config = snd_hda_check_board_codec_sid_config(codec,
10684 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10686 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10687 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10689 board_config = ALC882_AUTO;
10692 if (board_config == ALC882_AUTO)
10693 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10695 if (board_config == ALC882_AUTO) {
10696 /* automatic parse from the BIOS config */
10697 err = alc882_parse_auto_config(codec);
10703 "hda_codec: Cannot set up configuration "
10704 "from BIOS. Using base mode...\n");
10705 board_config = ALC882_3ST_DIG;
10709 if (has_cdefine_beep(codec)) {
10710 err = snd_hda_attach_beep_device(codec, 0x1);
10717 if (board_config != ALC882_AUTO)
10718 setup_preset(codec, &alc882_presets[board_config]);
10720 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10721 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10722 /* FIXME: setup DAC5 */
10723 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10724 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10726 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10727 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10729 if (!spec->adc_nids && spec->input_mux) {
10731 spec->num_adc_nids = 0;
10732 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10733 const struct hda_input_mux *imux = spec->input_mux;
10735 hda_nid_t items[16];
10736 hda_nid_t nid = alc882_adc_nids[i];
10737 unsigned int wcap = get_wcaps(codec, nid);
10739 wcap = get_wcaps_type(wcap);
10740 if (wcap != AC_WID_AUD_IN)
10742 spec->private_adc_nids[spec->num_adc_nids] = nid;
10743 err = snd_hda_get_connections(codec, nid, &cap, 1);
10746 err = snd_hda_get_connections(codec, cap, items,
10747 ARRAY_SIZE(items));
10750 for (j = 0; j < imux->num_items; j++)
10751 if (imux->items[j].index >= err)
10753 if (j < imux->num_items)
10755 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10756 spec->num_adc_nids++;
10758 spec->adc_nids = spec->private_adc_nids;
10759 spec->capsrc_nids = spec->private_capsrc_nids;
10762 set_capture_mixer(codec);
10764 if (has_cdefine_beep(codec))
10765 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10767 if (board_config == ALC882_AUTO)
10768 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10770 spec->vmaster_nid = 0x0c;
10772 codec->patch_ops = alc_patch_ops;
10773 if (board_config == ALC882_AUTO)
10774 spec->init_hook = alc882_auto_init;
10775 #ifdef CONFIG_SND_HDA_POWER_SAVE
10776 if (!spec->loopback.amplist)
10777 spec->loopback.amplist = alc882_loopbacks;
10788 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10789 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10791 #define alc262_dac_nids alc260_dac_nids
10792 #define alc262_adc_nids alc882_adc_nids
10793 #define alc262_adc_nids_alt alc882_adc_nids_alt
10794 #define alc262_capsrc_nids alc882_capsrc_nids
10795 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10797 #define alc262_modes alc260_modes
10798 #define alc262_capture_source alc882_capture_source
10800 static hda_nid_t alc262_dmic_adc_nids[1] = {
10805 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10807 static struct snd_kcontrol_new alc262_base_mixer[] = {
10808 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10809 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10810 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10811 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10812 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10813 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10817 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10819 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10820 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10822 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10823 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10827 /* update HP, line and mono-out pins according to the master switch */
10828 static void alc262_hp_master_update(struct hda_codec *codec)
10830 struct alc_spec *spec = codec->spec;
10831 int val = spec->master_sw;
10833 /* HP & line-out */
10834 snd_hda_codec_write_cache(codec, 0x1b, 0,
10835 AC_VERB_SET_PIN_WIDGET_CONTROL,
10837 snd_hda_codec_write_cache(codec, 0x15, 0,
10838 AC_VERB_SET_PIN_WIDGET_CONTROL,
10840 /* mono (speaker) depending on the HP jack sense */
10841 val = val && !spec->jack_present;
10842 snd_hda_codec_write_cache(codec, 0x16, 0,
10843 AC_VERB_SET_PIN_WIDGET_CONTROL,
10844 val ? PIN_OUT : 0);
10847 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10849 struct alc_spec *spec = codec->spec;
10851 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10852 alc262_hp_master_update(codec);
10855 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10857 if ((res >> 26) != ALC880_HP_EVENT)
10859 alc262_hp_bpc_automute(codec);
10862 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10864 struct alc_spec *spec = codec->spec;
10866 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10867 alc262_hp_master_update(codec);
10870 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10873 if ((res >> 26) != ALC880_HP_EVENT)
10875 alc262_hp_wildwest_automute(codec);
10878 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10880 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10881 struct snd_ctl_elem_value *ucontrol)
10883 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10884 struct alc_spec *spec = codec->spec;
10885 int val = !!*ucontrol->value.integer.value;
10887 if (val == spec->master_sw)
10889 spec->master_sw = val;
10890 alc262_hp_master_update(codec);
10894 #define ALC262_HP_MASTER_SWITCH \
10896 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10897 .name = "Master Playback Switch", \
10898 .info = snd_ctl_boolean_mono_info, \
10899 .get = alc262_hp_master_sw_get, \
10900 .put = alc262_hp_master_sw_put, \
10903 .iface = NID_MAPPING, \
10904 .name = "Master Playback Switch", \
10905 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10909 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10910 ALC262_HP_MASTER_SWITCH,
10911 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10912 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10914 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10916 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10918 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10920 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10921 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10922 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10923 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10924 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10925 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10928 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10929 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10933 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10934 ALC262_HP_MASTER_SWITCH,
10935 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10936 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10937 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10939 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10941 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10943 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10944 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10945 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10946 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10947 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10948 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10949 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10953 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10954 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10955 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10956 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10960 /* mute/unmute internal speaker according to the hp jack and mute state */
10961 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10963 struct alc_spec *spec = codec->spec;
10965 spec->autocfg.hp_pins[0] = 0x15;
10966 spec->autocfg.speaker_pins[0] = 0x14;
10969 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10971 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10980 static struct hda_verb alc262_hp_t5735_verbs[] = {
10981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10984 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10988 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10989 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10992 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10998 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10999 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11002 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11003 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11004 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11006 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11008 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11012 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11019 /* bind hp and internal speaker mute (with plug check) as master switch */
11020 static void alc262_hippo_master_update(struct hda_codec *codec)
11022 struct alc_spec *spec = codec->spec;
11023 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11024 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11025 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11029 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11030 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11031 HDA_AMP_MUTE, mute);
11032 /* mute internal speaker per jack sense */
11033 if (spec->jack_present)
11034 mute = HDA_AMP_MUTE;
11036 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11037 HDA_AMP_MUTE, mute);
11038 if (speaker_nid && speaker_nid != line_nid)
11039 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11040 HDA_AMP_MUTE, mute);
11043 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11045 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11046 struct snd_ctl_elem_value *ucontrol)
11048 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11049 struct alc_spec *spec = codec->spec;
11050 int val = !!*ucontrol->value.integer.value;
11052 if (val == spec->master_sw)
11054 spec->master_sw = val;
11055 alc262_hippo_master_update(codec);
11059 #define ALC262_HIPPO_MASTER_SWITCH \
11061 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11062 .name = "Master Playback Switch", \
11063 .info = snd_ctl_boolean_mono_info, \
11064 .get = alc262_hippo_master_sw_get, \
11065 .put = alc262_hippo_master_sw_put, \
11068 .iface = NID_MAPPING, \
11069 .name = "Master Playback Switch", \
11070 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11071 (SUBDEV_SPEAKER(0) << 16), \
11074 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11075 ALC262_HIPPO_MASTER_SWITCH,
11076 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11079 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11080 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11084 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11085 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11086 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11087 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11091 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11092 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11093 ALC262_HIPPO_MASTER_SWITCH,
11094 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11095 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11096 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11097 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11101 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11103 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11107 /* mute/unmute internal speaker according to the hp jack and mute state */
11108 static void alc262_hippo_automute(struct hda_codec *codec)
11110 struct alc_spec *spec = codec->spec;
11111 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11113 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11114 alc262_hippo_master_update(codec);
11117 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11119 if ((res >> 26) != ALC880_HP_EVENT)
11121 alc262_hippo_automute(codec);
11124 static void alc262_hippo_setup(struct hda_codec *codec)
11126 struct alc_spec *spec = codec->spec;
11128 spec->autocfg.hp_pins[0] = 0x15;
11129 spec->autocfg.speaker_pins[0] = 0x14;
11132 static void alc262_hippo1_setup(struct hda_codec *codec)
11134 struct alc_spec *spec = codec->spec;
11136 spec->autocfg.hp_pins[0] = 0x1b;
11137 spec->autocfg.speaker_pins[0] = 0x14;
11141 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11142 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11143 ALC262_HIPPO_MASTER_SWITCH,
11144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11146 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11147 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11151 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11152 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11153 ALC262_HIPPO_MASTER_SWITCH,
11154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11157 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11158 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11162 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11163 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11164 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11165 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11166 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11167 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11168 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11171 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11172 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11174 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11178 static struct hda_verb alc262_tyan_verbs[] = {
11179 /* Headphone automute */
11180 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11181 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11182 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11184 /* P11 AUX_IN, white 4-pin connector */
11185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11186 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11187 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11188 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11193 /* unsolicited event for HP jack sensing */
11194 static void alc262_tyan_setup(struct hda_codec *codec)
11196 struct alc_spec *spec = codec->spec;
11198 spec->autocfg.hp_pins[0] = 0x1b;
11199 spec->autocfg.speaker_pins[0] = 0x15;
11203 #define alc262_capture_mixer alc882_capture_mixer
11204 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11207 * generic initialization of ADC, input mixers and output mixers
11209 static struct hda_verb alc262_init_verbs[] = {
11211 * Unmute ADC0-2 and set the default input to mic-in
11213 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11214 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11215 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11216 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11217 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11220 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11222 * Note: PASD motherboards uses the Line In 2 as the input for
11223 * front panel mic (mic 2)
11225 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11233 * Set up output mixers (0x0c - 0x0e)
11235 /* set vol=0 to output mixers */
11236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11238 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11239 /* set up input amps for analog loopback */
11240 /* Amp Indices: DAC = 0, mixer = 1 */
11241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11244 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11245 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11246 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11248 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11249 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11251 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11253 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11255 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11258 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11259 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11261 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11262 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11264 /* FIXME: use matrix-type input source selection */
11265 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11266 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11267 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11268 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11269 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11272 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11273 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11274 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11275 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11278 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11279 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11280 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11285 static struct hda_verb alc262_eapd_verbs[] = {
11286 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11287 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11291 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11292 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11293 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11294 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11296 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11297 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11301 static struct hda_verb alc262_sony_unsol_verbs[] = {
11302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11303 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11304 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11306 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11311 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11312 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11313 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11320 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11321 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11324 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11325 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11327 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11328 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11332 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11334 struct alc_spec *spec = codec->spec;
11336 spec->autocfg.hp_pins[0] = 0x15;
11337 spec->autocfg.speaker_pins[0] = 0x14;
11338 spec->ext_mic.pin = 0x18;
11339 spec->ext_mic.mux_idx = 0;
11340 spec->int_mic.pin = 0x12;
11341 spec->int_mic.mux_idx = 9;
11342 spec->auto_mic = 1;
11348 * 0x16 = internal speaker
11349 * 0x18 = external mic
11352 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11353 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11354 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11358 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11361 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11365 static struct hda_verb alc262_nec_verbs[] = {
11366 /* Unmute Speaker */
11367 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11370 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11371 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11373 /* External mic to headphone */
11374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11375 /* External mic to speaker */
11376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11382 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11383 * 0x1b = port replicator headphone out
11386 #define ALC_HP_EVENT 0x37
11388 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11389 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11390 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11391 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11392 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11396 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11397 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11398 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11402 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11403 /* Front Mic pin: input vref at 50% */
11404 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11405 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11409 static struct hda_input_mux alc262_fujitsu_capture_source = {
11413 { "Int Mic", 0x1 },
11418 static struct hda_input_mux alc262_HP_capture_source = {
11422 { "Front Mic", 0x1 },
11429 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11433 { "Front Mic", 0x2 },
11439 /* mute/unmute internal speaker according to the hp jacks and mute state */
11440 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11442 struct alc_spec *spec = codec->spec;
11445 if (force || !spec->sense_updated) {
11446 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11447 snd_hda_jack_detect(codec, 0x1b);
11448 spec->sense_updated = 1;
11450 /* unmute internal speaker only if both HPs are unplugged and
11451 * master switch is on
11453 if (spec->jack_present)
11454 mute = HDA_AMP_MUTE;
11456 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11457 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11458 HDA_AMP_MUTE, mute);
11461 /* unsolicited event for HP jack sensing */
11462 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11465 if ((res >> 26) != ALC_HP_EVENT)
11467 alc262_fujitsu_automute(codec, 1);
11470 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11472 alc262_fujitsu_automute(codec, 1);
11475 /* bind volumes of both NID 0x0c and 0x0d */
11476 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11477 .ops = &snd_hda_bind_vol,
11479 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11480 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11485 /* mute/unmute internal speaker according to the hp jack and mute state */
11486 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11488 struct alc_spec *spec = codec->spec;
11491 if (force || !spec->sense_updated) {
11492 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11493 spec->sense_updated = 1;
11495 if (spec->jack_present) {
11496 /* mute internal speaker */
11497 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11498 HDA_AMP_MUTE, HDA_AMP_MUTE);
11499 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11500 HDA_AMP_MUTE, HDA_AMP_MUTE);
11502 /* unmute internal speaker if necessary */
11503 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11504 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11505 HDA_AMP_MUTE, mute);
11506 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11507 HDA_AMP_MUTE, mute);
11511 /* unsolicited event for HP jack sensing */
11512 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11515 if ((res >> 26) != ALC_HP_EVENT)
11517 alc262_lenovo_3000_automute(codec, 1);
11520 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11521 int dir, int idx, long *valp)
11525 for (i = 0; i < 2; i++, valp++)
11526 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11528 *valp ? 0 : HDA_AMP_MUTE);
11532 /* bind hp and internal speaker mute (with plug check) */
11533 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11534 struct snd_ctl_elem_value *ucontrol)
11536 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11537 long *valp = ucontrol->value.integer.value;
11540 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11541 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11543 alc262_fujitsu_automute(codec, 0);
11547 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11548 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11550 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11551 .name = "Master Playback Switch",
11552 .subdevice = HDA_SUBDEV_AMP_FLAG,
11553 .info = snd_hda_mixer_amp_switch_info,
11554 .get = snd_hda_mixer_amp_switch_get,
11555 .put = alc262_fujitsu_master_sw_put,
11556 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11559 .iface = NID_MAPPING,
11560 .name = "Master Playback Switch",
11561 .private_value = 0x1b,
11563 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11564 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11565 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11568 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11569 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11570 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11574 /* bind hp and internal speaker mute (with plug check) */
11575 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11576 struct snd_ctl_elem_value *ucontrol)
11578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11579 long *valp = ucontrol->value.integer.value;
11582 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11584 alc262_lenovo_3000_automute(codec, 0);
11588 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11589 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11591 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11592 .name = "Master Playback Switch",
11593 .subdevice = HDA_SUBDEV_AMP_FLAG,
11594 .info = snd_hda_mixer_amp_switch_info,
11595 .get = snd_hda_mixer_amp_switch_get,
11596 .put = alc262_lenovo_3000_master_sw_put,
11597 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11599 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11600 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11601 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11604 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11605 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11606 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11610 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11611 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11612 ALC262_HIPPO_MASTER_SWITCH,
11613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11615 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11616 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11617 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11618 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11622 /* additional init verbs for Benq laptops */
11623 static struct hda_verb alc262_EAPD_verbs[] = {
11624 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11625 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11629 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11633 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11634 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11638 /* Samsung Q1 Ultra Vista model setup */
11639 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11640 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11641 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11644 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11645 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11649 static struct hda_verb alc262_ultra_verbs[] = {
11651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11656 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11657 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11658 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11661 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11663 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11664 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11666 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11667 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11668 /* ADC, choose mic */
11669 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11670 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11677 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11678 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11682 /* mute/unmute internal speaker according to the hp jack and mute state */
11683 static void alc262_ultra_automute(struct hda_codec *codec)
11685 struct alc_spec *spec = codec->spec;
11689 /* auto-mute only when HP is used as HP */
11690 if (!spec->cur_mux[0]) {
11691 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11692 if (spec->jack_present)
11693 mute = HDA_AMP_MUTE;
11695 /* mute/unmute internal speaker */
11696 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11697 HDA_AMP_MUTE, mute);
11698 /* mute/unmute HP */
11699 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11700 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11703 /* unsolicited event for HP jack sensing */
11704 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11707 if ((res >> 26) != ALC880_HP_EVENT)
11709 alc262_ultra_automute(codec);
11712 static struct hda_input_mux alc262_ultra_capture_source = {
11716 { "Headphone", 0x7 },
11720 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11721 struct snd_ctl_elem_value *ucontrol)
11723 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11724 struct alc_spec *spec = codec->spec;
11727 ret = alc_mux_enum_put(kcontrol, ucontrol);
11730 /* reprogram the HP pin as mic or HP according to the input source */
11731 snd_hda_codec_write_cache(codec, 0x15, 0,
11732 AC_VERB_SET_PIN_WIDGET_CONTROL,
11733 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11734 alc262_ultra_automute(codec); /* mute/unmute HP */
11738 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11739 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11740 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11743 .name = "Capture Source",
11744 .info = alc_mux_enum_info,
11745 .get = alc_mux_enum_get,
11746 .put = alc262_ultra_mux_enum_put,
11749 .iface = NID_MAPPING,
11750 .name = "Capture Source",
11751 .private_value = 0x15,
11756 /* We use two mixers depending on the output pin; 0x16 is a mono output
11757 * and thus it's bound with a different mixer.
11758 * This function returns which mixer amp should be used.
11760 static int alc262_check_volbit(hda_nid_t nid)
11764 else if (nid == 0x16)
11770 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11771 const char *pfx, int *vbits)
11776 vbit = alc262_check_volbit(nid);
11779 if (*vbits & vbit) /* a volume control for this mixer already there */
11783 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11785 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11786 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11789 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11797 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11799 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11800 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11803 /* add playback controls from the parsed DAC table */
11804 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11805 const struct auto_pin_cfg *cfg)
11811 spec->multiout.num_dacs = 1; /* only use one dac */
11812 spec->multiout.dac_nids = spec->private_dac_nids;
11813 spec->multiout.dac_nids[0] = 2;
11815 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11817 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11821 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11824 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11827 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11831 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11832 alc262_check_volbit(cfg->speaker_pins[0]) |
11833 alc262_check_volbit(cfg->hp_pins[0]);
11834 if (vbits == 1 || vbits == 2)
11835 pfx = "Master"; /* only one mixer is used */
11836 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11841 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11844 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11848 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11855 #define alc262_auto_create_input_ctls \
11856 alc882_auto_create_input_ctls
11859 * generic initialization of ADC, input mixers and output mixers
11861 static struct hda_verb alc262_volume_init_verbs[] = {
11863 * Unmute ADC0-2 and set the default input to mic-in
11865 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11867 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11869 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11872 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11874 * Note: PASD motherboards uses the Line In 2 as the input for
11875 * front panel mic (mic 2)
11877 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11885 * Set up output mixers (0x0c - 0x0f)
11887 /* set vol=0 to output mixers */
11888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11892 /* set up input amps for analog loopback */
11893 /* Amp Indices: DAC = 0, mixer = 1 */
11894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11897 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11899 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11901 /* FIXME: use matrix-type input source selection */
11902 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11903 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11910 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11911 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11912 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11922 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11924 * Unmute ADC0-2 and set the default input to mic-in
11926 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11928 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11929 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11930 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11933 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11935 * Note: PASD motherboards uses the Line In 2 as the input for
11936 * front panel mic (mic 2)
11938 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11940 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11941 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11948 * Set up output mixers (0x0c - 0x0e)
11950 /* set vol=0 to output mixers */
11951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11953 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11955 /* set up input amps for analog loopback */
11956 /* Amp Indices: DAC = 0, mixer = 1 */
11957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11968 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11971 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11975 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11978 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11981 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11982 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11983 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11984 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11985 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11988 /* FIXME: use matrix-type input source selection */
11989 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11990 /* Input mixer1: only unmute Mic */
11991 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11992 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11994 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11996 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12001 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12008 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12021 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12026 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12028 * Unmute ADC0-2 and set the default input to mic-in
12030 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12032 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12033 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12034 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12035 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12037 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12039 * Note: PASD motherboards uses the Line In 2 as the input for front
12040 * panel mic (mic 2)
12042 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12052 * Set up output mixers (0x0c - 0x0e)
12054 /* set vol=0 to output mixers */
12055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12059 /* set up input amps for analog loopback */
12060 /* Amp Indices: DAC = 0, mixer = 1 */
12061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12071 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12075 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12077 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12078 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12080 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12083 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12084 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12085 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12087 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12088 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12090 /* FIXME: use matrix-type input source selection */
12091 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12092 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12098 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12103 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12106 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12114 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12117 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12122 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12126 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12128 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12129 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12131 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12134 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12135 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12140 #ifdef CONFIG_SND_HDA_POWER_SAVE
12141 #define alc262_loopbacks alc880_loopbacks
12144 /* pcm configuration: identical with ALC880 */
12145 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12146 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12147 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12148 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12151 * BIOS auto configuration
12153 static int alc262_parse_auto_config(struct hda_codec *codec)
12155 struct alc_spec *spec = codec->spec;
12157 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12159 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12163 if (!spec->autocfg.line_outs) {
12164 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12165 spec->multiout.max_channels = 2;
12166 spec->no_analog = 1;
12169 return 0; /* can't find valid BIOS pin config */
12171 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12174 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12178 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12181 alc_auto_parse_digital(codec);
12183 if (spec->kctls.list)
12184 add_mixer(spec, spec->kctls.list);
12186 add_verb(spec, alc262_volume_init_verbs);
12187 spec->num_mux_defs = 1;
12188 spec->input_mux = &spec->private_imux[0];
12190 err = alc_auto_add_mic_boost(codec);
12194 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12199 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12200 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12201 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12202 #define alc262_auto_init_input_src alc882_auto_init_input_src
12205 /* init callback for auto-configuration model -- overriding the default init */
12206 static void alc262_auto_init(struct hda_codec *codec)
12208 struct alc_spec *spec = codec->spec;
12209 alc262_auto_init_multi_out(codec);
12210 alc262_auto_init_hp_out(codec);
12211 alc262_auto_init_analog_input(codec);
12212 alc262_auto_init_input_src(codec);
12213 alc_auto_init_digital(codec);
12214 if (spec->unsol_event)
12215 alc_inithook(codec);
12219 * configuration and preset
12221 static const char *alc262_models[ALC262_MODEL_LAST] = {
12222 [ALC262_BASIC] = "basic",
12223 [ALC262_HIPPO] = "hippo",
12224 [ALC262_HIPPO_1] = "hippo_1",
12225 [ALC262_FUJITSU] = "fujitsu",
12226 [ALC262_HP_BPC] = "hp-bpc",
12227 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12228 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12229 [ALC262_HP_RP5700] = "hp-rp5700",
12230 [ALC262_BENQ_ED8] = "benq",
12231 [ALC262_BENQ_T31] = "benq-t31",
12232 [ALC262_SONY_ASSAMD] = "sony-assamd",
12233 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12234 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12235 [ALC262_ULTRA] = "ultra",
12236 [ALC262_LENOVO_3000] = "lenovo-3000",
12237 [ALC262_NEC] = "nec",
12238 [ALC262_TYAN] = "tyan",
12239 [ALC262_AUTO] = "auto",
12242 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12243 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12244 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12245 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12247 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12249 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12251 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12252 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12253 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12254 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12255 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12256 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12257 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12258 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12259 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12260 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12261 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12262 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12263 ALC262_HP_TC_T5735),
12264 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12265 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12266 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12267 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12268 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12269 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12270 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12271 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12272 #if 0 /* disable the quirk since model=auto works better in recent versions */
12273 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12274 ALC262_SONY_ASSAMD),
12276 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12277 ALC262_TOSHIBA_RX1),
12278 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12279 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12280 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12281 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12282 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12284 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12285 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12286 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12287 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12288 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12292 static struct alc_config_preset alc262_presets[] = {
12294 .mixers = { alc262_base_mixer },
12295 .init_verbs = { alc262_init_verbs },
12296 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12297 .dac_nids = alc262_dac_nids,
12299 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12300 .channel_mode = alc262_modes,
12301 .input_mux = &alc262_capture_source,
12304 .mixers = { alc262_hippo_mixer },
12305 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12306 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12307 .dac_nids = alc262_dac_nids,
12309 .dig_out_nid = ALC262_DIGOUT_NID,
12310 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12311 .channel_mode = alc262_modes,
12312 .input_mux = &alc262_capture_source,
12313 .unsol_event = alc262_hippo_unsol_event,
12314 .setup = alc262_hippo_setup,
12315 .init_hook = alc262_hippo_automute,
12317 [ALC262_HIPPO_1] = {
12318 .mixers = { alc262_hippo1_mixer },
12319 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12320 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12321 .dac_nids = alc262_dac_nids,
12323 .dig_out_nid = ALC262_DIGOUT_NID,
12324 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12325 .channel_mode = alc262_modes,
12326 .input_mux = &alc262_capture_source,
12327 .unsol_event = alc262_hippo_unsol_event,
12328 .setup = alc262_hippo1_setup,
12329 .init_hook = alc262_hippo_automute,
12331 [ALC262_FUJITSU] = {
12332 .mixers = { alc262_fujitsu_mixer },
12333 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12334 alc262_fujitsu_unsol_verbs },
12335 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12336 .dac_nids = alc262_dac_nids,
12338 .dig_out_nid = ALC262_DIGOUT_NID,
12339 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12340 .channel_mode = alc262_modes,
12341 .input_mux = &alc262_fujitsu_capture_source,
12342 .unsol_event = alc262_fujitsu_unsol_event,
12343 .init_hook = alc262_fujitsu_init_hook,
12345 [ALC262_HP_BPC] = {
12346 .mixers = { alc262_HP_BPC_mixer },
12347 .init_verbs = { alc262_HP_BPC_init_verbs },
12348 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12349 .dac_nids = alc262_dac_nids,
12351 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12352 .channel_mode = alc262_modes,
12353 .input_mux = &alc262_HP_capture_source,
12354 .unsol_event = alc262_hp_bpc_unsol_event,
12355 .init_hook = alc262_hp_bpc_automute,
12357 [ALC262_HP_BPC_D7000_WF] = {
12358 .mixers = { alc262_HP_BPC_WildWest_mixer },
12359 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12360 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12361 .dac_nids = alc262_dac_nids,
12363 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12364 .channel_mode = alc262_modes,
12365 .input_mux = &alc262_HP_D7000_capture_source,
12366 .unsol_event = alc262_hp_wildwest_unsol_event,
12367 .init_hook = alc262_hp_wildwest_automute,
12369 [ALC262_HP_BPC_D7000_WL] = {
12370 .mixers = { alc262_HP_BPC_WildWest_mixer,
12371 alc262_HP_BPC_WildWest_option_mixer },
12372 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12373 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12374 .dac_nids = alc262_dac_nids,
12376 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12377 .channel_mode = alc262_modes,
12378 .input_mux = &alc262_HP_D7000_capture_source,
12379 .unsol_event = alc262_hp_wildwest_unsol_event,
12380 .init_hook = alc262_hp_wildwest_automute,
12382 [ALC262_HP_TC_T5735] = {
12383 .mixers = { alc262_hp_t5735_mixer },
12384 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12385 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12386 .dac_nids = alc262_dac_nids,
12388 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12389 .channel_mode = alc262_modes,
12390 .input_mux = &alc262_capture_source,
12391 .unsol_event = alc_sku_unsol_event,
12392 .setup = alc262_hp_t5735_setup,
12393 .init_hook = alc_inithook,
12395 [ALC262_HP_RP5700] = {
12396 .mixers = { alc262_hp_rp5700_mixer },
12397 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12398 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12399 .dac_nids = alc262_dac_nids,
12400 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12401 .channel_mode = alc262_modes,
12402 .input_mux = &alc262_hp_rp5700_capture_source,
12404 [ALC262_BENQ_ED8] = {
12405 .mixers = { alc262_base_mixer },
12406 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12407 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12408 .dac_nids = alc262_dac_nids,
12410 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12411 .channel_mode = alc262_modes,
12412 .input_mux = &alc262_capture_source,
12414 [ALC262_SONY_ASSAMD] = {
12415 .mixers = { alc262_sony_mixer },
12416 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12417 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12418 .dac_nids = alc262_dac_nids,
12420 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12421 .channel_mode = alc262_modes,
12422 .input_mux = &alc262_capture_source,
12423 .unsol_event = alc262_hippo_unsol_event,
12424 .setup = alc262_hippo_setup,
12425 .init_hook = alc262_hippo_automute,
12427 [ALC262_BENQ_T31] = {
12428 .mixers = { alc262_benq_t31_mixer },
12429 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12430 alc_hp15_unsol_verbs },
12431 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12432 .dac_nids = alc262_dac_nids,
12434 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12435 .channel_mode = alc262_modes,
12436 .input_mux = &alc262_capture_source,
12437 .unsol_event = alc262_hippo_unsol_event,
12438 .setup = alc262_hippo_setup,
12439 .init_hook = alc262_hippo_automute,
12442 .mixers = { alc262_ultra_mixer },
12443 .cap_mixer = alc262_ultra_capture_mixer,
12444 .init_verbs = { alc262_ultra_verbs },
12445 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12446 .dac_nids = alc262_dac_nids,
12447 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12448 .channel_mode = alc262_modes,
12449 .input_mux = &alc262_ultra_capture_source,
12450 .adc_nids = alc262_adc_nids, /* ADC0 */
12451 .capsrc_nids = alc262_capsrc_nids,
12452 .num_adc_nids = 1, /* single ADC */
12453 .unsol_event = alc262_ultra_unsol_event,
12454 .init_hook = alc262_ultra_automute,
12456 [ALC262_LENOVO_3000] = {
12457 .mixers = { alc262_lenovo_3000_mixer },
12458 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12459 alc262_lenovo_3000_unsol_verbs,
12460 alc262_lenovo_3000_init_verbs },
12461 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12462 .dac_nids = alc262_dac_nids,
12464 .dig_out_nid = ALC262_DIGOUT_NID,
12465 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12466 .channel_mode = alc262_modes,
12467 .input_mux = &alc262_fujitsu_capture_source,
12468 .unsol_event = alc262_lenovo_3000_unsol_event,
12471 .mixers = { alc262_nec_mixer },
12472 .init_verbs = { alc262_nec_verbs },
12473 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12474 .dac_nids = alc262_dac_nids,
12476 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12477 .channel_mode = alc262_modes,
12478 .input_mux = &alc262_capture_source,
12480 [ALC262_TOSHIBA_S06] = {
12481 .mixers = { alc262_toshiba_s06_mixer },
12482 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12483 alc262_eapd_verbs },
12484 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12485 .capsrc_nids = alc262_dmic_capsrc_nids,
12486 .dac_nids = alc262_dac_nids,
12487 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12488 .num_adc_nids = 1, /* single ADC */
12489 .dig_out_nid = ALC262_DIGOUT_NID,
12490 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12491 .channel_mode = alc262_modes,
12492 .unsol_event = alc_sku_unsol_event,
12493 .setup = alc262_toshiba_s06_setup,
12494 .init_hook = alc_inithook,
12496 [ALC262_TOSHIBA_RX1] = {
12497 .mixers = { alc262_toshiba_rx1_mixer },
12498 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12499 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12500 .dac_nids = alc262_dac_nids,
12502 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12503 .channel_mode = alc262_modes,
12504 .input_mux = &alc262_capture_source,
12505 .unsol_event = alc262_hippo_unsol_event,
12506 .setup = alc262_hippo_setup,
12507 .init_hook = alc262_hippo_automute,
12510 .mixers = { alc262_tyan_mixer },
12511 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12512 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12513 .dac_nids = alc262_dac_nids,
12515 .dig_out_nid = ALC262_DIGOUT_NID,
12516 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12517 .channel_mode = alc262_modes,
12518 .input_mux = &alc262_capture_source,
12519 .unsol_event = alc_automute_amp_unsol_event,
12520 .setup = alc262_tyan_setup,
12521 .init_hook = alc_automute_amp,
12525 static int patch_alc262(struct hda_codec *codec)
12527 struct alc_spec *spec;
12531 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12535 codec->spec = spec;
12537 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12542 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12543 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12544 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12545 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12548 alc_auto_parse_customize_define(codec);
12550 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12552 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12556 if (board_config < 0) {
12557 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12559 board_config = ALC262_AUTO;
12562 if (board_config == ALC262_AUTO) {
12563 /* automatic parse from the BIOS config */
12564 err = alc262_parse_auto_config(codec);
12570 "hda_codec: Cannot set up configuration "
12571 "from BIOS. Using base mode...\n");
12572 board_config = ALC262_BASIC;
12576 if (!spec->no_analog && has_cdefine_beep(codec)) {
12577 err = snd_hda_attach_beep_device(codec, 0x1);
12584 if (board_config != ALC262_AUTO)
12585 setup_preset(codec, &alc262_presets[board_config]);
12587 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12588 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12590 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12591 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12593 if (!spec->adc_nids && spec->input_mux) {
12595 /* check whether the digital-mic has to be supported */
12596 for (i = 0; i < spec->input_mux->num_items; i++) {
12597 if (spec->input_mux->items[i].index >= 9)
12600 if (i < spec->input_mux->num_items) {
12601 /* use only ADC0 */
12602 spec->adc_nids = alc262_dmic_adc_nids;
12603 spec->num_adc_nids = 1;
12604 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12606 /* all analog inputs */
12607 /* check whether NID 0x07 is valid */
12608 unsigned int wcap = get_wcaps(codec, 0x07);
12611 wcap = get_wcaps_type(wcap);
12612 if (wcap != AC_WID_AUD_IN) {
12613 spec->adc_nids = alc262_adc_nids_alt;
12614 spec->num_adc_nids =
12615 ARRAY_SIZE(alc262_adc_nids_alt);
12616 spec->capsrc_nids = alc262_capsrc_nids_alt;
12618 spec->adc_nids = alc262_adc_nids;
12619 spec->num_adc_nids =
12620 ARRAY_SIZE(alc262_adc_nids);
12621 spec->capsrc_nids = alc262_capsrc_nids;
12625 if (!spec->cap_mixer && !spec->no_analog)
12626 set_capture_mixer(codec);
12627 if (!spec->no_analog && has_cdefine_beep(codec))
12628 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12630 spec->vmaster_nid = 0x0c;
12632 codec->patch_ops = alc_patch_ops;
12633 if (board_config == ALC262_AUTO)
12634 spec->init_hook = alc262_auto_init;
12635 #ifdef CONFIG_SND_HDA_POWER_SAVE
12636 if (!spec->loopback.amplist)
12637 spec->loopback.amplist = alc262_loopbacks;
12644 * ALC268 channel source setting (2 channel)
12646 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12647 #define alc268_modes alc260_modes
12649 static hda_nid_t alc268_dac_nids[2] = {
12654 static hda_nid_t alc268_adc_nids[2] = {
12659 static hda_nid_t alc268_adc_nids_alt[1] = {
12664 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12666 static struct snd_kcontrol_new alc268_base_mixer[] = {
12667 /* output mixer control */
12668 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12669 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12670 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12673 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12674 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12678 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12679 /* output mixer control */
12680 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12681 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12682 ALC262_HIPPO_MASTER_SWITCH,
12683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12684 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12685 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12689 /* bind Beep switches of both NID 0x0f and 0x10 */
12690 static struct hda_bind_ctls alc268_bind_beep_sw = {
12691 .ops = &snd_hda_bind_sw,
12693 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12694 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12699 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12700 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12701 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12705 static struct hda_verb alc268_eapd_verbs[] = {
12706 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12707 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12711 /* Toshiba specific */
12712 static struct hda_verb alc268_toshiba_verbs[] = {
12713 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12717 /* Acer specific */
12718 /* bind volumes of both NID 0x02 and 0x03 */
12719 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12720 .ops = &snd_hda_bind_vol,
12722 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12723 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12728 /* mute/unmute internal speaker according to the hp jack and mute state */
12729 static void alc268_acer_automute(struct hda_codec *codec, int force)
12731 struct alc_spec *spec = codec->spec;
12734 if (force || !spec->sense_updated) {
12735 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12736 spec->sense_updated = 1;
12738 if (spec->jack_present)
12739 mute = HDA_AMP_MUTE; /* mute internal speaker */
12740 else /* unmute internal speaker if necessary */
12741 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12742 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12743 HDA_AMP_MUTE, mute);
12747 /* bind hp and internal speaker mute (with plug check) */
12748 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12749 struct snd_ctl_elem_value *ucontrol)
12751 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12752 long *valp = ucontrol->value.integer.value;
12755 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12757 alc268_acer_automute(codec, 0);
12761 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12762 /* output mixer control */
12763 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12765 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12766 .name = "Master Playback Switch",
12767 .subdevice = HDA_SUBDEV_AMP_FLAG,
12768 .info = snd_hda_mixer_amp_switch_info,
12769 .get = snd_hda_mixer_amp_switch_get,
12770 .put = alc268_acer_master_sw_put,
12771 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12773 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12777 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12778 /* output mixer control */
12779 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12782 .name = "Master Playback Switch",
12783 .subdevice = HDA_SUBDEV_AMP_FLAG,
12784 .info = snd_hda_mixer_amp_switch_info,
12785 .get = snd_hda_mixer_amp_switch_get,
12786 .put = alc268_acer_master_sw_put,
12787 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12789 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12790 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12791 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12795 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12796 /* output mixer control */
12797 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12799 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12800 .name = "Master Playback Switch",
12801 .subdevice = HDA_SUBDEV_AMP_FLAG,
12802 .info = snd_hda_mixer_amp_switch_info,
12803 .get = snd_hda_mixer_amp_switch_get,
12804 .put = alc268_acer_master_sw_put,
12805 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12808 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12812 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12813 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12815 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12816 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12817 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12822 static struct hda_verb alc268_acer_verbs[] = {
12823 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12824 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12825 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12827 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12829 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12833 /* unsolicited event for HP jack sensing */
12834 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12835 #define alc268_toshiba_setup alc262_hippo_setup
12836 #define alc268_toshiba_automute alc262_hippo_automute
12838 static void alc268_acer_unsol_event(struct hda_codec *codec,
12841 if ((res >> 26) != ALC880_HP_EVENT)
12843 alc268_acer_automute(codec, 1);
12846 static void alc268_acer_init_hook(struct hda_codec *codec)
12848 alc268_acer_automute(codec, 1);
12851 /* toggle speaker-output according to the hp-jack state */
12852 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12854 unsigned int present;
12855 unsigned char bits;
12857 present = snd_hda_jack_detect(codec, 0x15);
12858 bits = present ? HDA_AMP_MUTE : 0;
12859 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12860 HDA_AMP_MUTE, bits);
12861 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12862 HDA_AMP_MUTE, bits);
12865 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12868 switch (res >> 26) {
12869 case ALC880_HP_EVENT:
12870 alc268_aspire_one_speaker_automute(codec);
12872 case ALC880_MIC_EVENT:
12873 alc_mic_automute(codec);
12878 static void alc268_acer_lc_setup(struct hda_codec *codec)
12880 struct alc_spec *spec = codec->spec;
12881 spec->ext_mic.pin = 0x18;
12882 spec->ext_mic.mux_idx = 0;
12883 spec->int_mic.pin = 0x12;
12884 spec->int_mic.mux_idx = 6;
12885 spec->auto_mic = 1;
12888 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12890 alc268_aspire_one_speaker_automute(codec);
12891 alc_mic_automute(codec);
12894 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12895 /* output mixer control */
12896 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12897 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12898 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12899 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12900 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12901 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12905 static struct hda_verb alc268_dell_verbs[] = {
12906 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12908 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12909 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12913 /* mute/unmute internal speaker according to the hp jack and mute state */
12914 static void alc268_dell_setup(struct hda_codec *codec)
12916 struct alc_spec *spec = codec->spec;
12918 spec->autocfg.hp_pins[0] = 0x15;
12919 spec->autocfg.speaker_pins[0] = 0x14;
12920 spec->ext_mic.pin = 0x18;
12921 spec->ext_mic.mux_idx = 0;
12922 spec->int_mic.pin = 0x19;
12923 spec->int_mic.mux_idx = 1;
12924 spec->auto_mic = 1;
12927 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12928 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12929 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12930 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12931 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12932 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12933 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12934 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12935 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12939 static struct hda_verb alc267_quanta_il1_verbs[] = {
12940 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12941 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12945 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12947 struct alc_spec *spec = codec->spec;
12948 spec->autocfg.hp_pins[0] = 0x15;
12949 spec->autocfg.speaker_pins[0] = 0x14;
12950 spec->ext_mic.pin = 0x18;
12951 spec->ext_mic.mux_idx = 0;
12952 spec->int_mic.pin = 0x19;
12953 spec->int_mic.mux_idx = 1;
12954 spec->auto_mic = 1;
12958 * generic initialization of ADC, input mixers and output mixers
12960 static struct hda_verb alc268_base_init_verbs[] = {
12961 /* Unmute DAC0-1 and set vol = 0 */
12962 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12963 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12966 * Set up output mixers (0x0c - 0x0e)
12968 /* set vol=0 to output mixers */
12969 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12970 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12972 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12973 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12975 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12978 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12979 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12980 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12981 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12982 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12984 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12986 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12987 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12990 /* set PCBEEP vol = 0, mute connections */
12991 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12992 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12993 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12995 /* Unmute Selector 23h,24h and set the default input to mic-in */
12997 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12998 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12999 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13006 * generic initialization of ADC, input mixers and output mixers
13008 static struct hda_verb alc268_volume_init_verbs[] = {
13009 /* set output DAC */
13010 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13011 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13013 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13014 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13015 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13016 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13017 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13021 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13023 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13026 /* set PCBEEP vol = 0, mute connections */
13027 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13029 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13034 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13035 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13036 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13040 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13041 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13042 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13047 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13048 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13049 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13050 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13051 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13056 static struct hda_input_mux alc268_capture_source = {
13060 { "Front Mic", 0x1 },
13066 static struct hda_input_mux alc268_acer_capture_source = {
13070 { "Internal Mic", 0x1 },
13075 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13079 { "Internal Mic", 0x6 },
13084 #ifdef CONFIG_SND_DEBUG
13085 static struct snd_kcontrol_new alc268_test_mixer[] = {
13086 /* Volume widgets */
13087 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13088 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13089 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13090 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13091 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13092 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13093 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13094 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13095 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13096 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13097 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13098 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13099 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13100 /* The below appears problematic on some hardwares */
13101 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13102 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13103 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13104 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13105 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13107 /* Modes for retasking pin widgets */
13108 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13109 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13110 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13111 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13113 /* Controls for GPIO pins, assuming they are configured as outputs */
13114 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13115 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13116 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13117 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13119 /* Switches to allow the digital SPDIF output pin to be enabled.
13120 * The ALC268 does not have an SPDIF input.
13122 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13124 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13125 * this output to turn on an external amplifier.
13127 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13128 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13134 /* create input playback/capture controls for the given pin */
13135 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13136 const char *ctlname, int idx)
13148 case 0x21: /* ALC269vb has this pin, too */
13154 if (spec->multiout.dac_nids[0] != dac &&
13155 spec->multiout.dac_nids[1] != dac) {
13156 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13157 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13161 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13165 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13166 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13168 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13169 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13175 /* add playback controls from the parsed DAC table */
13176 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13177 const struct auto_pin_cfg *cfg)
13182 spec->multiout.dac_nids = spec->private_dac_nids;
13184 nid = cfg->line_out_pins[0];
13187 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13191 err = alc268_new_analog_output(spec, nid, name, 0);
13196 nid = cfg->speaker_pins[0];
13198 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13199 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13203 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13207 nid = cfg->hp_pins[0];
13209 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13214 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13216 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13217 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13224 /* create playback/capture controls for input pins */
13225 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13226 const struct auto_pin_cfg *cfg)
13228 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13231 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13232 hda_nid_t nid, int pin_type)
13236 alc_set_pin_output(codec, nid, pin_type);
13237 if (nid == 0x14 || nid == 0x16)
13241 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13244 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13246 struct alc_spec *spec = codec->spec;
13247 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13249 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13250 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13254 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13256 struct alc_spec *spec = codec->spec;
13259 pin = spec->autocfg.hp_pins[0];
13261 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13262 pin = spec->autocfg.speaker_pins[0];
13264 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13267 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13269 struct alc_spec *spec = codec->spec;
13270 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13271 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13272 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13273 unsigned int dac_vol1, dac_vol2;
13275 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13276 snd_hda_codec_write(codec, speaker_nid, 0,
13277 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13278 /* mute mixer inputs from 0x1d */
13279 snd_hda_codec_write(codec, 0x0f, 0,
13280 AC_VERB_SET_AMP_GAIN_MUTE,
13282 snd_hda_codec_write(codec, 0x10, 0,
13283 AC_VERB_SET_AMP_GAIN_MUTE,
13286 /* unmute mixer inputs from 0x1d */
13287 snd_hda_codec_write(codec, 0x0f, 0,
13288 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13289 snd_hda_codec_write(codec, 0x10, 0,
13290 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13293 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13294 if (line_nid == 0x14)
13295 dac_vol2 = AMP_OUT_ZERO;
13296 else if (line_nid == 0x15)
13297 dac_vol1 = AMP_OUT_ZERO;
13298 if (hp_nid == 0x14)
13299 dac_vol2 = AMP_OUT_ZERO;
13300 else if (hp_nid == 0x15)
13301 dac_vol1 = AMP_OUT_ZERO;
13302 if (line_nid != 0x16 || hp_nid != 0x16 ||
13303 spec->autocfg.line_out_pins[1] != 0x16 ||
13304 spec->autocfg.line_out_pins[2] != 0x16)
13305 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13307 snd_hda_codec_write(codec, 0x02, 0,
13308 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13309 snd_hda_codec_write(codec, 0x03, 0,
13310 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13313 /* pcm configuration: identical with ALC880 */
13314 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13315 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13316 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13317 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13320 * BIOS auto configuration
13322 static int alc268_parse_auto_config(struct hda_codec *codec)
13324 struct alc_spec *spec = codec->spec;
13326 static hda_nid_t alc268_ignore[] = { 0 };
13328 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13332 if (!spec->autocfg.line_outs) {
13333 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13334 spec->multiout.max_channels = 2;
13335 spec->no_analog = 1;
13338 return 0; /* can't find valid BIOS pin config */
13340 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13343 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13347 spec->multiout.max_channels = 2;
13350 /* digital only support output */
13351 alc_auto_parse_digital(codec);
13352 if (spec->kctls.list)
13353 add_mixer(spec, spec->kctls.list);
13355 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13356 add_mixer(spec, alc268_beep_mixer);
13358 add_verb(spec, alc268_volume_init_verbs);
13359 spec->num_mux_defs = 2;
13360 spec->input_mux = &spec->private_imux[0];
13362 err = alc_auto_add_mic_boost(codec);
13366 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13371 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13373 /* init callback for auto-configuration model -- overriding the default init */
13374 static void alc268_auto_init(struct hda_codec *codec)
13376 struct alc_spec *spec = codec->spec;
13377 alc268_auto_init_multi_out(codec);
13378 alc268_auto_init_hp_out(codec);
13379 alc268_auto_init_mono_speaker_out(codec);
13380 alc268_auto_init_analog_input(codec);
13381 alc_auto_init_digital(codec);
13382 if (spec->unsol_event)
13383 alc_inithook(codec);
13387 * configuration and preset
13389 static const char *alc268_models[ALC268_MODEL_LAST] = {
13390 [ALC267_QUANTA_IL1] = "quanta-il1",
13391 [ALC268_3ST] = "3stack",
13392 [ALC268_TOSHIBA] = "toshiba",
13393 [ALC268_ACER] = "acer",
13394 [ALC268_ACER_DMIC] = "acer-dmic",
13395 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13396 [ALC268_DELL] = "dell",
13397 [ALC268_ZEPTO] = "zepto",
13398 #ifdef CONFIG_SND_DEBUG
13399 [ALC268_TEST] = "test",
13401 [ALC268_AUTO] = "auto",
13404 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13405 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13406 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13407 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13408 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13409 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13410 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13411 ALC268_ACER_ASPIRE_ONE),
13412 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13413 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13414 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13415 /* almost compatible with toshiba but with optional digital outs;
13416 * auto-probing seems working fine
13418 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13420 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13421 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13422 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13423 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13424 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13425 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13429 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13430 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13431 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13432 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13433 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13438 static struct alc_config_preset alc268_presets[] = {
13439 [ALC267_QUANTA_IL1] = {
13440 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13441 alc268_capture_nosrc_mixer },
13442 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13443 alc267_quanta_il1_verbs },
13444 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13445 .dac_nids = alc268_dac_nids,
13446 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13447 .adc_nids = alc268_adc_nids_alt,
13449 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13450 .channel_mode = alc268_modes,
13451 .unsol_event = alc_sku_unsol_event,
13452 .setup = alc267_quanta_il1_setup,
13453 .init_hook = alc_inithook,
13456 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13457 alc268_beep_mixer },
13458 .init_verbs = { alc268_base_init_verbs },
13459 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13460 .dac_nids = alc268_dac_nids,
13461 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13462 .adc_nids = alc268_adc_nids_alt,
13463 .capsrc_nids = alc268_capsrc_nids,
13465 .dig_out_nid = ALC268_DIGOUT_NID,
13466 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13467 .channel_mode = alc268_modes,
13468 .input_mux = &alc268_capture_source,
13470 [ALC268_TOSHIBA] = {
13471 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13472 alc268_beep_mixer },
13473 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13474 alc268_toshiba_verbs },
13475 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13476 .dac_nids = alc268_dac_nids,
13477 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13478 .adc_nids = alc268_adc_nids_alt,
13479 .capsrc_nids = alc268_capsrc_nids,
13481 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13482 .channel_mode = alc268_modes,
13483 .input_mux = &alc268_capture_source,
13484 .unsol_event = alc268_toshiba_unsol_event,
13485 .setup = alc268_toshiba_setup,
13486 .init_hook = alc268_toshiba_automute,
13489 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13490 alc268_beep_mixer },
13491 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13492 alc268_acer_verbs },
13493 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13494 .dac_nids = alc268_dac_nids,
13495 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13496 .adc_nids = alc268_adc_nids_alt,
13497 .capsrc_nids = alc268_capsrc_nids,
13499 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13500 .channel_mode = alc268_modes,
13501 .input_mux = &alc268_acer_capture_source,
13502 .unsol_event = alc268_acer_unsol_event,
13503 .init_hook = alc268_acer_init_hook,
13505 [ALC268_ACER_DMIC] = {
13506 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13507 alc268_beep_mixer },
13508 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13509 alc268_acer_verbs },
13510 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13511 .dac_nids = alc268_dac_nids,
13512 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13513 .adc_nids = alc268_adc_nids_alt,
13514 .capsrc_nids = alc268_capsrc_nids,
13516 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13517 .channel_mode = alc268_modes,
13518 .input_mux = &alc268_acer_dmic_capture_source,
13519 .unsol_event = alc268_acer_unsol_event,
13520 .init_hook = alc268_acer_init_hook,
13522 [ALC268_ACER_ASPIRE_ONE] = {
13523 .mixers = { alc268_acer_aspire_one_mixer,
13525 alc268_capture_nosrc_mixer },
13526 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13527 alc268_acer_aspire_one_verbs },
13528 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13529 .dac_nids = alc268_dac_nids,
13530 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13531 .adc_nids = alc268_adc_nids_alt,
13532 .capsrc_nids = alc268_capsrc_nids,
13534 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13535 .channel_mode = alc268_modes,
13536 .unsol_event = alc268_acer_lc_unsol_event,
13537 .setup = alc268_acer_lc_setup,
13538 .init_hook = alc268_acer_lc_init_hook,
13541 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13542 alc268_capture_nosrc_mixer },
13543 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13544 alc268_dell_verbs },
13545 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13546 .dac_nids = alc268_dac_nids,
13547 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13548 .adc_nids = alc268_adc_nids_alt,
13549 .capsrc_nids = alc268_capsrc_nids,
13551 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13552 .channel_mode = alc268_modes,
13553 .unsol_event = alc_sku_unsol_event,
13554 .setup = alc268_dell_setup,
13555 .init_hook = alc_inithook,
13558 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13559 alc268_beep_mixer },
13560 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13561 alc268_toshiba_verbs },
13562 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13563 .dac_nids = alc268_dac_nids,
13564 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13565 .adc_nids = alc268_adc_nids_alt,
13566 .capsrc_nids = alc268_capsrc_nids,
13568 .dig_out_nid = ALC268_DIGOUT_NID,
13569 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13570 .channel_mode = alc268_modes,
13571 .input_mux = &alc268_capture_source,
13572 .setup = alc268_toshiba_setup,
13573 .init_hook = alc268_toshiba_automute,
13575 #ifdef CONFIG_SND_DEBUG
13577 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13578 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13579 alc268_volume_init_verbs },
13580 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13581 .dac_nids = alc268_dac_nids,
13582 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13583 .adc_nids = alc268_adc_nids_alt,
13584 .capsrc_nids = alc268_capsrc_nids,
13586 .dig_out_nid = ALC268_DIGOUT_NID,
13587 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13588 .channel_mode = alc268_modes,
13589 .input_mux = &alc268_capture_source,
13594 static int patch_alc268(struct hda_codec *codec)
13596 struct alc_spec *spec;
13598 int i, has_beep, err;
13600 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13604 codec->spec = spec;
13606 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13610 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13611 board_config = snd_hda_check_board_codec_sid_config(codec,
13612 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13614 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13615 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13617 board_config = ALC268_AUTO;
13620 if (board_config == ALC268_AUTO) {
13621 /* automatic parse from the BIOS config */
13622 err = alc268_parse_auto_config(codec);
13628 "hda_codec: Cannot set up configuration "
13629 "from BIOS. Using base mode...\n");
13630 board_config = ALC268_3ST;
13634 if (board_config != ALC268_AUTO)
13635 setup_preset(codec, &alc268_presets[board_config]);
13637 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13638 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13639 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13641 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13644 for (i = 0; i < spec->num_mixers; i++) {
13645 if (spec->mixers[i] == alc268_beep_mixer) {
13652 err = snd_hda_attach_beep_device(codec, 0x1);
13657 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13658 /* override the amp caps for beep generator */
13659 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13660 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13661 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13662 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13663 (0 << AC_AMPCAP_MUTE_SHIFT));
13666 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13667 /* check whether NID 0x07 is valid */
13668 unsigned int wcap = get_wcaps(codec, 0x07);
13671 spec->capsrc_nids = alc268_capsrc_nids;
13673 wcap = get_wcaps_type(wcap);
13674 if (spec->auto_mic ||
13675 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13676 spec->adc_nids = alc268_adc_nids_alt;
13677 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13678 if (spec->auto_mic)
13679 fixup_automic_adc(codec);
13680 if (spec->auto_mic || spec->input_mux->num_items == 1)
13681 add_mixer(spec, alc268_capture_nosrc_mixer);
13683 add_mixer(spec, alc268_capture_alt_mixer);
13685 spec->adc_nids = alc268_adc_nids;
13686 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13687 add_mixer(spec, alc268_capture_mixer);
13689 /* set default input source */
13690 for (i = 0; i < spec->num_adc_nids; i++)
13691 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13692 0, AC_VERB_SET_CONNECT_SEL,
13693 i < spec->num_mux_defs ?
13694 spec->input_mux[i].items[0].index :
13695 spec->input_mux->items[0].index);
13698 spec->vmaster_nid = 0x02;
13700 codec->patch_ops = alc_patch_ops;
13701 if (board_config == ALC268_AUTO)
13702 spec->init_hook = alc268_auto_init;
13708 * ALC269 channel source setting (2 channel)
13710 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13712 #define alc269_dac_nids alc260_dac_nids
13714 static hda_nid_t alc269_adc_nids[1] = {
13719 static hda_nid_t alc269_capsrc_nids[1] = {
13723 static hda_nid_t alc269vb_adc_nids[1] = {
13728 static hda_nid_t alc269vb_capsrc_nids[1] = {
13732 static hda_nid_t alc269_adc_candidates[] = {
13736 #define alc269_modes alc260_modes
13737 #define alc269_capture_source alc880_lg_lw_capture_source
13739 static struct snd_kcontrol_new alc269_base_mixer[] = {
13740 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13741 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13742 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13743 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13744 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13746 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13747 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13748 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13749 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13750 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13751 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13755 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13756 /* output mixer control */
13757 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13759 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13760 .name = "Master Playback Switch",
13761 .subdevice = HDA_SUBDEV_AMP_FLAG,
13762 .info = snd_hda_mixer_amp_switch_info,
13763 .get = snd_hda_mixer_amp_switch_get,
13764 .put = alc268_acer_master_sw_put,
13765 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13769 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13770 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13771 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13772 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13776 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13777 /* output mixer control */
13778 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13781 .name = "Master Playback Switch",
13782 .subdevice = HDA_SUBDEV_AMP_FLAG,
13783 .info = snd_hda_mixer_amp_switch_info,
13784 .get = snd_hda_mixer_amp_switch_get,
13785 .put = alc268_acer_master_sw_put,
13786 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13790 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13791 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13792 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13793 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13794 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13795 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13796 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13800 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13801 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13802 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13803 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13804 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13808 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13809 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13810 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13812 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13816 /* capture mixer elements */
13817 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13818 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13819 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13820 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13821 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13825 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13826 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13827 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13828 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13832 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13833 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13834 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13836 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13840 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13841 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13842 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13848 #define alc269_fujitsu_mixer alc269_laptop_mixer
13850 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13851 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13852 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13854 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13856 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13860 static struct hda_verb alc269_lifebook_verbs[] = {
13861 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13862 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13863 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13865 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13867 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13868 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13869 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13870 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13874 /* toggle speaker-output according to the hp-jack state */
13875 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13877 unsigned int present;
13878 unsigned char bits;
13880 present = snd_hda_jack_detect(codec, 0x15);
13881 bits = present ? HDA_AMP_MUTE : 0;
13882 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13883 HDA_AMP_MUTE, bits);
13884 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13885 HDA_AMP_MUTE, bits);
13887 snd_hda_codec_write(codec, 0x20, 0,
13888 AC_VERB_SET_COEF_INDEX, 0x0c);
13889 snd_hda_codec_write(codec, 0x20, 0,
13890 AC_VERB_SET_PROC_COEF, 0x680);
13892 snd_hda_codec_write(codec, 0x20, 0,
13893 AC_VERB_SET_COEF_INDEX, 0x0c);
13894 snd_hda_codec_write(codec, 0x20, 0,
13895 AC_VERB_SET_PROC_COEF, 0x480);
13898 /* toggle speaker-output according to the hp-jacks state */
13899 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13901 unsigned int present;
13902 unsigned char bits;
13904 /* Check laptop headphone socket */
13905 present = snd_hda_jack_detect(codec, 0x15);
13907 /* Check port replicator headphone socket */
13908 present |= snd_hda_jack_detect(codec, 0x1a);
13910 bits = present ? HDA_AMP_MUTE : 0;
13911 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13912 HDA_AMP_MUTE, bits);
13913 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13914 HDA_AMP_MUTE, bits);
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, 0x680);
13921 snd_hda_codec_write(codec, 0x20, 0,
13922 AC_VERB_SET_COEF_INDEX, 0x0c);
13923 snd_hda_codec_write(codec, 0x20, 0,
13924 AC_VERB_SET_PROC_COEF, 0x480);
13927 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13929 unsigned int present_laptop;
13930 unsigned int present_dock;
13932 present_laptop = snd_hda_jack_detect(codec, 0x18);
13933 present_dock = snd_hda_jack_detect(codec, 0x1b);
13935 /* Laptop mic port overrides dock mic port, design decision */
13937 snd_hda_codec_write(codec, 0x23, 0,
13938 AC_VERB_SET_CONNECT_SEL, 0x3);
13939 if (present_laptop)
13940 snd_hda_codec_write(codec, 0x23, 0,
13941 AC_VERB_SET_CONNECT_SEL, 0x0);
13942 if (!present_dock && !present_laptop)
13943 snd_hda_codec_write(codec, 0x23, 0,
13944 AC_VERB_SET_CONNECT_SEL, 0x1);
13947 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13950 switch (res >> 26) {
13951 case ALC880_HP_EVENT:
13952 alc269_quanta_fl1_speaker_automute(codec);
13954 case ALC880_MIC_EVENT:
13955 alc_mic_automute(codec);
13960 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13963 if ((res >> 26) == ALC880_HP_EVENT)
13964 alc269_lifebook_speaker_automute(codec);
13965 if ((res >> 26) == ALC880_MIC_EVENT)
13966 alc269_lifebook_mic_autoswitch(codec);
13969 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13971 struct alc_spec *spec = codec->spec;
13972 spec->autocfg.hp_pins[0] = 0x15;
13973 spec->autocfg.speaker_pins[0] = 0x14;
13974 spec->ext_mic.pin = 0x18;
13975 spec->ext_mic.mux_idx = 0;
13976 spec->int_mic.pin = 0x19;
13977 spec->int_mic.mux_idx = 1;
13978 spec->auto_mic = 1;
13981 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13983 alc269_quanta_fl1_speaker_automute(codec);
13984 alc_mic_automute(codec);
13987 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13989 alc269_lifebook_speaker_automute(codec);
13990 alc269_lifebook_mic_autoswitch(codec);
13993 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13995 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13996 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13997 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13998 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13999 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14000 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14004 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14005 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14006 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14007 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14008 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14009 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14010 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14014 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14015 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14016 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14017 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14019 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14020 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14021 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14025 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14026 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14027 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14028 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14029 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14030 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14031 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14032 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14036 /* toggle speaker-output according to the hp-jack state */
14037 static void alc269_speaker_automute(struct hda_codec *codec)
14039 struct alc_spec *spec = codec->spec;
14040 unsigned int nid = spec->autocfg.hp_pins[0];
14041 unsigned int present;
14042 unsigned char bits;
14044 present = snd_hda_jack_detect(codec, nid);
14045 bits = present ? HDA_AMP_MUTE : 0;
14046 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14047 HDA_AMP_MUTE, bits);
14048 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14049 HDA_AMP_MUTE, bits);
14052 /* unsolicited event for HP jack sensing */
14053 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14056 switch (res >> 26) {
14057 case ALC880_HP_EVENT:
14058 alc269_speaker_automute(codec);
14060 case ALC880_MIC_EVENT:
14061 alc_mic_automute(codec);
14066 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14068 struct alc_spec *spec = codec->spec;
14069 spec->autocfg.hp_pins[0] = 0x15;
14070 spec->autocfg.speaker_pins[0] = 0x14;
14071 spec->ext_mic.pin = 0x18;
14072 spec->ext_mic.mux_idx = 0;
14073 spec->int_mic.pin = 0x19;
14074 spec->int_mic.mux_idx = 1;
14075 spec->auto_mic = 1;
14078 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14080 struct alc_spec *spec = codec->spec;
14081 spec->autocfg.hp_pins[0] = 0x15;
14082 spec->autocfg.speaker_pins[0] = 0x14;
14083 spec->ext_mic.pin = 0x18;
14084 spec->ext_mic.mux_idx = 0;
14085 spec->int_mic.pin = 0x12;
14086 spec->int_mic.mux_idx = 5;
14087 spec->auto_mic = 1;
14090 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14092 struct alc_spec *spec = codec->spec;
14093 spec->autocfg.hp_pins[0] = 0x21;
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 alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14104 struct alc_spec *spec = codec->spec;
14105 spec->autocfg.hp_pins[0] = 0x21;
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 = 6;
14111 spec->auto_mic = 1;
14114 static void alc269_laptop_inithook(struct hda_codec *codec)
14116 alc269_speaker_automute(codec);
14117 alc_mic_automute(codec);
14121 * generic initialization of ADC, input mixers and output mixers
14123 static struct hda_verb alc269_init_verbs[] = {
14125 * Unmute ADC0 and set the default input to mic-in
14127 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14130 * Set up output mixers (0x02 - 0x03)
14132 /* set vol=0 to output mixers */
14133 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14134 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14136 /* set up input amps for analog loopback */
14137 /* Amp Indices: DAC = 0, mixer = 1 */
14138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14139 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14140 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14141 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14142 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14143 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14147 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14148 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14149 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14150 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14151 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14153 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14154 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14156 /* FIXME: use Mux-type input source selection */
14157 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14158 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14159 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14162 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14166 static struct hda_verb alc269vb_init_verbs[] = {
14168 * Unmute ADC0 and set the default input to mic-in
14170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14173 * Set up output mixers (0x02 - 0x03)
14175 /* set vol=0 to output mixers */
14176 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14177 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14179 /* set up input amps for analog loopback */
14180 /* Amp Indices: DAC = 0, mixer = 1 */
14181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14184 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14186 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14189 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14190 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14191 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14192 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14193 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14194 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14196 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14197 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14199 /* FIXME: use Mux-type input source selection */
14200 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14201 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14202 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14205 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14209 #define alc269_auto_create_multi_out_ctls \
14210 alc268_auto_create_multi_out_ctls
14211 #define alc269_auto_create_input_ctls \
14212 alc268_auto_create_input_ctls
14214 #ifdef CONFIG_SND_HDA_POWER_SAVE
14215 #define alc269_loopbacks alc880_loopbacks
14218 /* pcm configuration: identical with ALC880 */
14219 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14220 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14221 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14222 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14224 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14228 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14229 /* NID is set in alc_build_pcms */
14231 .open = alc880_playback_pcm_open,
14232 .prepare = alc880_playback_pcm_prepare,
14233 .cleanup = alc880_playback_pcm_cleanup
14237 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14241 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14242 /* NID is set in alc_build_pcms */
14245 #ifdef CONFIG_SND_HDA_POWER_SAVE
14246 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14248 switch (codec->subsystem_id) {
14255 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14257 /* update mute-LED according to the speaker mute state */
14258 if (nid == 0x01 || nid == 0x14) {
14260 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14265 /* mic2 vref pin is used for mute LED control */
14266 snd_hda_codec_update_cache(codec, 0x19, 0,
14267 AC_VERB_SET_PIN_WIDGET_CONTROL,
14270 return alc_check_power_status(codec, nid);
14272 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14274 static int alc275_setup_dual_adc(struct hda_codec *codec)
14276 struct alc_spec *spec = codec->spec;
14278 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14280 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14281 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14282 if (spec->ext_mic.pin <= 0x12) {
14283 spec->private_adc_nids[0] = 0x08;
14284 spec->private_adc_nids[1] = 0x11;
14285 spec->private_capsrc_nids[0] = 0x23;
14286 spec->private_capsrc_nids[1] = 0x22;
14288 spec->private_adc_nids[0] = 0x11;
14289 spec->private_adc_nids[1] = 0x08;
14290 spec->private_capsrc_nids[0] = 0x22;
14291 spec->private_capsrc_nids[1] = 0x23;
14293 spec->adc_nids = spec->private_adc_nids;
14294 spec->capsrc_nids = spec->private_capsrc_nids;
14295 spec->num_adc_nids = 2;
14296 spec->dual_adc_switch = 1;
14297 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14298 spec->adc_nids[0], spec->adc_nids[1]);
14305 * BIOS auto configuration
14307 static int alc269_parse_auto_config(struct hda_codec *codec)
14309 struct alc_spec *spec = codec->spec;
14311 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14313 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14318 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14321 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14325 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14327 alc_auto_parse_digital(codec);
14329 if (spec->kctls.list)
14330 add_mixer(spec, spec->kctls.list);
14332 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14333 add_verb(spec, alc269vb_init_verbs);
14334 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14336 add_verb(spec, alc269_init_verbs);
14337 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14340 spec->num_mux_defs = 1;
14341 spec->input_mux = &spec->private_imux[0];
14343 if (!alc275_setup_dual_adc(codec))
14344 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14345 sizeof(alc269_adc_candidates));
14347 /* set default input source */
14348 if (!spec->dual_adc_switch)
14349 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14350 0, AC_VERB_SET_CONNECT_SEL,
14351 spec->input_mux->items[0].index);
14353 err = alc_auto_add_mic_boost(codec);
14357 if (!spec->cap_mixer && !spec->no_analog)
14358 set_capture_mixer(codec);
14363 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14364 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14365 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14368 /* init callback for auto-configuration model -- overriding the default init */
14369 static void alc269_auto_init(struct hda_codec *codec)
14371 struct alc_spec *spec = codec->spec;
14372 alc269_auto_init_multi_out(codec);
14373 alc269_auto_init_hp_out(codec);
14374 alc269_auto_init_analog_input(codec);
14375 alc_auto_init_digital(codec);
14376 if (spec->unsol_event)
14377 alc_inithook(codec);
14381 ALC269_FIXUP_SONY_VAIO,
14384 static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = {
14385 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14389 static const struct alc_fixup alc269_fixups[] = {
14390 [ALC269_FIXUP_SONY_VAIO] = {
14391 .verbs = alc269_sony_vaio_fixup_verbs
14395 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14396 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14402 * configuration and preset
14404 static const char *alc269_models[ALC269_MODEL_LAST] = {
14405 [ALC269_BASIC] = "basic",
14406 [ALC269_QUANTA_FL1] = "quanta",
14407 [ALC269_AMIC] = "laptop-amic",
14408 [ALC269_DMIC] = "laptop-dmic",
14409 [ALC269_FUJITSU] = "fujitsu",
14410 [ALC269_LIFEBOOK] = "lifebook",
14411 [ALC269_AUTO] = "auto",
14414 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14415 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14416 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14418 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14419 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14420 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14421 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14422 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14423 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14424 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14425 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14426 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14427 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14428 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14429 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14430 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14431 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14432 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14433 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14434 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14435 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14436 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14437 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14438 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14439 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14440 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14441 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14442 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14443 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14444 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14445 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14446 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14447 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14448 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14449 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14450 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14451 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14452 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14453 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14454 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14456 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14458 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14459 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14460 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14461 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14462 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14463 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14464 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14465 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14466 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14467 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14471 static struct alc_config_preset alc269_presets[] = {
14473 .mixers = { alc269_base_mixer },
14474 .init_verbs = { alc269_init_verbs },
14475 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14476 .dac_nids = alc269_dac_nids,
14478 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14479 .channel_mode = alc269_modes,
14480 .input_mux = &alc269_capture_source,
14482 [ALC269_QUANTA_FL1] = {
14483 .mixers = { alc269_quanta_fl1_mixer },
14484 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14485 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14486 .dac_nids = alc269_dac_nids,
14488 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14489 .channel_mode = alc269_modes,
14490 .input_mux = &alc269_capture_source,
14491 .unsol_event = alc269_quanta_fl1_unsol_event,
14492 .setup = alc269_quanta_fl1_setup,
14493 .init_hook = alc269_quanta_fl1_init_hook,
14496 .mixers = { alc269_laptop_mixer },
14497 .cap_mixer = alc269_laptop_analog_capture_mixer,
14498 .init_verbs = { alc269_init_verbs,
14499 alc269_laptop_amic_init_verbs },
14500 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14501 .dac_nids = alc269_dac_nids,
14503 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14504 .channel_mode = alc269_modes,
14505 .unsol_event = alc269_laptop_unsol_event,
14506 .setup = alc269_laptop_amic_setup,
14507 .init_hook = alc269_laptop_inithook,
14510 .mixers = { alc269_laptop_mixer },
14511 .cap_mixer = alc269_laptop_digital_capture_mixer,
14512 .init_verbs = { alc269_init_verbs,
14513 alc269_laptop_dmic_init_verbs },
14514 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14515 .dac_nids = alc269_dac_nids,
14517 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14518 .channel_mode = alc269_modes,
14519 .unsol_event = alc269_laptop_unsol_event,
14520 .setup = alc269_laptop_dmic_setup,
14521 .init_hook = alc269_laptop_inithook,
14523 [ALC269VB_AMIC] = {
14524 .mixers = { alc269vb_laptop_mixer },
14525 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14526 .init_verbs = { alc269vb_init_verbs,
14527 alc269vb_laptop_amic_init_verbs },
14528 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14529 .dac_nids = alc269_dac_nids,
14531 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14532 .channel_mode = alc269_modes,
14533 .unsol_event = alc269_laptop_unsol_event,
14534 .setup = alc269vb_laptop_amic_setup,
14535 .init_hook = alc269_laptop_inithook,
14537 [ALC269VB_DMIC] = {
14538 .mixers = { alc269vb_laptop_mixer },
14539 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14540 .init_verbs = { alc269vb_init_verbs,
14541 alc269vb_laptop_dmic_init_verbs },
14542 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14543 .dac_nids = alc269_dac_nids,
14545 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14546 .channel_mode = alc269_modes,
14547 .unsol_event = alc269_laptop_unsol_event,
14548 .setup = alc269vb_laptop_dmic_setup,
14549 .init_hook = alc269_laptop_inithook,
14551 [ALC269_FUJITSU] = {
14552 .mixers = { alc269_fujitsu_mixer },
14553 .cap_mixer = alc269_laptop_digital_capture_mixer,
14554 .init_verbs = { alc269_init_verbs,
14555 alc269_laptop_dmic_init_verbs },
14556 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14557 .dac_nids = alc269_dac_nids,
14559 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14560 .channel_mode = alc269_modes,
14561 .unsol_event = alc269_laptop_unsol_event,
14562 .setup = alc269_laptop_dmic_setup,
14563 .init_hook = alc269_laptop_inithook,
14565 [ALC269_LIFEBOOK] = {
14566 .mixers = { alc269_lifebook_mixer },
14567 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14568 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14569 .dac_nids = alc269_dac_nids,
14571 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14572 .channel_mode = alc269_modes,
14573 .input_mux = &alc269_capture_source,
14574 .unsol_event = alc269_lifebook_unsol_event,
14575 .init_hook = alc269_lifebook_init_hook,
14579 static int patch_alc269(struct hda_codec *codec)
14581 struct alc_spec *spec;
14584 int is_alc269vb = 0;
14586 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14590 codec->spec = spec;
14592 alc_auto_parse_customize_define(codec);
14594 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14595 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14596 spec->cdefine.platform_type == 1)
14597 alc_codec_rename(codec, "ALC271X");
14599 alc_codec_rename(codec, "ALC259");
14602 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14604 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14608 if (board_config < 0) {
14609 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14611 board_config = ALC269_AUTO;
14614 if (board_config == ALC269_AUTO)
14615 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14617 if (board_config == ALC269_AUTO) {
14618 /* automatic parse from the BIOS config */
14619 err = alc269_parse_auto_config(codec);
14625 "hda_codec: Cannot set up configuration "
14626 "from BIOS. Using base mode...\n");
14627 board_config = ALC269_BASIC;
14631 if (has_cdefine_beep(codec)) {
14632 err = snd_hda_attach_beep_device(codec, 0x1);
14639 if (board_config != ALC269_AUTO)
14640 setup_preset(codec, &alc269_presets[board_config]);
14642 if (board_config == ALC269_QUANTA_FL1) {
14643 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14644 * fix the sample rate of analog I/O to 44.1kHz
14646 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14647 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14648 } else if (spec->dual_adc_switch) {
14649 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14650 /* switch ADC dynamically */
14651 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14653 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14654 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14656 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14657 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14659 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14660 if (!is_alc269vb) {
14661 spec->adc_nids = alc269_adc_nids;
14662 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14663 spec->capsrc_nids = alc269_capsrc_nids;
14665 spec->adc_nids = alc269vb_adc_nids;
14666 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14667 spec->capsrc_nids = alc269vb_capsrc_nids;
14671 if (!spec->cap_mixer)
14672 set_capture_mixer(codec);
14673 if (has_cdefine_beep(codec))
14674 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14676 if (board_config == ALC269_AUTO)
14677 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14679 spec->vmaster_nid = 0x02;
14681 codec->patch_ops = alc_patch_ops;
14682 if (board_config == ALC269_AUTO)
14683 spec->init_hook = alc269_auto_init;
14684 #ifdef CONFIG_SND_HDA_POWER_SAVE
14685 if (!spec->loopback.amplist)
14686 spec->loopback.amplist = alc269_loopbacks;
14687 if (alc269_mic2_for_mute_led(codec))
14688 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14695 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14699 * set the path ways for 2 channel output
14700 * need to set the codec line out and mic 1 pin widgets to inputs
14702 static struct hda_verb alc861_threestack_ch2_init[] = {
14703 /* set pin widget 1Ah (line in) for input */
14704 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14705 /* set pin widget 18h (mic1/2) for input, for mic also enable
14708 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14710 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14712 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14713 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14719 * need to set the codec line out and mic 1 pin widgets to outputs
14721 static struct hda_verb alc861_threestack_ch6_init[] = {
14722 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14723 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14724 /* set pin widget 18h (mic1) for output (CLFE)*/
14725 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14727 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14728 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14730 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14732 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14733 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14738 static struct hda_channel_mode alc861_threestack_modes[2] = {
14739 { 2, alc861_threestack_ch2_init },
14740 { 6, alc861_threestack_ch6_init },
14742 /* Set mic1 as input and unmute the mixer */
14743 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14744 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14745 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14748 /* Set mic1 as output and mute mixer */
14749 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14750 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14751 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14755 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14756 { 2, alc861_uniwill_m31_ch2_init },
14757 { 4, alc861_uniwill_m31_ch4_init },
14760 /* Set mic1 and line-in as input and unmute the mixer */
14761 static struct hda_verb alc861_asus_ch2_init[] = {
14762 /* set pin widget 1Ah (line in) for input */
14763 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14764 /* set pin widget 18h (mic1/2) for input, for mic also enable
14767 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14769 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14771 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14772 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14776 /* Set mic1 nad line-in as output and mute mixer */
14777 static struct hda_verb alc861_asus_ch6_init[] = {
14778 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14779 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14780 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14781 /* set pin widget 18h (mic1) for output (CLFE)*/
14782 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14783 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14784 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14785 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14787 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14789 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14790 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14795 static struct hda_channel_mode alc861_asus_modes[2] = {
14796 { 2, alc861_asus_ch2_init },
14797 { 6, alc861_asus_ch6_init },
14802 static struct snd_kcontrol_new alc861_base_mixer[] = {
14803 /* output mixer control */
14804 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14805 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14806 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14807 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14808 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14810 /*Input mixer control */
14811 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14812 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14813 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14814 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14815 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14816 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14818 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14819 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14825 static struct snd_kcontrol_new alc861_3ST_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),
14846 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14847 .name = "Channel Mode",
14848 .info = alc_ch_mode_info,
14849 .get = alc_ch_mode_get,
14850 .put = alc_ch_mode_put,
14851 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14856 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14857 /* output mixer control */
14858 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14860 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14865 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14866 /* output mixer control */
14867 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14868 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14869 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14870 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14871 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14873 /* Input mixer control */
14874 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14875 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14876 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14877 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14878 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14879 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14881 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14882 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14887 .name = "Channel Mode",
14888 .info = alc_ch_mode_info,
14889 .get = alc_ch_mode_get,
14890 .put = alc_ch_mode_put,
14891 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14896 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14897 /* output mixer control */
14898 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14899 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14900 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14901 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14902 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14904 /* Input mixer control */
14905 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14906 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14907 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14908 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14909 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14910 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14912 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14918 .name = "Channel Mode",
14919 .info = alc_ch_mode_info,
14920 .get = alc_ch_mode_get,
14921 .put = alc_ch_mode_put,
14922 .private_value = ARRAY_SIZE(alc861_asus_modes),
14927 /* additional mixer */
14928 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14929 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14930 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14935 * generic initialization of ADC, input mixers and output mixers
14937 static struct hda_verb alc861_base_init_verbs[] = {
14939 * Unmute ADC0 and set the default input to mic-in
14941 /* port-A for surround (rear panel) */
14942 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14943 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14944 /* port-B for mic-in (rear panel) with vref */
14945 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14946 /* port-C for line-in (rear panel) */
14947 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14948 /* port-D for Front */
14949 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14950 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14951 /* port-E for HP out (front panel) */
14952 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14953 /* route front PCM to HP */
14954 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14955 /* port-F for mic-in (front panel) with vref */
14956 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14957 /* port-G for CLFE (rear panel) */
14958 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14959 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14960 /* port-H for side (rear panel) */
14961 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14962 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14964 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14965 /* route front mic to ADC1*/
14966 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14967 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14969 /* Unmute DAC0~3 & spdif out*/
14970 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14971 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14972 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14973 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14974 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14976 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14977 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14978 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14979 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14980 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14982 /* Unmute Stereo Mixer 15 */
14983 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14984 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14986 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14988 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14989 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14990 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14991 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14993 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14995 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14996 /* hp used DAC 3 (Front) */
14997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14998 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15003 static struct hda_verb alc861_threestack_init_verbs[] = {
15005 * Unmute ADC0 and set the default input to mic-in
15007 /* port-A for surround (rear panel) */
15008 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15009 /* port-B for mic-in (rear panel) with vref */
15010 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15011 /* port-C for line-in (rear panel) */
15012 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15013 /* port-D for Front */
15014 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15015 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15016 /* port-E for HP out (front panel) */
15017 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15018 /* route front PCM to HP */
15019 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15020 /* port-F for mic-in (front panel) with vref */
15021 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15022 /* port-G for CLFE (rear panel) */
15023 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15024 /* port-H for side (rear panel) */
15025 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15027 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15028 /* route front mic to ADC1*/
15029 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15030 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15031 /* Unmute DAC0~3 & spdif out*/
15032 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15033 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15034 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15035 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15036 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15038 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15039 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15040 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15041 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15042 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15044 /* Unmute Stereo Mixer 15 */
15045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15048 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15050 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15051 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15052 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15053 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15054 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15055 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15056 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15057 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15058 /* hp used DAC 3 (Front) */
15059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15060 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15064 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15066 * Unmute ADC0 and set the default input to mic-in
15068 /* port-A for surround (rear panel) */
15069 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15070 /* port-B for mic-in (rear panel) with vref */
15071 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15072 /* port-C for line-in (rear panel) */
15073 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15074 /* port-D for Front */
15075 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15076 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15077 /* port-E for HP out (front panel) */
15078 /* this has to be set to VREF80 */
15079 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15080 /* route front PCM to HP */
15081 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15082 /* port-F for mic-in (front panel) with vref */
15083 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15084 /* port-G for CLFE (rear panel) */
15085 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15086 /* port-H for side (rear panel) */
15087 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15089 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15090 /* route front mic to ADC1*/
15091 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15092 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15093 /* Unmute DAC0~3 & spdif out*/
15094 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15095 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15096 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15097 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15100 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15101 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15102 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15103 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15104 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15106 /* Unmute Stereo Mixer 15 */
15107 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15109 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15110 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15113 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15114 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15115 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15116 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15117 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15118 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15119 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15120 /* hp used DAC 3 (Front) */
15121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15122 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15126 static struct hda_verb alc861_asus_init_verbs[] = {
15128 * Unmute ADC0 and set the default input to mic-in
15130 /* port-A for surround (rear panel)
15131 * according to codec#0 this is the HP jack
15133 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15134 /* route front PCM to HP */
15135 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15136 /* port-B for mic-in (rear panel) with vref */
15137 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15138 /* port-C for line-in (rear panel) */
15139 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15140 /* port-D for Front */
15141 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15142 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15143 /* port-E for HP out (front panel) */
15144 /* this has to be set to VREF80 */
15145 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15146 /* route front PCM to HP */
15147 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15148 /* port-F for mic-in (front panel) with vref */
15149 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15150 /* port-G for CLFE (rear panel) */
15151 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15152 /* port-H for side (rear panel) */
15153 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15155 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15156 /* route front mic to ADC1*/
15157 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15158 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15159 /* Unmute DAC0~3 & spdif out*/
15160 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15161 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15162 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15163 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15165 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15166 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15167 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15168 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15169 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15171 /* Unmute Stereo Mixer 15 */
15172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15177 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15178 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15179 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15180 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15182 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15183 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15184 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15185 /* hp used DAC 3 (Front) */
15186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15187 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15191 /* additional init verbs for ASUS laptops */
15192 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15193 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15194 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15199 * generic initialization of ADC, input mixers and output mixers
15201 static struct hda_verb alc861_auto_init_verbs[] = {
15203 * Unmute ADC0 and set the default input to mic-in
15205 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15206 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15208 /* Unmute DAC0~3 & spdif out*/
15209 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15210 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15211 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15212 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15213 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15215 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15216 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15217 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15218 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15219 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15221 /* Unmute Stereo Mixer 15 */
15222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15227 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15228 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15229 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15230 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15231 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15232 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15233 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15234 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15236 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15237 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15238 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15239 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15240 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15241 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15242 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15243 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15245 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15250 static struct hda_verb alc861_toshiba_init_verbs[] = {
15251 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15256 /* toggle speaker-output according to the hp-jack state */
15257 static void alc861_toshiba_automute(struct hda_codec *codec)
15259 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15261 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15262 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15263 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15264 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15267 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15270 if ((res >> 26) == ALC880_HP_EVENT)
15271 alc861_toshiba_automute(codec);
15274 /* pcm configuration: identical with ALC880 */
15275 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15276 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15277 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15278 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15281 #define ALC861_DIGOUT_NID 0x07
15283 static struct hda_channel_mode alc861_8ch_modes[1] = {
15287 static hda_nid_t alc861_dac_nids[4] = {
15288 /* front, surround, clfe, side */
15289 0x03, 0x06, 0x05, 0x04
15292 static hda_nid_t alc660_dac_nids[3] = {
15293 /* front, clfe, surround */
15297 static hda_nid_t alc861_adc_nids[1] = {
15302 static struct hda_input_mux alc861_capture_source = {
15306 { "Front Mic", 0x3 },
15313 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15315 struct alc_spec *spec = codec->spec;
15316 hda_nid_t mix, srcs[5];
15319 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15321 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15324 for (i = 0; i < num; i++) {
15326 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15327 if (type != AC_WID_AUD_OUT)
15329 for (j = 0; j < spec->multiout.num_dacs; j++)
15330 if (spec->multiout.dac_nids[j] == srcs[i])
15332 if (j >= spec->multiout.num_dacs)
15338 /* fill in the dac_nids table from the parsed pin configuration */
15339 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15340 const struct auto_pin_cfg *cfg)
15342 struct alc_spec *spec = codec->spec;
15344 hda_nid_t nid, dac;
15346 spec->multiout.dac_nids = spec->private_dac_nids;
15347 for (i = 0; i < cfg->line_outs; i++) {
15348 nid = cfg->line_out_pins[i];
15349 dac = alc861_look_for_dac(codec, nid);
15352 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15357 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15358 hda_nid_t nid, unsigned int chs)
15360 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15361 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15364 /* add playback controls from the parsed DAC table */
15365 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15366 const struct auto_pin_cfg *cfg)
15368 struct alc_spec *spec = codec->spec;
15369 static const char *chname[4] = {
15370 "Front", "Surround", NULL /*CLFE*/, "Side"
15375 if (cfg->line_outs == 1) {
15376 const char *pfx = NULL;
15379 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15382 nid = spec->multiout.dac_nids[0];
15383 return alc861_create_out_sw(codec, pfx, nid, 3);
15387 for (i = 0; i < cfg->line_outs; i++) {
15388 nid = spec->multiout.dac_nids[i];
15393 err = alc861_create_out_sw(codec, "Center", nid, 1);
15396 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15400 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15408 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15410 struct alc_spec *spec = codec->spec;
15417 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15418 nid = alc861_look_for_dac(codec, pin);
15420 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15423 spec->multiout.hp_nid = nid;
15429 /* create playback/capture controls for input pins */
15430 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15431 const struct auto_pin_cfg *cfg)
15433 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15436 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15438 int pin_type, hda_nid_t dac)
15440 hda_nid_t mix, srcs[5];
15443 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15445 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15447 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15449 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15452 for (i = 0; i < num; i++) {
15454 if (srcs[i] == dac || srcs[i] == 0x15)
15455 mute = AMP_IN_UNMUTE(i);
15457 mute = AMP_IN_MUTE(i);
15458 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15463 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15465 struct alc_spec *spec = codec->spec;
15468 for (i = 0; i < spec->autocfg.line_outs; i++) {
15469 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15470 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15472 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15473 spec->multiout.dac_nids[i]);
15477 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15479 struct alc_spec *spec = codec->spec;
15481 if (spec->autocfg.hp_outs)
15482 alc861_auto_set_output_and_unmute(codec,
15483 spec->autocfg.hp_pins[0],
15485 spec->multiout.hp_nid);
15486 if (spec->autocfg.speaker_outs)
15487 alc861_auto_set_output_and_unmute(codec,
15488 spec->autocfg.speaker_pins[0],
15490 spec->multiout.dac_nids[0]);
15493 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15495 struct alc_spec *spec = codec->spec;
15498 for (i = 0; i < AUTO_PIN_LAST; i++) {
15499 hda_nid_t nid = spec->autocfg.input_pins[i];
15500 if (nid >= 0x0c && nid <= 0x11)
15501 alc_set_input_pin(codec, nid, i);
15505 /* parse the BIOS configuration and set up the alc_spec */
15506 /* return 1 if successful, 0 if the proper config is not found,
15507 * or a negative error code
15509 static int alc861_parse_auto_config(struct hda_codec *codec)
15511 struct alc_spec *spec = codec->spec;
15513 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15515 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15519 if (!spec->autocfg.line_outs)
15520 return 0; /* can't find valid BIOS pin config */
15522 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15525 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15528 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15531 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15535 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15537 alc_auto_parse_digital(codec);
15539 if (spec->kctls.list)
15540 add_mixer(spec, spec->kctls.list);
15542 add_verb(spec, alc861_auto_init_verbs);
15544 spec->num_mux_defs = 1;
15545 spec->input_mux = &spec->private_imux[0];
15547 spec->adc_nids = alc861_adc_nids;
15548 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15549 set_capture_mixer(codec);
15551 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15556 /* additional initialization for auto-configuration model */
15557 static void alc861_auto_init(struct hda_codec *codec)
15559 struct alc_spec *spec = codec->spec;
15560 alc861_auto_init_multi_out(codec);
15561 alc861_auto_init_hp_out(codec);
15562 alc861_auto_init_analog_input(codec);
15563 alc_auto_init_digital(codec);
15564 if (spec->unsol_event)
15565 alc_inithook(codec);
15568 #ifdef CONFIG_SND_HDA_POWER_SAVE
15569 static struct hda_amp_list alc861_loopbacks[] = {
15570 { 0x15, HDA_INPUT, 0 },
15571 { 0x15, HDA_INPUT, 1 },
15572 { 0x15, HDA_INPUT, 2 },
15573 { 0x15, HDA_INPUT, 3 },
15580 * configuration and preset
15582 static const char *alc861_models[ALC861_MODEL_LAST] = {
15583 [ALC861_3ST] = "3stack",
15584 [ALC660_3ST] = "3stack-660",
15585 [ALC861_3ST_DIG] = "3stack-dig",
15586 [ALC861_6ST_DIG] = "6stack-dig",
15587 [ALC861_UNIWILL_M31] = "uniwill-m31",
15588 [ALC861_TOSHIBA] = "toshiba",
15589 [ALC861_ASUS] = "asus",
15590 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15591 [ALC861_AUTO] = "auto",
15594 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15595 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15596 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15597 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15598 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15599 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15600 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15601 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15602 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15603 * Any other models that need this preset?
15605 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15606 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15607 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15608 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15609 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15610 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15611 /* FIXME: the below seems conflict */
15612 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15613 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15614 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15618 static struct alc_config_preset alc861_presets[] = {
15620 .mixers = { alc861_3ST_mixer },
15621 .init_verbs = { alc861_threestack_init_verbs },
15622 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15623 .dac_nids = alc861_dac_nids,
15624 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15625 .channel_mode = alc861_threestack_modes,
15627 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15628 .adc_nids = alc861_adc_nids,
15629 .input_mux = &alc861_capture_source,
15631 [ALC861_3ST_DIG] = {
15632 .mixers = { alc861_base_mixer },
15633 .init_verbs = { alc861_threestack_init_verbs },
15634 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15635 .dac_nids = alc861_dac_nids,
15636 .dig_out_nid = ALC861_DIGOUT_NID,
15637 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15638 .channel_mode = alc861_threestack_modes,
15640 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15641 .adc_nids = alc861_adc_nids,
15642 .input_mux = &alc861_capture_source,
15644 [ALC861_6ST_DIG] = {
15645 .mixers = { alc861_base_mixer },
15646 .init_verbs = { alc861_base_init_verbs },
15647 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15648 .dac_nids = alc861_dac_nids,
15649 .dig_out_nid = ALC861_DIGOUT_NID,
15650 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15651 .channel_mode = alc861_8ch_modes,
15652 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15653 .adc_nids = alc861_adc_nids,
15654 .input_mux = &alc861_capture_source,
15657 .mixers = { alc861_3ST_mixer },
15658 .init_verbs = { alc861_threestack_init_verbs },
15659 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15660 .dac_nids = alc660_dac_nids,
15661 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15662 .channel_mode = alc861_threestack_modes,
15664 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15665 .adc_nids = alc861_adc_nids,
15666 .input_mux = &alc861_capture_source,
15668 [ALC861_UNIWILL_M31] = {
15669 .mixers = { alc861_uniwill_m31_mixer },
15670 .init_verbs = { alc861_uniwill_m31_init_verbs },
15671 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15672 .dac_nids = alc861_dac_nids,
15673 .dig_out_nid = ALC861_DIGOUT_NID,
15674 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15675 .channel_mode = alc861_uniwill_m31_modes,
15677 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15678 .adc_nids = alc861_adc_nids,
15679 .input_mux = &alc861_capture_source,
15681 [ALC861_TOSHIBA] = {
15682 .mixers = { alc861_toshiba_mixer },
15683 .init_verbs = { alc861_base_init_verbs,
15684 alc861_toshiba_init_verbs },
15685 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15686 .dac_nids = alc861_dac_nids,
15687 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15688 .channel_mode = alc883_3ST_2ch_modes,
15689 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15690 .adc_nids = alc861_adc_nids,
15691 .input_mux = &alc861_capture_source,
15692 .unsol_event = alc861_toshiba_unsol_event,
15693 .init_hook = alc861_toshiba_automute,
15696 .mixers = { alc861_asus_mixer },
15697 .init_verbs = { alc861_asus_init_verbs },
15698 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15699 .dac_nids = alc861_dac_nids,
15700 .dig_out_nid = ALC861_DIGOUT_NID,
15701 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15702 .channel_mode = alc861_asus_modes,
15705 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15706 .adc_nids = alc861_adc_nids,
15707 .input_mux = &alc861_capture_source,
15709 [ALC861_ASUS_LAPTOP] = {
15710 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15711 .init_verbs = { alc861_asus_init_verbs,
15712 alc861_asus_laptop_init_verbs },
15713 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15714 .dac_nids = alc861_dac_nids,
15715 .dig_out_nid = ALC861_DIGOUT_NID,
15716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15717 .channel_mode = alc883_3ST_2ch_modes,
15719 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15720 .adc_nids = alc861_adc_nids,
15721 .input_mux = &alc861_capture_source,
15725 /* Pin config fixes */
15727 PINFIX_FSC_AMILO_PI1505,
15730 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15731 { 0x0b, 0x0221101f }, /* HP */
15732 { 0x0f, 0x90170310 }, /* speaker */
15736 static const struct alc_fixup alc861_fixups[] = {
15737 [PINFIX_FSC_AMILO_PI1505] = {
15738 .pins = alc861_fsc_amilo_pi1505_pinfix
15742 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15743 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15747 static int patch_alc861(struct hda_codec *codec)
15749 struct alc_spec *spec;
15753 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15757 codec->spec = spec;
15759 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15763 if (board_config < 0) {
15764 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15766 board_config = ALC861_AUTO;
15769 if (board_config == ALC861_AUTO)
15770 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15772 if (board_config == ALC861_AUTO) {
15773 /* automatic parse from the BIOS config */
15774 err = alc861_parse_auto_config(codec);
15780 "hda_codec: Cannot set up configuration "
15781 "from BIOS. Using base mode...\n");
15782 board_config = ALC861_3ST_DIG;
15786 err = snd_hda_attach_beep_device(codec, 0x23);
15792 if (board_config != ALC861_AUTO)
15793 setup_preset(codec, &alc861_presets[board_config]);
15795 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15796 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15798 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15799 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15801 if (!spec->cap_mixer)
15802 set_capture_mixer(codec);
15803 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15805 spec->vmaster_nid = 0x03;
15807 if (board_config == ALC861_AUTO)
15808 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15810 codec->patch_ops = alc_patch_ops;
15811 if (board_config == ALC861_AUTO) {
15812 spec->init_hook = alc861_auto_init;
15813 #ifdef CONFIG_SND_HDA_POWER_SAVE
15814 spec->power_hook = alc_power_eapd;
15817 #ifdef CONFIG_SND_HDA_POWER_SAVE
15818 if (!spec->loopback.amplist)
15819 spec->loopback.amplist = alc861_loopbacks;
15826 * ALC861-VD support
15830 * In addition, an independent DAC
15832 #define ALC861VD_DIGOUT_NID 0x06
15834 static hda_nid_t alc861vd_dac_nids[4] = {
15835 /* front, surr, clfe, side surr */
15836 0x02, 0x03, 0x04, 0x05
15839 /* dac_nids for ALC660vd are in a different order - according to
15840 * Realtek's driver.
15841 * This should probably result in a different mixer for 6stack models
15842 * of ALC660vd codecs, but for now there is only 3stack mixer
15843 * - and it is the same as in 861vd.
15844 * adc_nids in ALC660vd are (is) the same as in 861vd
15846 static hda_nid_t alc660vd_dac_nids[3] = {
15847 /* front, rear, clfe, rear_surr */
15851 static hda_nid_t alc861vd_adc_nids[1] = {
15856 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15859 /* FIXME: should be a matrix-type input source selection */
15860 static struct hda_input_mux alc861vd_capture_source = {
15864 { "Front Mic", 0x1 },
15870 static struct hda_input_mux alc861vd_dallas_capture_source = {
15873 { "Ext Mic", 0x0 },
15874 { "Int Mic", 0x1 },
15878 static struct hda_input_mux alc861vd_hp_capture_source = {
15881 { "Front Mic", 0x0 },
15882 { "ATAPI Mic", 0x1 },
15889 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15896 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15897 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15898 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15899 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15900 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15907 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15908 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15909 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15910 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15911 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15915 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15916 { 6, alc861vd_6stack_ch6_init },
15917 { 8, alc861vd_6stack_ch8_init },
15920 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15923 .name = "Channel Mode",
15924 .info = alc_ch_mode_info,
15925 .get = alc_ch_mode_get,
15926 .put = alc_ch_mode_put,
15931 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15932 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15934 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15935 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15936 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15938 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15939 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15941 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15943 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15945 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15946 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15948 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15949 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15951 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15953 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15955 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15957 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15961 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15962 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15964 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15965 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15970 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15971 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15972 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 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_lenovo_mixer[] = {
15994 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15995 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15996 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16000 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16001 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16004 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16005 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16006 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16014 /* Pin assignment: Speaker=0x14, HP = 0x15,
16015 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16017 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16019 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16020 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16021 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16022 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16023 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16024 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16025 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16026 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16027 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16031 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16032 * Front Mic=0x18, ATAPI Mic = 0x19,
16034 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16035 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16036 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16037 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16038 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16039 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16040 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16041 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16042 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16048 * generic initialization of ADC, input mixers and output mixers
16050 static struct hda_verb alc861vd_volume_init_verbs[] = {
16052 * Unmute ADC0 and set the default input to mic-in
16054 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16055 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16057 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16058 * the analog-loopback mixer widget
16060 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16067 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16074 * Set up output mixers (0x02 - 0x05)
16076 /* set vol=0 to output mixers */
16077 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16078 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16079 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16080 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16082 /* set up input amps for analog loopback */
16083 /* Amp Indices: DAC = 0, mixer = 1 */
16084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16097 * 3-stack pin configuration:
16098 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16100 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16102 * Set pin mode and muting
16104 /* set front pin widgets 0x14 for output */
16105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16107 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16109 /* Mic (rear) pin: input vref at 80% */
16110 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16111 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16112 /* Front Mic pin: input vref at 80% */
16113 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16114 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16115 /* Line In pin: input */
16116 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16117 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16118 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16119 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16120 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16121 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16122 /* CD pin widget for input */
16123 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16129 * 6-stack pin configuration:
16131 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16133 * Set pin mode and muting
16135 /* set front pin widgets 0x14 for output */
16136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16138 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16140 /* Rear Pin: output 1 (0x0d) */
16141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16143 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16144 /* CLFE Pin: output 2 (0x0e) */
16145 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16146 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16147 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16148 /* Side Pin: output 3 (0x0f) */
16149 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16150 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16151 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16153 /* Mic (rear) pin: input vref at 80% */
16154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16155 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16156 /* Front Mic pin: input vref at 80% */
16157 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16159 /* Line In pin: input */
16160 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16161 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16162 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16164 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16165 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16166 /* CD pin widget for input */
16167 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16172 static struct hda_verb alc861vd_eapd_verbs[] = {
16173 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16177 static struct hda_verb alc660vd_eapd_verbs[] = {
16178 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16179 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16183 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16187 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16188 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16192 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16194 unsigned int present;
16195 unsigned char bits;
16197 present = snd_hda_jack_detect(codec, 0x18);
16198 bits = present ? HDA_AMP_MUTE : 0;
16200 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16201 HDA_AMP_MUTE, bits);
16204 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16206 struct alc_spec *spec = codec->spec;
16207 spec->autocfg.hp_pins[0] = 0x1b;
16208 spec->autocfg.speaker_pins[0] = 0x14;
16211 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16213 alc_automute_amp(codec);
16214 alc861vd_lenovo_mic_automute(codec);
16217 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16220 switch (res >> 26) {
16221 case ALC880_MIC_EVENT:
16222 alc861vd_lenovo_mic_automute(codec);
16225 alc_automute_amp_unsol_event(codec, res);
16230 static struct hda_verb alc861vd_dallas_verbs[] = {
16231 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16232 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16233 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16234 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16237 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16238 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16240 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16241 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16242 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16243 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16245 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16246 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16249 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16250 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16251 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16252 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16254 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16255 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16256 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16258 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16259 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16260 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16261 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16269 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16270 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16275 /* toggle speaker-output according to the hp-jack state */
16276 static void alc861vd_dallas_setup(struct hda_codec *codec)
16278 struct alc_spec *spec = codec->spec;
16280 spec->autocfg.hp_pins[0] = 0x15;
16281 spec->autocfg.speaker_pins[0] = 0x14;
16284 #ifdef CONFIG_SND_HDA_POWER_SAVE
16285 #define alc861vd_loopbacks alc880_loopbacks
16288 /* pcm configuration: identical with ALC880 */
16289 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16290 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16291 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16292 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16295 * configuration and preset
16297 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16298 [ALC660VD_3ST] = "3stack-660",
16299 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16300 [ALC660VD_ASUS_V1S] = "asus-v1s",
16301 [ALC861VD_3ST] = "3stack",
16302 [ALC861VD_3ST_DIG] = "3stack-digout",
16303 [ALC861VD_6ST_DIG] = "6stack-digout",
16304 [ALC861VD_LENOVO] = "lenovo",
16305 [ALC861VD_DALLAS] = "dallas",
16306 [ALC861VD_HP] = "hp",
16307 [ALC861VD_AUTO] = "auto",
16310 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16311 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16312 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16313 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16314 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16315 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16316 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16317 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16318 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16319 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16320 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16321 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16322 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16323 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16324 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16325 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16329 static struct alc_config_preset alc861vd_presets[] = {
16331 .mixers = { alc861vd_3st_mixer },
16332 .init_verbs = { alc861vd_volume_init_verbs,
16333 alc861vd_3stack_init_verbs },
16334 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16335 .dac_nids = alc660vd_dac_nids,
16336 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16337 .channel_mode = alc861vd_3stack_2ch_modes,
16338 .input_mux = &alc861vd_capture_source,
16340 [ALC660VD_3ST_DIG] = {
16341 .mixers = { alc861vd_3st_mixer },
16342 .init_verbs = { alc861vd_volume_init_verbs,
16343 alc861vd_3stack_init_verbs },
16344 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16345 .dac_nids = alc660vd_dac_nids,
16346 .dig_out_nid = ALC861VD_DIGOUT_NID,
16347 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16348 .channel_mode = alc861vd_3stack_2ch_modes,
16349 .input_mux = &alc861vd_capture_source,
16352 .mixers = { alc861vd_3st_mixer },
16353 .init_verbs = { alc861vd_volume_init_verbs,
16354 alc861vd_3stack_init_verbs },
16355 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16356 .dac_nids = alc861vd_dac_nids,
16357 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16358 .channel_mode = alc861vd_3stack_2ch_modes,
16359 .input_mux = &alc861vd_capture_source,
16361 [ALC861VD_3ST_DIG] = {
16362 .mixers = { alc861vd_3st_mixer },
16363 .init_verbs = { alc861vd_volume_init_verbs,
16364 alc861vd_3stack_init_verbs },
16365 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16366 .dac_nids = alc861vd_dac_nids,
16367 .dig_out_nid = ALC861VD_DIGOUT_NID,
16368 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16369 .channel_mode = alc861vd_3stack_2ch_modes,
16370 .input_mux = &alc861vd_capture_source,
16372 [ALC861VD_6ST_DIG] = {
16373 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16374 .init_verbs = { alc861vd_volume_init_verbs,
16375 alc861vd_6stack_init_verbs },
16376 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16377 .dac_nids = alc861vd_dac_nids,
16378 .dig_out_nid = ALC861VD_DIGOUT_NID,
16379 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16380 .channel_mode = alc861vd_6stack_modes,
16381 .input_mux = &alc861vd_capture_source,
16383 [ALC861VD_LENOVO] = {
16384 .mixers = { alc861vd_lenovo_mixer },
16385 .init_verbs = { alc861vd_volume_init_verbs,
16386 alc861vd_3stack_init_verbs,
16387 alc861vd_eapd_verbs,
16388 alc861vd_lenovo_unsol_verbs },
16389 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16390 .dac_nids = alc660vd_dac_nids,
16391 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16392 .channel_mode = alc861vd_3stack_2ch_modes,
16393 .input_mux = &alc861vd_capture_source,
16394 .unsol_event = alc861vd_lenovo_unsol_event,
16395 .setup = alc861vd_lenovo_setup,
16396 .init_hook = alc861vd_lenovo_init_hook,
16398 [ALC861VD_DALLAS] = {
16399 .mixers = { alc861vd_dallas_mixer },
16400 .init_verbs = { alc861vd_dallas_verbs },
16401 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16402 .dac_nids = alc861vd_dac_nids,
16403 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16404 .channel_mode = alc861vd_3stack_2ch_modes,
16405 .input_mux = &alc861vd_dallas_capture_source,
16406 .unsol_event = alc_automute_amp_unsol_event,
16407 .setup = alc861vd_dallas_setup,
16408 .init_hook = alc_automute_amp,
16411 .mixers = { alc861vd_hp_mixer },
16412 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16413 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16414 .dac_nids = alc861vd_dac_nids,
16415 .dig_out_nid = ALC861VD_DIGOUT_NID,
16416 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16417 .channel_mode = alc861vd_3stack_2ch_modes,
16418 .input_mux = &alc861vd_hp_capture_source,
16419 .unsol_event = alc_automute_amp_unsol_event,
16420 .setup = alc861vd_dallas_setup,
16421 .init_hook = alc_automute_amp,
16423 [ALC660VD_ASUS_V1S] = {
16424 .mixers = { alc861vd_lenovo_mixer },
16425 .init_verbs = { alc861vd_volume_init_verbs,
16426 alc861vd_3stack_init_verbs,
16427 alc861vd_eapd_verbs,
16428 alc861vd_lenovo_unsol_verbs },
16429 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16430 .dac_nids = alc660vd_dac_nids,
16431 .dig_out_nid = ALC861VD_DIGOUT_NID,
16432 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16433 .channel_mode = alc861vd_3stack_2ch_modes,
16434 .input_mux = &alc861vd_capture_source,
16435 .unsol_event = alc861vd_lenovo_unsol_event,
16436 .setup = alc861vd_lenovo_setup,
16437 .init_hook = alc861vd_lenovo_init_hook,
16442 * BIOS auto configuration
16444 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16445 const struct auto_pin_cfg *cfg)
16447 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16451 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16452 hda_nid_t nid, int pin_type, int dac_idx)
16454 alc_set_pin_output(codec, nid, pin_type);
16457 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16459 struct alc_spec *spec = codec->spec;
16462 for (i = 0; i <= HDA_SIDE; i++) {
16463 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16464 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16466 alc861vd_auto_set_output_and_unmute(codec, nid,
16472 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16474 struct alc_spec *spec = codec->spec;
16477 pin = spec->autocfg.hp_pins[0];
16478 if (pin) /* connect to front and use dac 0 */
16479 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16480 pin = spec->autocfg.speaker_pins[0];
16482 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16485 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16487 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16489 struct alc_spec *spec = codec->spec;
16492 for (i = 0; i < AUTO_PIN_LAST; i++) {
16493 hda_nid_t nid = spec->autocfg.input_pins[i];
16494 if (alc_is_input_pin(codec, nid)) {
16495 alc_set_input_pin(codec, nid, i);
16496 if (nid != ALC861VD_PIN_CD_NID &&
16497 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16498 snd_hda_codec_write(codec, nid, 0,
16499 AC_VERB_SET_AMP_GAIN_MUTE,
16505 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16507 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16508 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16510 /* add playback controls from the parsed DAC table */
16511 /* Based on ALC880 version. But ALC861VD has separate,
16512 * different NIDs for mute/unmute switch and volume control */
16513 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16514 const struct auto_pin_cfg *cfg)
16516 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16517 hda_nid_t nid_v, nid_s;
16520 for (i = 0; i < cfg->line_outs; i++) {
16521 if (!spec->multiout.dac_nids[i])
16523 nid_v = alc861vd_idx_to_mixer_vol(
16525 spec->multiout.dac_nids[i]));
16526 nid_s = alc861vd_idx_to_mixer_switch(
16528 spec->multiout.dac_nids[i]));
16532 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16534 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16538 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16540 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16544 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16546 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16550 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16552 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16558 if (cfg->line_outs == 1 &&
16559 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16566 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16567 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16571 if (cfg->line_outs == 1 &&
16572 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16574 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16575 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16584 /* add playback controls for speaker and HP outputs */
16585 /* Based on ALC880 version. But ALC861VD has separate,
16586 * different NIDs for mute/unmute switch and volume control */
16587 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16588 hda_nid_t pin, const char *pfx)
16590 hda_nid_t nid_v, nid_s;
16596 if (alc880_is_fixed_pin(pin)) {
16597 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16598 /* specify the DAC as the extra output */
16599 if (!spec->multiout.hp_nid)
16600 spec->multiout.hp_nid = nid_v;
16602 spec->multiout.extra_out_nid[0] = nid_v;
16603 /* control HP volume/switch on the output mixer amp */
16604 nid_v = alc861vd_idx_to_mixer_vol(
16605 alc880_fixed_pin_idx(pin));
16606 nid_s = alc861vd_idx_to_mixer_switch(
16607 alc880_fixed_pin_idx(pin));
16609 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16610 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16613 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16614 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16617 } else if (alc880_is_multi_pin(pin)) {
16618 /* set manual connection */
16619 /* we have only a switch on HP-out PIN */
16620 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16621 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16628 /* parse the BIOS configuration and set up the alc_spec
16629 * return 1 if successful, 0 if the proper config is not found,
16630 * or a negative error code
16631 * Based on ALC880 version - had to change it to override
16632 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16633 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16635 struct alc_spec *spec = codec->spec;
16637 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16639 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16643 if (!spec->autocfg.line_outs)
16644 return 0; /* can't find valid BIOS pin config */
16646 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16649 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16652 err = alc861vd_auto_create_extra_out(spec,
16653 spec->autocfg.speaker_pins[0],
16657 err = alc861vd_auto_create_extra_out(spec,
16658 spec->autocfg.hp_pins[0],
16662 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16666 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16668 alc_auto_parse_digital(codec);
16670 if (spec->kctls.list)
16671 add_mixer(spec, spec->kctls.list);
16673 add_verb(spec, alc861vd_volume_init_verbs);
16675 spec->num_mux_defs = 1;
16676 spec->input_mux = &spec->private_imux[0];
16678 err = alc_auto_add_mic_boost(codec);
16682 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16687 /* additional initialization for auto-configuration model */
16688 static void alc861vd_auto_init(struct hda_codec *codec)
16690 struct alc_spec *spec = codec->spec;
16691 alc861vd_auto_init_multi_out(codec);
16692 alc861vd_auto_init_hp_out(codec);
16693 alc861vd_auto_init_analog_input(codec);
16694 alc861vd_auto_init_input_src(codec);
16695 alc_auto_init_digital(codec);
16696 if (spec->unsol_event)
16697 alc_inithook(codec);
16701 ALC660VD_FIX_ASUS_GPIO1
16705 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16706 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16707 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16708 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16712 static const struct alc_fixup alc861vd_fixups[] = {
16713 [ALC660VD_FIX_ASUS_GPIO1] = {
16714 .verbs = alc660vd_fix_asus_gpio1_verbs,
16718 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16719 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16723 static int patch_alc861vd(struct hda_codec *codec)
16725 struct alc_spec *spec;
16726 int err, board_config;
16728 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16732 codec->spec = spec;
16734 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16738 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16739 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16741 board_config = ALC861VD_AUTO;
16744 if (board_config == ALC861VD_AUTO)
16745 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16747 if (board_config == ALC861VD_AUTO) {
16748 /* automatic parse from the BIOS config */
16749 err = alc861vd_parse_auto_config(codec);
16755 "hda_codec: Cannot set up configuration "
16756 "from BIOS. Using base mode...\n");
16757 board_config = ALC861VD_3ST;
16761 err = snd_hda_attach_beep_device(codec, 0x23);
16767 if (board_config != ALC861VD_AUTO)
16768 setup_preset(codec, &alc861vd_presets[board_config]);
16770 if (codec->vendor_id == 0x10ec0660) {
16771 /* always turn on EAPD */
16772 add_verb(spec, alc660vd_eapd_verbs);
16775 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16776 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16778 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16779 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16781 if (!spec->adc_nids) {
16782 spec->adc_nids = alc861vd_adc_nids;
16783 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16785 if (!spec->capsrc_nids)
16786 spec->capsrc_nids = alc861vd_capsrc_nids;
16788 set_capture_mixer(codec);
16789 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16791 spec->vmaster_nid = 0x02;
16793 if (board_config == ALC861VD_AUTO)
16794 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16796 codec->patch_ops = alc_patch_ops;
16798 if (board_config == ALC861VD_AUTO)
16799 spec->init_hook = alc861vd_auto_init;
16800 #ifdef CONFIG_SND_HDA_POWER_SAVE
16801 if (!spec->loopback.amplist)
16802 spec->loopback.amplist = alc861vd_loopbacks;
16811 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16812 * configuration. Each pin widget can choose any input DACs and a mixer.
16813 * Each ADC is connected from a mixer of all inputs. This makes possible
16814 * 6-channel independent captures.
16816 * In addition, an independent DAC for the multi-playback (not used in this
16819 #define ALC662_DIGOUT_NID 0x06
16820 #define ALC662_DIGIN_NID 0x0a
16822 static hda_nid_t alc662_dac_nids[4] = {
16823 /* front, rear, clfe, rear_surr */
16827 static hda_nid_t alc272_dac_nids[2] = {
16831 static hda_nid_t alc662_adc_nids[2] = {
16836 static hda_nid_t alc272_adc_nids[1] = {
16841 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16842 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16846 /* FIXME: should be a matrix-type input source selection */
16847 static struct hda_input_mux alc662_capture_source = {
16851 { "Front Mic", 0x1 },
16857 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16865 static struct hda_input_mux alc663_capture_source = {
16869 { "Front Mic", 0x1 },
16874 #if 0 /* set to 1 for testing other input sources below */
16875 static struct hda_input_mux alc272_nc10_capture_source = {
16878 { "Autoselect Mic", 0x0 },
16879 { "Internal Mic", 0x1 },
16880 { "In-0x02", 0x2 },
16881 { "In-0x03", 0x3 },
16882 { "In-0x04", 0x4 },
16883 { "In-0x05", 0x5 },
16884 { "In-0x06", 0x6 },
16885 { "In-0x07", 0x7 },
16886 { "In-0x08", 0x8 },
16887 { "In-0x09", 0x9 },
16888 { "In-0x0a", 0x0a },
16889 { "In-0x0b", 0x0b },
16890 { "In-0x0c", 0x0c },
16891 { "In-0x0d", 0x0d },
16892 { "In-0x0e", 0x0e },
16893 { "In-0x0f", 0x0f },
16901 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16908 static struct hda_verb alc662_3ST_ch2_init[] = {
16909 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16910 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16919 static struct hda_verb alc662_3ST_ch6_init[] = {
16920 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16921 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16922 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16923 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16924 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16925 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16929 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16930 { 2, alc662_3ST_ch2_init },
16931 { 6, alc662_3ST_ch6_init },
16937 static struct hda_verb alc662_sixstack_ch6_init[] = {
16938 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16939 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16940 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16947 static struct hda_verb alc662_sixstack_ch8_init[] = {
16948 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16949 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16950 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16954 static struct hda_channel_mode alc662_5stack_modes[2] = {
16955 { 2, alc662_sixstack_ch6_init },
16956 { 6, alc662_sixstack_ch8_init },
16959 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16960 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16963 static struct snd_kcontrol_new alc662_base_mixer[] = {
16964 /* output mixer control */
16965 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16966 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16967 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16968 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16969 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16970 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16971 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16972 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16975 /*Input mixer control */
16976 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16977 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16978 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16979 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16980 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16981 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16982 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16983 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16987 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16988 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16989 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16991 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16992 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16997 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16998 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17002 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17003 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17004 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17005 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17006 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17007 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17008 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17009 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17010 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17012 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17013 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17018 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17019 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17023 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17024 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17025 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17026 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17027 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17028 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17030 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17036 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17037 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17038 ALC262_HIPPO_MASTER_SWITCH,
17040 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17041 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17042 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17044 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17045 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17046 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17050 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17051 ALC262_HIPPO_MASTER_SWITCH,
17052 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17053 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17054 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17055 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17056 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17057 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17058 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17064 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17065 .ops = &snd_hda_bind_vol,
17067 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17068 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17073 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17074 .ops = &snd_hda_bind_sw,
17076 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17077 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17082 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17083 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17084 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17086 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17090 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17091 .ops = &snd_hda_bind_sw,
17093 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17094 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17095 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17100 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17101 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17102 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17105 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17106 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17111 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17112 .ops = &snd_hda_bind_sw,
17114 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17115 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17116 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17121 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17122 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17123 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17126 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17127 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17131 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17132 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17133 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17134 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17137 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17138 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17142 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17143 .ops = &snd_hda_bind_vol,
17145 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17146 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17151 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17152 .ops = &snd_hda_bind_sw,
17154 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17155 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17160 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17161 HDA_BIND_VOL("Master Playback Volume",
17162 &alc663_asus_two_bind_master_vol),
17163 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17164 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17171 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17172 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17173 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17174 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17181 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17182 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17183 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17184 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17185 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17189 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17190 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17191 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17195 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17196 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17197 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17202 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17203 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17204 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17205 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17209 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17210 .ops = &snd_hda_bind_sw,
17212 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17213 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17214 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17215 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17216 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17221 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17222 .ops = &snd_hda_bind_sw,
17224 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17225 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17230 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17231 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17232 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17233 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17234 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17235 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17236 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17237 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17243 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17244 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17245 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17246 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17247 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17248 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17255 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17257 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17258 .name = "Channel Mode",
17259 .info = alc_ch_mode_info,
17260 .get = alc_ch_mode_get,
17261 .put = alc_ch_mode_put,
17266 static struct hda_verb alc662_init_verbs[] = {
17267 /* ADC: mute amp left and right */
17268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17269 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17271 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17272 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17274 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17275 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17278 /* Front Pin: output 0 (0x0c) */
17279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17280 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17282 /* Rear Pin: output 1 (0x0d) */
17283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17286 /* CLFE Pin: output 2 (0x0e) */
17287 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17288 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17290 /* Mic (rear) pin: input vref at 80% */
17291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17293 /* Front Mic pin: input vref at 80% */
17294 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17295 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17296 /* Line In pin: input */
17297 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17299 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17300 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17302 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17303 /* CD pin widget for input */
17304 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17306 /* FIXME: use matrix-type input source selection */
17307 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17312 /* always trun on EAPD */
17313 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17314 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17319 static struct hda_verb alc663_init_verbs[] = {
17320 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17321 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17322 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17323 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17329 static struct hda_verb alc272_init_verbs[] = {
17330 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17331 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17332 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17333 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17334 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17335 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17337 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17341 static struct hda_verb alc662_sue_init_verbs[] = {
17342 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17343 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17347 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17348 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17349 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17353 /* Set Unsolicited Event*/
17354 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17355 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17356 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17360 static struct hda_verb alc663_m51va_init_verbs[] = {
17361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17362 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17363 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17364 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17365 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17368 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17369 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17373 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17374 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17375 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17376 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17378 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17379 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17380 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17384 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17385 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17386 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17387 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17388 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17390 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17391 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17392 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17396 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17399 {0x15, 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 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17407 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17408 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17409 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17410 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17411 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17413 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17414 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17417 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17418 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17419 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17423 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17424 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17426 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17427 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17428 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17429 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17430 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17433 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17434 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17435 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17439 static struct hda_verb alc663_g71v_init_verbs[] = {
17440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17441 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17442 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17444 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17445 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17446 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17448 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17449 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17450 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17454 static struct hda_verb alc663_g50v_init_verbs[] = {
17455 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17456 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17457 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17459 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17460 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17464 static struct hda_verb alc662_ecs_init_verbs[] = {
17465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17467 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17468 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17472 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17473 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17474 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17476 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17477 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17478 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17479 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
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 alc272_dell_init_verbs[] = {
17488 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17489 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17490 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17491 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17492 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17493 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17494 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17497 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17498 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17502 static struct hda_verb alc663_mode7_init_verbs[] = {
17503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17504 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17505 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17506 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17510 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17511 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17512 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17514 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17515 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17516 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17517 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17521 static struct hda_verb alc663_mode8_init_verbs[] = {
17522 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17525 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17526 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17527 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17528 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17529 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17530 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17531 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17532 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17536 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17537 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17541 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17542 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17543 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17547 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17548 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17549 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17553 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17555 unsigned int present;
17556 unsigned char bits;
17558 present = snd_hda_jack_detect(codec, 0x14);
17559 bits = present ? HDA_AMP_MUTE : 0;
17561 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17562 HDA_AMP_MUTE, bits);
17565 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17567 unsigned int present;
17568 unsigned char bits;
17570 present = snd_hda_jack_detect(codec, 0x1b);
17571 bits = present ? HDA_AMP_MUTE : 0;
17573 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17574 HDA_AMP_MUTE, bits);
17575 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17576 HDA_AMP_MUTE, bits);
17579 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17582 if ((res >> 26) == ALC880_HP_EVENT)
17583 alc662_lenovo_101e_all_automute(codec);
17584 if ((res >> 26) == ALC880_FRONT_EVENT)
17585 alc662_lenovo_101e_ispeaker_automute(codec);
17588 /* unsolicited event for HP jack sensing */
17589 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17592 if ((res >> 26) == ALC880_MIC_EVENT)
17593 alc_mic_automute(codec);
17595 alc262_hippo_unsol_event(codec, res);
17598 static void alc662_eeepc_setup(struct hda_codec *codec)
17600 struct alc_spec *spec = codec->spec;
17602 alc262_hippo1_setup(codec);
17603 spec->ext_mic.pin = 0x18;
17604 spec->ext_mic.mux_idx = 0;
17605 spec->int_mic.pin = 0x19;
17606 spec->int_mic.mux_idx = 1;
17607 spec->auto_mic = 1;
17610 static void alc662_eeepc_inithook(struct hda_codec *codec)
17612 alc262_hippo_automute(codec);
17613 alc_mic_automute(codec);
17616 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17618 struct alc_spec *spec = codec->spec;
17620 spec->autocfg.hp_pins[0] = 0x14;
17621 spec->autocfg.speaker_pins[0] = 0x1b;
17624 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17626 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17628 unsigned int present;
17629 unsigned char bits;
17631 present = snd_hda_jack_detect(codec, 0x21);
17632 bits = present ? HDA_AMP_MUTE : 0;
17633 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17634 HDA_AMP_MUTE, bits);
17635 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17636 HDA_AMP_MUTE, bits);
17639 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17641 unsigned int present;
17642 unsigned char bits;
17644 present = snd_hda_jack_detect(codec, 0x21);
17645 bits = present ? HDA_AMP_MUTE : 0;
17646 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17647 HDA_AMP_MUTE, bits);
17648 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17649 HDA_AMP_MUTE, bits);
17650 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17651 HDA_AMP_MUTE, bits);
17652 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17653 HDA_AMP_MUTE, bits);
17656 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17658 unsigned int present;
17659 unsigned char bits;
17661 present = snd_hda_jack_detect(codec, 0x15);
17662 bits = present ? HDA_AMP_MUTE : 0;
17663 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17664 HDA_AMP_MUTE, bits);
17665 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17666 HDA_AMP_MUTE, bits);
17667 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17668 HDA_AMP_MUTE, bits);
17669 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17670 HDA_AMP_MUTE, bits);
17673 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17675 unsigned int present;
17676 unsigned char bits;
17678 present = snd_hda_jack_detect(codec, 0x1b);
17679 bits = present ? 0 : PIN_OUT;
17680 snd_hda_codec_write(codec, 0x14, 0,
17681 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17684 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17686 unsigned int present1, present2;
17688 present1 = snd_hda_jack_detect(codec, 0x21);
17689 present2 = snd_hda_jack_detect(codec, 0x15);
17691 if (present1 || present2) {
17692 snd_hda_codec_write_cache(codec, 0x14, 0,
17693 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17695 snd_hda_codec_write_cache(codec, 0x14, 0,
17696 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17700 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17702 unsigned int present1, present2;
17704 present1 = snd_hda_jack_detect(codec, 0x1b);
17705 present2 = snd_hda_jack_detect(codec, 0x15);
17707 if (present1 || present2) {
17708 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17709 HDA_AMP_MUTE, HDA_AMP_MUTE);
17710 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17711 HDA_AMP_MUTE, HDA_AMP_MUTE);
17713 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17715 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17720 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17722 unsigned int present1, present2;
17724 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17725 AC_VERB_GET_PIN_SENSE, 0)
17726 & AC_PINSENSE_PRESENCE;
17727 present2 = snd_hda_codec_read(codec, 0x21, 0,
17728 AC_VERB_GET_PIN_SENSE, 0)
17729 & AC_PINSENSE_PRESENCE;
17731 if (present1 || present2) {
17732 snd_hda_codec_write_cache(codec, 0x14, 0,
17733 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17734 snd_hda_codec_write_cache(codec, 0x17, 0,
17735 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17737 snd_hda_codec_write_cache(codec, 0x14, 0,
17738 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17739 snd_hda_codec_write_cache(codec, 0x17, 0,
17740 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17744 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17746 unsigned int present1, present2;
17748 present1 = snd_hda_codec_read(codec, 0x21, 0,
17749 AC_VERB_GET_PIN_SENSE, 0)
17750 & AC_PINSENSE_PRESENCE;
17751 present2 = snd_hda_codec_read(codec, 0x15, 0,
17752 AC_VERB_GET_PIN_SENSE, 0)
17753 & AC_PINSENSE_PRESENCE;
17755 if (present1 || present2) {
17756 snd_hda_codec_write_cache(codec, 0x14, 0,
17757 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17758 snd_hda_codec_write_cache(codec, 0x17, 0,
17759 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17761 snd_hda_codec_write_cache(codec, 0x14, 0,
17762 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17763 snd_hda_codec_write_cache(codec, 0x17, 0,
17764 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17768 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17771 switch (res >> 26) {
17772 case ALC880_HP_EVENT:
17773 alc663_m51va_speaker_automute(codec);
17775 case ALC880_MIC_EVENT:
17776 alc_mic_automute(codec);
17781 static void alc663_m51va_setup(struct hda_codec *codec)
17783 struct alc_spec *spec = codec->spec;
17784 spec->ext_mic.pin = 0x18;
17785 spec->ext_mic.mux_idx = 0;
17786 spec->int_mic.pin = 0x12;
17787 spec->int_mic.mux_idx = 9;
17788 spec->auto_mic = 1;
17791 static void alc663_m51va_inithook(struct hda_codec *codec)
17793 alc663_m51va_speaker_automute(codec);
17794 alc_mic_automute(codec);
17797 /* ***************** Mode1 ******************************/
17798 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17800 static void alc663_mode1_setup(struct hda_codec *codec)
17802 struct alc_spec *spec = codec->spec;
17803 spec->ext_mic.pin = 0x18;
17804 spec->ext_mic.mux_idx = 0;
17805 spec->int_mic.pin = 0x19;
17806 spec->int_mic.mux_idx = 1;
17807 spec->auto_mic = 1;
17810 #define alc663_mode1_inithook alc663_m51va_inithook
17812 /* ***************** Mode2 ******************************/
17813 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17816 switch (res >> 26) {
17817 case ALC880_HP_EVENT:
17818 alc662_f5z_speaker_automute(codec);
17820 case ALC880_MIC_EVENT:
17821 alc_mic_automute(codec);
17826 #define alc662_mode2_setup alc663_mode1_setup
17828 static void alc662_mode2_inithook(struct hda_codec *codec)
17830 alc662_f5z_speaker_automute(codec);
17831 alc_mic_automute(codec);
17833 /* ***************** Mode3 ******************************/
17834 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17837 switch (res >> 26) {
17838 case ALC880_HP_EVENT:
17839 alc663_two_hp_m1_speaker_automute(codec);
17841 case ALC880_MIC_EVENT:
17842 alc_mic_automute(codec);
17847 #define alc663_mode3_setup alc663_mode1_setup
17849 static void alc663_mode3_inithook(struct hda_codec *codec)
17851 alc663_two_hp_m1_speaker_automute(codec);
17852 alc_mic_automute(codec);
17854 /* ***************** Mode4 ******************************/
17855 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17858 switch (res >> 26) {
17859 case ALC880_HP_EVENT:
17860 alc663_21jd_two_speaker_automute(codec);
17862 case ALC880_MIC_EVENT:
17863 alc_mic_automute(codec);
17868 #define alc663_mode4_setup alc663_mode1_setup
17870 static void alc663_mode4_inithook(struct hda_codec *codec)
17872 alc663_21jd_two_speaker_automute(codec);
17873 alc_mic_automute(codec);
17875 /* ***************** Mode5 ******************************/
17876 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17879 switch (res >> 26) {
17880 case ALC880_HP_EVENT:
17881 alc663_15jd_two_speaker_automute(codec);
17883 case ALC880_MIC_EVENT:
17884 alc_mic_automute(codec);
17889 #define alc663_mode5_setup alc663_mode1_setup
17891 static void alc663_mode5_inithook(struct hda_codec *codec)
17893 alc663_15jd_two_speaker_automute(codec);
17894 alc_mic_automute(codec);
17896 /* ***************** Mode6 ******************************/
17897 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17900 switch (res >> 26) {
17901 case ALC880_HP_EVENT:
17902 alc663_two_hp_m2_speaker_automute(codec);
17904 case ALC880_MIC_EVENT:
17905 alc_mic_automute(codec);
17910 #define alc663_mode6_setup alc663_mode1_setup
17912 static void alc663_mode6_inithook(struct hda_codec *codec)
17914 alc663_two_hp_m2_speaker_automute(codec);
17915 alc_mic_automute(codec);
17918 /* ***************** Mode7 ******************************/
17919 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17922 switch (res >> 26) {
17923 case ALC880_HP_EVENT:
17924 alc663_two_hp_m7_speaker_automute(codec);
17926 case ALC880_MIC_EVENT:
17927 alc_mic_automute(codec);
17932 #define alc663_mode7_setup alc663_mode1_setup
17934 static void alc663_mode7_inithook(struct hda_codec *codec)
17936 alc663_two_hp_m7_speaker_automute(codec);
17937 alc_mic_automute(codec);
17940 /* ***************** Mode8 ******************************/
17941 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17944 switch (res >> 26) {
17945 case ALC880_HP_EVENT:
17946 alc663_two_hp_m8_speaker_automute(codec);
17948 case ALC880_MIC_EVENT:
17949 alc_mic_automute(codec);
17954 #define alc663_mode8_setup alc663_m51va_setup
17956 static void alc663_mode8_inithook(struct hda_codec *codec)
17958 alc663_two_hp_m8_speaker_automute(codec);
17959 alc_mic_automute(codec);
17962 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17964 unsigned int present;
17965 unsigned char bits;
17967 present = snd_hda_jack_detect(codec, 0x21);
17968 bits = present ? HDA_AMP_MUTE : 0;
17969 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17970 HDA_AMP_MUTE, bits);
17971 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17972 HDA_AMP_MUTE, bits);
17975 static void alc663_g71v_front_automute(struct hda_codec *codec)
17977 unsigned int present;
17978 unsigned char bits;
17980 present = snd_hda_jack_detect(codec, 0x15);
17981 bits = present ? HDA_AMP_MUTE : 0;
17982 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17983 HDA_AMP_MUTE, bits);
17986 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17989 switch (res >> 26) {
17990 case ALC880_HP_EVENT:
17991 alc663_g71v_hp_automute(codec);
17993 case ALC880_FRONT_EVENT:
17994 alc663_g71v_front_automute(codec);
17996 case ALC880_MIC_EVENT:
17997 alc_mic_automute(codec);
18002 #define alc663_g71v_setup alc663_m51va_setup
18004 static void alc663_g71v_inithook(struct hda_codec *codec)
18006 alc663_g71v_front_automute(codec);
18007 alc663_g71v_hp_automute(codec);
18008 alc_mic_automute(codec);
18011 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18014 switch (res >> 26) {
18015 case ALC880_HP_EVENT:
18016 alc663_m51va_speaker_automute(codec);
18018 case ALC880_MIC_EVENT:
18019 alc_mic_automute(codec);
18024 #define alc663_g50v_setup alc663_m51va_setup
18026 static void alc663_g50v_inithook(struct hda_codec *codec)
18028 alc663_m51va_speaker_automute(codec);
18029 alc_mic_automute(codec);
18032 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18033 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18034 ALC262_HIPPO_MASTER_SWITCH,
18036 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18037 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18038 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18040 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18041 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18042 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18046 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18047 /* Master Playback automatically created from Speaker and Headphone */
18048 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18049 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18050 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18053 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18054 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18055 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18057 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18058 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18059 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18063 #ifdef CONFIG_SND_HDA_POWER_SAVE
18064 #define alc662_loopbacks alc880_loopbacks
18068 /* pcm configuration: identical with ALC880 */
18069 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18070 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18071 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18072 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18075 * configuration and preset
18077 static const char *alc662_models[ALC662_MODEL_LAST] = {
18078 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18079 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18080 [ALC662_3ST_6ch] = "3stack-6ch",
18081 [ALC662_5ST_DIG] = "6stack-dig",
18082 [ALC662_LENOVO_101E] = "lenovo-101e",
18083 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18084 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18085 [ALC662_ECS] = "ecs",
18086 [ALC663_ASUS_M51VA] = "m51va",
18087 [ALC663_ASUS_G71V] = "g71v",
18088 [ALC663_ASUS_H13] = "h13",
18089 [ALC663_ASUS_G50V] = "g50v",
18090 [ALC663_ASUS_MODE1] = "asus-mode1",
18091 [ALC662_ASUS_MODE2] = "asus-mode2",
18092 [ALC663_ASUS_MODE3] = "asus-mode3",
18093 [ALC663_ASUS_MODE4] = "asus-mode4",
18094 [ALC663_ASUS_MODE5] = "asus-mode5",
18095 [ALC663_ASUS_MODE6] = "asus-mode6",
18096 [ALC663_ASUS_MODE7] = "asus-mode7",
18097 [ALC663_ASUS_MODE8] = "asus-mode8",
18098 [ALC272_DELL] = "dell",
18099 [ALC272_DELL_ZM1] = "dell-zm1",
18100 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18101 [ALC662_AUTO] = "auto",
18104 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18105 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18106 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18107 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18108 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18109 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18110 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18111 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18112 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18113 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18114 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18115 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18116 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18117 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18118 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18119 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18120 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18121 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18122 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18123 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18124 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18125 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18126 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18127 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18128 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18129 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18130 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18131 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18132 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18133 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18134 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18135 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18136 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18137 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18138 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18139 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18140 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18141 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18142 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18143 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18144 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18145 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18146 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18147 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18148 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18149 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18150 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18151 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18152 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18153 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18154 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18155 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18156 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18157 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18158 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18159 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18160 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18161 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18162 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18163 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18164 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18165 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18166 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18167 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18168 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18169 ALC662_3ST_6ch_DIG),
18170 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18171 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18172 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18173 ALC662_3ST_6ch_DIG),
18174 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18175 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18176 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18177 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18178 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18179 ALC662_3ST_6ch_DIG),
18180 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18185 static struct alc_config_preset alc662_presets[] = {
18186 [ALC662_3ST_2ch_DIG] = {
18187 .mixers = { alc662_3ST_2ch_mixer },
18188 .init_verbs = { alc662_init_verbs },
18189 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18190 .dac_nids = alc662_dac_nids,
18191 .dig_out_nid = ALC662_DIGOUT_NID,
18192 .dig_in_nid = ALC662_DIGIN_NID,
18193 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18194 .channel_mode = alc662_3ST_2ch_modes,
18195 .input_mux = &alc662_capture_source,
18197 [ALC662_3ST_6ch_DIG] = {
18198 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18199 .init_verbs = { alc662_init_verbs },
18200 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18201 .dac_nids = alc662_dac_nids,
18202 .dig_out_nid = ALC662_DIGOUT_NID,
18203 .dig_in_nid = ALC662_DIGIN_NID,
18204 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18205 .channel_mode = alc662_3ST_6ch_modes,
18207 .input_mux = &alc662_capture_source,
18209 [ALC662_3ST_6ch] = {
18210 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18211 .init_verbs = { alc662_init_verbs },
18212 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18213 .dac_nids = alc662_dac_nids,
18214 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18215 .channel_mode = alc662_3ST_6ch_modes,
18217 .input_mux = &alc662_capture_source,
18219 [ALC662_5ST_DIG] = {
18220 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18221 .init_verbs = { alc662_init_verbs },
18222 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18223 .dac_nids = alc662_dac_nids,
18224 .dig_out_nid = ALC662_DIGOUT_NID,
18225 .dig_in_nid = ALC662_DIGIN_NID,
18226 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18227 .channel_mode = alc662_5stack_modes,
18228 .input_mux = &alc662_capture_source,
18230 [ALC662_LENOVO_101E] = {
18231 .mixers = { alc662_lenovo_101e_mixer },
18232 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18233 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18234 .dac_nids = alc662_dac_nids,
18235 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18236 .channel_mode = alc662_3ST_2ch_modes,
18237 .input_mux = &alc662_lenovo_101e_capture_source,
18238 .unsol_event = alc662_lenovo_101e_unsol_event,
18239 .init_hook = alc662_lenovo_101e_all_automute,
18241 [ALC662_ASUS_EEEPC_P701] = {
18242 .mixers = { alc662_eeepc_p701_mixer },
18243 .init_verbs = { alc662_init_verbs,
18244 alc662_eeepc_sue_init_verbs },
18245 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18246 .dac_nids = alc662_dac_nids,
18247 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18248 .channel_mode = alc662_3ST_2ch_modes,
18249 .unsol_event = alc662_eeepc_unsol_event,
18250 .setup = alc662_eeepc_setup,
18251 .init_hook = alc662_eeepc_inithook,
18253 [ALC662_ASUS_EEEPC_EP20] = {
18254 .mixers = { alc662_eeepc_ep20_mixer,
18255 alc662_chmode_mixer },
18256 .init_verbs = { alc662_init_verbs,
18257 alc662_eeepc_ep20_sue_init_verbs },
18258 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18259 .dac_nids = alc662_dac_nids,
18260 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18261 .channel_mode = alc662_3ST_6ch_modes,
18262 .input_mux = &alc662_lenovo_101e_capture_source,
18263 .unsol_event = alc662_eeepc_unsol_event,
18264 .setup = alc662_eeepc_ep20_setup,
18265 .init_hook = alc662_eeepc_ep20_inithook,
18268 .mixers = { alc662_ecs_mixer },
18269 .init_verbs = { alc662_init_verbs,
18270 alc662_ecs_init_verbs },
18271 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18272 .dac_nids = alc662_dac_nids,
18273 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18274 .channel_mode = alc662_3ST_2ch_modes,
18275 .unsol_event = alc662_eeepc_unsol_event,
18276 .setup = alc662_eeepc_setup,
18277 .init_hook = alc662_eeepc_inithook,
18279 [ALC663_ASUS_M51VA] = {
18280 .mixers = { alc663_m51va_mixer },
18281 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18282 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18283 .dac_nids = alc662_dac_nids,
18284 .dig_out_nid = ALC662_DIGOUT_NID,
18285 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18286 .channel_mode = alc662_3ST_2ch_modes,
18287 .unsol_event = alc663_m51va_unsol_event,
18288 .setup = alc663_m51va_setup,
18289 .init_hook = alc663_m51va_inithook,
18291 [ALC663_ASUS_G71V] = {
18292 .mixers = { alc663_g71v_mixer },
18293 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18294 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18295 .dac_nids = alc662_dac_nids,
18296 .dig_out_nid = ALC662_DIGOUT_NID,
18297 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18298 .channel_mode = alc662_3ST_2ch_modes,
18299 .unsol_event = alc663_g71v_unsol_event,
18300 .setup = alc663_g71v_setup,
18301 .init_hook = alc663_g71v_inithook,
18303 [ALC663_ASUS_H13] = {
18304 .mixers = { alc663_m51va_mixer },
18305 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18306 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18307 .dac_nids = alc662_dac_nids,
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 .init_hook = alc663_m51va_inithook,
18313 [ALC663_ASUS_G50V] = {
18314 .mixers = { alc663_g50v_mixer },
18315 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18316 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18317 .dac_nids = alc662_dac_nids,
18318 .dig_out_nid = ALC662_DIGOUT_NID,
18319 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18320 .channel_mode = alc662_3ST_6ch_modes,
18321 .input_mux = &alc663_capture_source,
18322 .unsol_event = alc663_g50v_unsol_event,
18323 .setup = alc663_g50v_setup,
18324 .init_hook = alc663_g50v_inithook,
18326 [ALC663_ASUS_MODE1] = {
18327 .mixers = { alc663_m51va_mixer },
18328 .cap_mixer = alc662_auto_capture_mixer,
18329 .init_verbs = { alc662_init_verbs,
18330 alc663_21jd_amic_init_verbs },
18331 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18333 .dac_nids = alc662_dac_nids,
18334 .dig_out_nid = ALC662_DIGOUT_NID,
18335 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18336 .channel_mode = alc662_3ST_2ch_modes,
18337 .unsol_event = alc663_mode1_unsol_event,
18338 .setup = alc663_mode1_setup,
18339 .init_hook = alc663_mode1_inithook,
18341 [ALC662_ASUS_MODE2] = {
18342 .mixers = { alc662_1bjd_mixer },
18343 .cap_mixer = alc662_auto_capture_mixer,
18344 .init_verbs = { alc662_init_verbs,
18345 alc662_1bjd_amic_init_verbs },
18346 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18347 .dac_nids = alc662_dac_nids,
18348 .dig_out_nid = ALC662_DIGOUT_NID,
18349 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18350 .channel_mode = alc662_3ST_2ch_modes,
18351 .unsol_event = alc662_mode2_unsol_event,
18352 .setup = alc662_mode2_setup,
18353 .init_hook = alc662_mode2_inithook,
18355 [ALC663_ASUS_MODE3] = {
18356 .mixers = { alc663_two_hp_m1_mixer },
18357 .cap_mixer = alc662_auto_capture_mixer,
18358 .init_verbs = { alc662_init_verbs,
18359 alc663_two_hp_amic_m1_init_verbs },
18360 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18362 .dac_nids = alc662_dac_nids,
18363 .dig_out_nid = ALC662_DIGOUT_NID,
18364 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18365 .channel_mode = alc662_3ST_2ch_modes,
18366 .unsol_event = alc663_mode3_unsol_event,
18367 .setup = alc663_mode3_setup,
18368 .init_hook = alc663_mode3_inithook,
18370 [ALC663_ASUS_MODE4] = {
18371 .mixers = { alc663_asus_21jd_clfe_mixer },
18372 .cap_mixer = alc662_auto_capture_mixer,
18373 .init_verbs = { alc662_init_verbs,
18374 alc663_21jd_amic_init_verbs},
18375 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18377 .dac_nids = alc662_dac_nids,
18378 .dig_out_nid = ALC662_DIGOUT_NID,
18379 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18380 .channel_mode = alc662_3ST_2ch_modes,
18381 .unsol_event = alc663_mode4_unsol_event,
18382 .setup = alc663_mode4_setup,
18383 .init_hook = alc663_mode4_inithook,
18385 [ALC663_ASUS_MODE5] = {
18386 .mixers = { alc663_asus_15jd_clfe_mixer },
18387 .cap_mixer = alc662_auto_capture_mixer,
18388 .init_verbs = { alc662_init_verbs,
18389 alc663_15jd_amic_init_verbs },
18390 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18392 .dac_nids = alc662_dac_nids,
18393 .dig_out_nid = ALC662_DIGOUT_NID,
18394 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18395 .channel_mode = alc662_3ST_2ch_modes,
18396 .unsol_event = alc663_mode5_unsol_event,
18397 .setup = alc663_mode5_setup,
18398 .init_hook = alc663_mode5_inithook,
18400 [ALC663_ASUS_MODE6] = {
18401 .mixers = { alc663_two_hp_m2_mixer },
18402 .cap_mixer = alc662_auto_capture_mixer,
18403 .init_verbs = { alc662_init_verbs,
18404 alc663_two_hp_amic_m2_init_verbs },
18405 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18407 .dac_nids = alc662_dac_nids,
18408 .dig_out_nid = ALC662_DIGOUT_NID,
18409 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18410 .channel_mode = alc662_3ST_2ch_modes,
18411 .unsol_event = alc663_mode6_unsol_event,
18412 .setup = alc663_mode6_setup,
18413 .init_hook = alc663_mode6_inithook,
18415 [ALC663_ASUS_MODE7] = {
18416 .mixers = { alc663_mode7_mixer },
18417 .cap_mixer = alc662_auto_capture_mixer,
18418 .init_verbs = { alc662_init_verbs,
18419 alc663_mode7_init_verbs },
18420 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18422 .dac_nids = alc662_dac_nids,
18423 .dig_out_nid = ALC662_DIGOUT_NID,
18424 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18425 .channel_mode = alc662_3ST_2ch_modes,
18426 .unsol_event = alc663_mode7_unsol_event,
18427 .setup = alc663_mode7_setup,
18428 .init_hook = alc663_mode7_inithook,
18430 [ALC663_ASUS_MODE8] = {
18431 .mixers = { alc663_mode8_mixer },
18432 .cap_mixer = alc662_auto_capture_mixer,
18433 .init_verbs = { alc662_init_verbs,
18434 alc663_mode8_init_verbs },
18435 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18437 .dac_nids = alc662_dac_nids,
18438 .dig_out_nid = ALC662_DIGOUT_NID,
18439 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18440 .channel_mode = alc662_3ST_2ch_modes,
18441 .unsol_event = alc663_mode8_unsol_event,
18442 .setup = alc663_mode8_setup,
18443 .init_hook = alc663_mode8_inithook,
18446 .mixers = { alc663_m51va_mixer },
18447 .cap_mixer = alc272_auto_capture_mixer,
18448 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18449 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18450 .dac_nids = alc662_dac_nids,
18451 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18452 .adc_nids = alc272_adc_nids,
18453 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18454 .capsrc_nids = alc272_capsrc_nids,
18455 .channel_mode = alc662_3ST_2ch_modes,
18456 .unsol_event = alc663_m51va_unsol_event,
18457 .setup = alc663_m51va_setup,
18458 .init_hook = alc663_m51va_inithook,
18460 [ALC272_DELL_ZM1] = {
18461 .mixers = { alc663_m51va_mixer },
18462 .cap_mixer = alc662_auto_capture_mixer,
18463 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18464 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18465 .dac_nids = alc662_dac_nids,
18466 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18467 .adc_nids = alc662_adc_nids,
18469 .capsrc_nids = alc662_capsrc_nids,
18470 .channel_mode = alc662_3ST_2ch_modes,
18471 .unsol_event = alc663_m51va_unsol_event,
18472 .setup = alc663_m51va_setup,
18473 .init_hook = alc663_m51va_inithook,
18475 [ALC272_SAMSUNG_NC10] = {
18476 .mixers = { alc272_nc10_mixer },
18477 .init_verbs = { alc662_init_verbs,
18478 alc663_21jd_amic_init_verbs },
18479 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18480 .dac_nids = alc272_dac_nids,
18481 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18482 .channel_mode = alc662_3ST_2ch_modes,
18483 /*.input_mux = &alc272_nc10_capture_source,*/
18484 .unsol_event = alc663_mode4_unsol_event,
18485 .setup = alc663_mode4_setup,
18486 .init_hook = alc663_mode4_inithook,
18492 * BIOS auto configuration
18495 /* convert from MIX nid to DAC */
18496 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18500 else if (nid >= 0x0c && nid <= 0x0e)
18501 return nid - 0x0c + 0x02;
18506 /* get MIX nid connected to the given pin targeted to DAC */
18507 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18513 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18514 for (i = 0; i < num; i++) {
18515 if (alc662_mix_to_dac(mix[i]) == dac)
18521 /* look for an empty DAC slot */
18522 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18524 struct alc_spec *spec = codec->spec;
18528 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18531 for (i = 0; i < num; i++) {
18532 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18535 for (j = 0; j < spec->multiout.num_dacs; j++)
18536 if (spec->multiout.dac_nids[j] == nid)
18538 if (j >= spec->multiout.num_dacs)
18544 /* fill in the dac_nids table from the parsed pin configuration */
18545 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18546 const struct auto_pin_cfg *cfg)
18548 struct alc_spec *spec = codec->spec;
18552 spec->multiout.dac_nids = spec->private_dac_nids;
18553 for (i = 0; i < cfg->line_outs; i++) {
18554 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18557 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18562 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18563 hda_nid_t nid, unsigned int chs)
18565 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18566 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18569 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18570 hda_nid_t nid, unsigned int chs)
18572 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18573 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18576 #define alc662_add_stereo_vol(spec, pfx, nid) \
18577 alc662_add_vol_ctl(spec, pfx, nid, 3)
18578 #define alc662_add_stereo_sw(spec, pfx, nid) \
18579 alc662_add_sw_ctl(spec, pfx, nid, 3)
18581 /* add playback controls from the parsed DAC table */
18582 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18583 const struct auto_pin_cfg *cfg)
18585 struct alc_spec *spec = codec->spec;
18586 static const char *chname[4] = {
18587 "Front", "Surround", NULL /*CLFE*/, "Side"
18589 hda_nid_t nid, mix;
18592 for (i = 0; i < cfg->line_outs; i++) {
18593 nid = spec->multiout.dac_nids[i];
18596 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18601 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18604 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18607 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18610 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18615 if (cfg->line_outs == 1 &&
18616 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18623 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18626 if (cfg->line_outs == 1 &&
18627 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18629 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18637 /* add playback controls for speaker and HP outputs */
18638 /* return DAC nid if any new DAC is assigned */
18639 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18642 struct alc_spec *spec = codec->spec;
18643 hda_nid_t nid, mix;
18648 nid = alc662_look_for_dac(codec, pin);
18650 /* the corresponding DAC is already occupied */
18651 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18652 return 0; /* no way */
18653 /* create a switch only */
18654 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18655 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18658 mix = alc662_dac_to_mix(codec, pin, nid);
18661 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18664 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18670 /* create playback/capture controls for input pins */
18671 #define alc662_auto_create_input_ctls \
18672 alc882_auto_create_input_ctls
18674 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18675 hda_nid_t nid, int pin_type,
18679 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18681 alc_set_pin_output(codec, nid, pin_type);
18682 /* need the manual connection? */
18683 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18686 for (i = 0; i < num; i++) {
18687 if (alc662_mix_to_dac(srcs[i]) != dac)
18689 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18694 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18696 struct alc_spec *spec = codec->spec;
18697 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18700 for (i = 0; i <= HDA_SIDE; i++) {
18701 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18703 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18704 spec->multiout.dac_nids[i]);
18708 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18710 struct alc_spec *spec = codec->spec;
18713 pin = spec->autocfg.hp_pins[0];
18715 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18716 spec->multiout.hp_nid);
18717 pin = spec->autocfg.speaker_pins[0];
18719 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18720 spec->multiout.extra_out_nid[0]);
18723 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18725 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18727 struct alc_spec *spec = codec->spec;
18730 for (i = 0; i < AUTO_PIN_LAST; i++) {
18731 hda_nid_t nid = spec->autocfg.input_pins[i];
18732 if (alc_is_input_pin(codec, nid)) {
18733 alc_set_input_pin(codec, nid, i);
18734 if (nid != ALC662_PIN_CD_NID &&
18735 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18736 snd_hda_codec_write(codec, nid, 0,
18737 AC_VERB_SET_AMP_GAIN_MUTE,
18743 #define alc662_auto_init_input_src alc882_auto_init_input_src
18745 static int alc662_parse_auto_config(struct hda_codec *codec)
18747 struct alc_spec *spec = codec->spec;
18749 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18751 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18755 if (!spec->autocfg.line_outs)
18756 return 0; /* can't find valid BIOS pin config */
18758 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18761 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18764 err = alc662_auto_create_extra_out(codec,
18765 spec->autocfg.speaker_pins[0],
18770 spec->multiout.extra_out_nid[0] = err;
18771 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18776 spec->multiout.hp_nid = err;
18777 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18781 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18783 alc_auto_parse_digital(codec);
18785 if (spec->kctls.list)
18786 add_mixer(spec, spec->kctls.list);
18788 spec->num_mux_defs = 1;
18789 spec->input_mux = &spec->private_imux[0];
18791 add_verb(spec, alc662_init_verbs);
18792 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18793 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18794 add_verb(spec, alc663_init_verbs);
18796 if (codec->vendor_id == 0x10ec0272)
18797 add_verb(spec, alc272_init_verbs);
18799 err = alc_auto_add_mic_boost(codec);
18803 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18804 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18805 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18807 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18812 /* additional initialization for auto-configuration model */
18813 static void alc662_auto_init(struct hda_codec *codec)
18815 struct alc_spec *spec = codec->spec;
18816 alc662_auto_init_multi_out(codec);
18817 alc662_auto_init_hp_out(codec);
18818 alc662_auto_init_analog_input(codec);
18819 alc662_auto_init_input_src(codec);
18820 alc_auto_init_digital(codec);
18821 if (spec->unsol_event)
18822 alc_inithook(codec);
18825 static int patch_alc662(struct hda_codec *codec)
18827 struct alc_spec *spec;
18828 int err, board_config;
18830 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18834 codec->spec = spec;
18836 alc_auto_parse_customize_define(codec);
18838 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18840 if (alc_read_coef_idx(codec, 0) == 0x8020)
18841 alc_codec_rename(codec, "ALC661");
18842 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18843 codec->bus->pci->subsystem_vendor == 0x1025 &&
18844 spec->cdefine.platform_type == 1)
18845 alc_codec_rename(codec, "ALC272X");
18847 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18850 if (board_config < 0) {
18851 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18853 board_config = ALC662_AUTO;
18856 if (board_config == ALC662_AUTO) {
18857 /* automatic parse from the BIOS config */
18858 err = alc662_parse_auto_config(codec);
18864 "hda_codec: Cannot set up configuration "
18865 "from BIOS. Using base mode...\n");
18866 board_config = ALC662_3ST_2ch_DIG;
18870 if (has_cdefine_beep(codec)) {
18871 err = snd_hda_attach_beep_device(codec, 0x1);
18878 if (board_config != ALC662_AUTO)
18879 setup_preset(codec, &alc662_presets[board_config]);
18881 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18882 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18884 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18885 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18887 if (!spec->adc_nids) {
18888 spec->adc_nids = alc662_adc_nids;
18889 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18891 if (!spec->capsrc_nids)
18892 spec->capsrc_nids = alc662_capsrc_nids;
18894 if (!spec->cap_mixer)
18895 set_capture_mixer(codec);
18897 if (has_cdefine_beep(codec)) {
18898 switch (codec->vendor_id) {
18900 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18905 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18908 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18912 spec->vmaster_nid = 0x02;
18914 codec->patch_ops = alc_patch_ops;
18915 if (board_config == ALC662_AUTO)
18916 spec->init_hook = alc662_auto_init;
18917 #ifdef CONFIG_SND_HDA_POWER_SAVE
18918 if (!spec->loopback.amplist)
18919 spec->loopback.amplist = alc662_loopbacks;
18925 static int patch_alc888(struct hda_codec *codec)
18927 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18928 kfree(codec->chip_name);
18929 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18930 if (!codec->chip_name) {
18934 return patch_alc662(codec);
18936 return patch_alc882(codec);
18942 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
18943 #define alc680_modes alc260_modes
18945 static hda_nid_t alc680_dac_nids[3] = {
18946 /* Lout1, Lout2, hp */
18950 static hda_nid_t alc680_adc_nids[3] = {
18952 /* DMIC, MIC, Line-in*/
18956 static struct snd_kcontrol_new alc680_base_mixer[] = {
18957 /* output mixer control */
18958 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
18959 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
18961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
18962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
18966 static struct snd_kcontrol_new alc680_capture_mixer[] = {
18967 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
18968 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
18969 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
18970 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
18971 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
18972 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
18977 * generic initialization of ADC, input mixers and output mixers
18979 static struct hda_verb alc680_init_verbs[] = {
18980 /* Unmute DAC0-1 and set vol = 0 */
18981 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
18982 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
18983 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
18985 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
18986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
18987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
18988 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
18989 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
18991 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18993 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18994 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18995 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18999 /* create input playback/capture controls for the given pin */
19000 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19001 const char *ctlname, int idx)
19019 if (spec->multiout.dac_nids[0] != dac &&
19020 spec->multiout.dac_nids[1] != dac) {
19021 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19022 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19027 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19028 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19032 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19038 /* add playback controls from the parsed DAC table */
19039 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19040 const struct auto_pin_cfg *cfg)
19045 spec->multiout.dac_nids = spec->private_dac_nids;
19047 nid = cfg->line_out_pins[0];
19050 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19054 err = alc680_new_analog_output(spec, nid, name, 0);
19059 nid = cfg->speaker_pins[0];
19061 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19065 nid = cfg->hp_pins[0];
19067 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19075 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19076 hda_nid_t nid, int pin_type)
19078 alc_set_pin_output(codec, nid, pin_type);
19081 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19083 struct alc_spec *spec = codec->spec;
19084 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19086 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19087 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19091 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19093 struct alc_spec *spec = codec->spec;
19096 pin = spec->autocfg.hp_pins[0];
19098 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19099 pin = spec->autocfg.speaker_pins[0];
19101 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19104 /* pcm configuration: identical with ALC880 */
19105 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19106 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19107 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19108 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19110 static struct hda_input_mux alc680_capture_source = {
19118 * BIOS auto configuration
19120 static int alc680_parse_auto_config(struct hda_codec *codec)
19122 struct alc_spec *spec = codec->spec;
19124 static hda_nid_t alc680_ignore[] = { 0 };
19126 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19130 if (!spec->autocfg.line_outs) {
19131 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19132 spec->multiout.max_channels = 2;
19133 spec->no_analog = 1;
19136 return 0; /* can't find valid BIOS pin config */
19138 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19142 spec->multiout.max_channels = 2;
19145 /* digital only support output */
19146 alc_auto_parse_digital(codec);
19147 if (spec->kctls.list)
19148 add_mixer(spec, spec->kctls.list);
19150 add_verb(spec, alc680_init_verbs);
19151 spec->num_mux_defs = 1;
19152 spec->input_mux = &alc680_capture_source;
19154 err = alc_auto_add_mic_boost(codec);
19161 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19163 /* init callback for auto-configuration model -- overriding the default init */
19164 static void alc680_auto_init(struct hda_codec *codec)
19166 struct alc_spec *spec = codec->spec;
19167 alc680_auto_init_multi_out(codec);
19168 alc680_auto_init_hp_out(codec);
19169 alc680_auto_init_analog_input(codec);
19170 alc_auto_init_digital(codec);
19171 if (spec->unsol_event)
19172 alc_inithook(codec);
19176 * configuration and preset
19178 static const char *alc680_models[ALC680_MODEL_LAST] = {
19179 [ALC680_BASE] = "base",
19180 [ALC680_AUTO] = "auto",
19183 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19184 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19188 static struct alc_config_preset alc680_presets[] = {
19190 .mixers = { alc680_base_mixer },
19191 .cap_mixer = alc680_capture_mixer,
19192 .init_verbs = { alc680_init_verbs },
19193 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19194 .dac_nids = alc680_dac_nids,
19195 .num_adc_nids = ARRAY_SIZE(alc680_adc_nids),
19196 .adc_nids = alc680_adc_nids,
19198 .dig_out_nid = ALC680_DIGOUT_NID,
19199 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19200 .channel_mode = alc680_modes,
19201 .input_mux = &alc680_capture_source,
19205 static int patch_alc680(struct hda_codec *codec)
19207 struct alc_spec *spec;
19211 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19215 codec->spec = spec;
19217 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19221 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19222 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19224 board_config = ALC680_AUTO;
19227 if (board_config == ALC680_AUTO) {
19228 /* automatic parse from the BIOS config */
19229 err = alc680_parse_auto_config(codec);
19235 "hda_codec: Cannot set up configuration "
19236 "from BIOS. Using base mode...\n");
19237 board_config = ALC680_BASE;
19241 if (board_config != ALC680_AUTO)
19242 setup_preset(codec, &alc680_presets[board_config]);
19244 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19245 spec->stream_analog_capture = &alc680_pcm_analog_capture;
19246 spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture;
19247 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19249 if (!spec->adc_nids) {
19250 spec->adc_nids = alc680_adc_nids;
19251 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19254 if (!spec->cap_mixer)
19255 set_capture_mixer(codec);
19257 spec->vmaster_nid = 0x02;
19259 codec->patch_ops = alc_patch_ops;
19260 if (board_config == ALC680_AUTO)
19261 spec->init_hook = alc680_auto_init;
19269 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19270 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19271 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19272 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19273 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19274 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19275 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19276 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19277 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19278 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19279 .patch = patch_alc861 },
19280 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19281 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19282 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19283 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19284 .patch = patch_alc882 },
19285 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19286 .patch = patch_alc662 },
19287 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19288 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19289 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19290 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19291 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19292 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19293 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19294 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19295 .patch = patch_alc882 },
19296 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19297 .patch = patch_alc882 },
19298 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19299 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19300 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19301 .patch = patch_alc882 },
19302 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19303 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19304 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19305 {} /* terminator */
19308 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19310 MODULE_LICENSE("GPL");
19311 MODULE_DESCRIPTION("Realtek HD-audio codec");
19313 static struct hda_codec_preset_list realtek_list = {
19314 .preset = snd_hda_preset_realtek,
19315 .owner = THIS_MODULE,
19318 static int __init patch_realtek_init(void)
19320 return snd_hda_add_codec_preset(&realtek_list);
19323 static void __exit patch_realtek_exit(void)
19325 snd_hda_delete_codec_preset(&realtek_list);
19328 module_init(patch_realtek_init)
19329 module_exit(patch_realtek_exit)