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)
13147 case 0x21: /* ALC269vb has this pin, too */
13153 if (spec->multiout.dac_nids[0] != dac &&
13154 spec->multiout.dac_nids[1] != dac) {
13155 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13156 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13160 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13164 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13165 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13167 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13168 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13174 /* add playback controls from the parsed DAC table */
13175 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13176 const struct auto_pin_cfg *cfg)
13181 spec->multiout.dac_nids = spec->private_dac_nids;
13183 nid = cfg->line_out_pins[0];
13186 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13190 err = alc268_new_analog_output(spec, nid, name, 0);
13195 nid = cfg->speaker_pins[0];
13197 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13198 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13202 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13206 nid = cfg->hp_pins[0];
13208 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13213 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13215 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13216 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13223 /* create playback/capture controls for input pins */
13224 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13225 const struct auto_pin_cfg *cfg)
13227 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13230 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13231 hda_nid_t nid, int pin_type)
13235 alc_set_pin_output(codec, nid, pin_type);
13236 if (nid == 0x14 || nid == 0x16)
13240 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13243 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13245 struct alc_spec *spec = codec->spec;
13246 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13248 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13249 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13253 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13255 struct alc_spec *spec = codec->spec;
13258 pin = spec->autocfg.hp_pins[0];
13260 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13261 pin = spec->autocfg.speaker_pins[0];
13263 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13266 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13268 struct alc_spec *spec = codec->spec;
13269 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13270 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13271 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13272 unsigned int dac_vol1, dac_vol2;
13274 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13275 snd_hda_codec_write(codec, speaker_nid, 0,
13276 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13277 /* mute mixer inputs from 0x1d */
13278 snd_hda_codec_write(codec, 0x0f, 0,
13279 AC_VERB_SET_AMP_GAIN_MUTE,
13281 snd_hda_codec_write(codec, 0x10, 0,
13282 AC_VERB_SET_AMP_GAIN_MUTE,
13285 /* unmute mixer inputs from 0x1d */
13286 snd_hda_codec_write(codec, 0x0f, 0,
13287 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13288 snd_hda_codec_write(codec, 0x10, 0,
13289 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13292 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13293 if (line_nid == 0x14)
13294 dac_vol2 = AMP_OUT_ZERO;
13295 else if (line_nid == 0x15)
13296 dac_vol1 = AMP_OUT_ZERO;
13297 if (hp_nid == 0x14)
13298 dac_vol2 = AMP_OUT_ZERO;
13299 else if (hp_nid == 0x15)
13300 dac_vol1 = AMP_OUT_ZERO;
13301 if (line_nid != 0x16 || hp_nid != 0x16 ||
13302 spec->autocfg.line_out_pins[1] != 0x16 ||
13303 spec->autocfg.line_out_pins[2] != 0x16)
13304 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13306 snd_hda_codec_write(codec, 0x02, 0,
13307 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13308 snd_hda_codec_write(codec, 0x03, 0,
13309 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13312 /* pcm configuration: identical with ALC880 */
13313 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13314 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13315 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13316 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13319 * BIOS auto configuration
13321 static int alc268_parse_auto_config(struct hda_codec *codec)
13323 struct alc_spec *spec = codec->spec;
13325 static hda_nid_t alc268_ignore[] = { 0 };
13327 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13331 if (!spec->autocfg.line_outs) {
13332 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13333 spec->multiout.max_channels = 2;
13334 spec->no_analog = 1;
13337 return 0; /* can't find valid BIOS pin config */
13339 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13342 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13346 spec->multiout.max_channels = 2;
13349 /* digital only support output */
13350 alc_auto_parse_digital(codec);
13351 if (spec->kctls.list)
13352 add_mixer(spec, spec->kctls.list);
13354 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13355 add_mixer(spec, alc268_beep_mixer);
13357 add_verb(spec, alc268_volume_init_verbs);
13358 spec->num_mux_defs = 2;
13359 spec->input_mux = &spec->private_imux[0];
13361 err = alc_auto_add_mic_boost(codec);
13365 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13370 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13372 /* init callback for auto-configuration model -- overriding the default init */
13373 static void alc268_auto_init(struct hda_codec *codec)
13375 struct alc_spec *spec = codec->spec;
13376 alc268_auto_init_multi_out(codec);
13377 alc268_auto_init_hp_out(codec);
13378 alc268_auto_init_mono_speaker_out(codec);
13379 alc268_auto_init_analog_input(codec);
13380 alc_auto_init_digital(codec);
13381 if (spec->unsol_event)
13382 alc_inithook(codec);
13386 * configuration and preset
13388 static const char *alc268_models[ALC268_MODEL_LAST] = {
13389 [ALC267_QUANTA_IL1] = "quanta-il1",
13390 [ALC268_3ST] = "3stack",
13391 [ALC268_TOSHIBA] = "toshiba",
13392 [ALC268_ACER] = "acer",
13393 [ALC268_ACER_DMIC] = "acer-dmic",
13394 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13395 [ALC268_DELL] = "dell",
13396 [ALC268_ZEPTO] = "zepto",
13397 #ifdef CONFIG_SND_DEBUG
13398 [ALC268_TEST] = "test",
13400 [ALC268_AUTO] = "auto",
13403 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13404 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13405 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13406 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13407 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13408 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13409 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13410 ALC268_ACER_ASPIRE_ONE),
13411 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13412 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13413 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13414 /* almost compatible with toshiba but with optional digital outs;
13415 * auto-probing seems working fine
13417 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13419 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13420 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13421 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13422 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13423 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13424 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
13428 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13429 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13430 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13431 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13432 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13437 static struct alc_config_preset alc268_presets[] = {
13438 [ALC267_QUANTA_IL1] = {
13439 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13440 alc268_capture_nosrc_mixer },
13441 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13442 alc267_quanta_il1_verbs },
13443 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13444 .dac_nids = alc268_dac_nids,
13445 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13446 .adc_nids = alc268_adc_nids_alt,
13448 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13449 .channel_mode = alc268_modes,
13450 .unsol_event = alc_sku_unsol_event,
13451 .setup = alc267_quanta_il1_setup,
13452 .init_hook = alc_inithook,
13455 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13456 alc268_beep_mixer },
13457 .init_verbs = { alc268_base_init_verbs },
13458 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13459 .dac_nids = alc268_dac_nids,
13460 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13461 .adc_nids = alc268_adc_nids_alt,
13462 .capsrc_nids = alc268_capsrc_nids,
13464 .dig_out_nid = ALC268_DIGOUT_NID,
13465 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13466 .channel_mode = alc268_modes,
13467 .input_mux = &alc268_capture_source,
13469 [ALC268_TOSHIBA] = {
13470 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13471 alc268_beep_mixer },
13472 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13473 alc268_toshiba_verbs },
13474 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13475 .dac_nids = alc268_dac_nids,
13476 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13477 .adc_nids = alc268_adc_nids_alt,
13478 .capsrc_nids = alc268_capsrc_nids,
13480 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13481 .channel_mode = alc268_modes,
13482 .input_mux = &alc268_capture_source,
13483 .unsol_event = alc268_toshiba_unsol_event,
13484 .setup = alc268_toshiba_setup,
13485 .init_hook = alc268_toshiba_automute,
13488 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13489 alc268_beep_mixer },
13490 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13491 alc268_acer_verbs },
13492 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13493 .dac_nids = alc268_dac_nids,
13494 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13495 .adc_nids = alc268_adc_nids_alt,
13496 .capsrc_nids = alc268_capsrc_nids,
13498 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13499 .channel_mode = alc268_modes,
13500 .input_mux = &alc268_acer_capture_source,
13501 .unsol_event = alc268_acer_unsol_event,
13502 .init_hook = alc268_acer_init_hook,
13504 [ALC268_ACER_DMIC] = {
13505 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13506 alc268_beep_mixer },
13507 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13508 alc268_acer_verbs },
13509 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13510 .dac_nids = alc268_dac_nids,
13511 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13512 .adc_nids = alc268_adc_nids_alt,
13513 .capsrc_nids = alc268_capsrc_nids,
13515 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13516 .channel_mode = alc268_modes,
13517 .input_mux = &alc268_acer_dmic_capture_source,
13518 .unsol_event = alc268_acer_unsol_event,
13519 .init_hook = alc268_acer_init_hook,
13521 [ALC268_ACER_ASPIRE_ONE] = {
13522 .mixers = { alc268_acer_aspire_one_mixer,
13524 alc268_capture_nosrc_mixer },
13525 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13526 alc268_acer_aspire_one_verbs },
13527 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13528 .dac_nids = alc268_dac_nids,
13529 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13530 .adc_nids = alc268_adc_nids_alt,
13531 .capsrc_nids = alc268_capsrc_nids,
13533 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13534 .channel_mode = alc268_modes,
13535 .unsol_event = alc268_acer_lc_unsol_event,
13536 .setup = alc268_acer_lc_setup,
13537 .init_hook = alc268_acer_lc_init_hook,
13540 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13541 alc268_capture_nosrc_mixer },
13542 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13543 alc268_dell_verbs },
13544 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13545 .dac_nids = alc268_dac_nids,
13546 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13547 .adc_nids = alc268_adc_nids_alt,
13548 .capsrc_nids = alc268_capsrc_nids,
13550 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13551 .channel_mode = alc268_modes,
13552 .unsol_event = alc_sku_unsol_event,
13553 .setup = alc268_dell_setup,
13554 .init_hook = alc_inithook,
13557 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13558 alc268_beep_mixer },
13559 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13560 alc268_toshiba_verbs },
13561 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13562 .dac_nids = alc268_dac_nids,
13563 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13564 .adc_nids = alc268_adc_nids_alt,
13565 .capsrc_nids = alc268_capsrc_nids,
13567 .dig_out_nid = ALC268_DIGOUT_NID,
13568 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13569 .channel_mode = alc268_modes,
13570 .input_mux = &alc268_capture_source,
13571 .setup = alc268_toshiba_setup,
13572 .init_hook = alc268_toshiba_automute,
13574 #ifdef CONFIG_SND_DEBUG
13576 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13577 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13578 alc268_volume_init_verbs },
13579 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13580 .dac_nids = alc268_dac_nids,
13581 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13582 .adc_nids = alc268_adc_nids_alt,
13583 .capsrc_nids = alc268_capsrc_nids,
13585 .dig_out_nid = ALC268_DIGOUT_NID,
13586 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13587 .channel_mode = alc268_modes,
13588 .input_mux = &alc268_capture_source,
13593 static int patch_alc268(struct hda_codec *codec)
13595 struct alc_spec *spec;
13597 int i, has_beep, err;
13599 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13603 codec->spec = spec;
13605 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13609 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13610 board_config = snd_hda_check_board_codec_sid_config(codec,
13611 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13613 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13614 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13616 board_config = ALC268_AUTO;
13619 if (board_config == ALC268_AUTO) {
13620 /* automatic parse from the BIOS config */
13621 err = alc268_parse_auto_config(codec);
13627 "hda_codec: Cannot set up configuration "
13628 "from BIOS. Using base mode...\n");
13629 board_config = ALC268_3ST;
13633 if (board_config != ALC268_AUTO)
13634 setup_preset(codec, &alc268_presets[board_config]);
13636 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13637 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13638 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13640 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13643 for (i = 0; i < spec->num_mixers; i++) {
13644 if (spec->mixers[i] == alc268_beep_mixer) {
13651 err = snd_hda_attach_beep_device(codec, 0x1);
13656 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13657 /* override the amp caps for beep generator */
13658 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13659 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13660 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13661 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13662 (0 << AC_AMPCAP_MUTE_SHIFT));
13665 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13666 /* check whether NID 0x07 is valid */
13667 unsigned int wcap = get_wcaps(codec, 0x07);
13670 spec->capsrc_nids = alc268_capsrc_nids;
13672 wcap = get_wcaps_type(wcap);
13673 if (spec->auto_mic ||
13674 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13675 spec->adc_nids = alc268_adc_nids_alt;
13676 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13677 if (spec->auto_mic)
13678 fixup_automic_adc(codec);
13679 if (spec->auto_mic || spec->input_mux->num_items == 1)
13680 add_mixer(spec, alc268_capture_nosrc_mixer);
13682 add_mixer(spec, alc268_capture_alt_mixer);
13684 spec->adc_nids = alc268_adc_nids;
13685 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13686 add_mixer(spec, alc268_capture_mixer);
13688 /* set default input source */
13689 for (i = 0; i < spec->num_adc_nids; i++)
13690 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13691 0, AC_VERB_SET_CONNECT_SEL,
13692 i < spec->num_mux_defs ?
13693 spec->input_mux[i].items[0].index :
13694 spec->input_mux->items[0].index);
13697 spec->vmaster_nid = 0x02;
13699 codec->patch_ops = alc_patch_ops;
13700 if (board_config == ALC268_AUTO)
13701 spec->init_hook = alc268_auto_init;
13707 * ALC269 channel source setting (2 channel)
13709 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13711 #define alc269_dac_nids alc260_dac_nids
13713 static hda_nid_t alc269_adc_nids[1] = {
13718 static hda_nid_t alc269_capsrc_nids[1] = {
13722 static hda_nid_t alc269vb_adc_nids[1] = {
13727 static hda_nid_t alc269vb_capsrc_nids[1] = {
13731 static hda_nid_t alc269_adc_candidates[] = {
13735 #define alc269_modes alc260_modes
13736 #define alc269_capture_source alc880_lg_lw_capture_source
13738 static struct snd_kcontrol_new alc269_base_mixer[] = {
13739 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13740 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13741 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13742 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13745 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13746 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13747 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13748 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13749 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13750 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13754 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13755 /* output mixer control */
13756 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13758 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13759 .name = "Master Playback Switch",
13760 .subdevice = HDA_SUBDEV_AMP_FLAG,
13761 .info = snd_hda_mixer_amp_switch_info,
13762 .get = snd_hda_mixer_amp_switch_get,
13763 .put = alc268_acer_master_sw_put,
13764 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13769 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13770 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13771 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13775 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13776 /* output mixer control */
13777 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13779 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13780 .name = "Master Playback Switch",
13781 .subdevice = HDA_SUBDEV_AMP_FLAG,
13782 .info = snd_hda_mixer_amp_switch_info,
13783 .get = snd_hda_mixer_amp_switch_get,
13784 .put = alc268_acer_master_sw_put,
13785 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13788 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13789 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13790 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13791 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13792 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13793 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13794 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13795 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13799 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13800 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13801 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13803 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13807 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13808 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13809 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13811 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13815 /* capture mixer elements */
13816 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13817 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13818 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13820 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13824 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13825 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13826 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13827 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13831 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13832 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13833 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13834 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13835 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13839 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13840 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13841 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13842 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13847 #define alc269_fujitsu_mixer alc269_laptop_mixer
13849 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13850 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13851 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13853 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13854 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13855 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13859 static struct hda_verb alc269_lifebook_verbs[] = {
13860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13861 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13862 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13864 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13865 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13867 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13869 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13873 /* toggle speaker-output according to the hp-jack state */
13874 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13876 unsigned int present;
13877 unsigned char bits;
13879 present = snd_hda_jack_detect(codec, 0x15);
13880 bits = present ? HDA_AMP_MUTE : 0;
13881 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13882 HDA_AMP_MUTE, bits);
13883 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13884 HDA_AMP_MUTE, bits);
13886 snd_hda_codec_write(codec, 0x20, 0,
13887 AC_VERB_SET_COEF_INDEX, 0x0c);
13888 snd_hda_codec_write(codec, 0x20, 0,
13889 AC_VERB_SET_PROC_COEF, 0x680);
13891 snd_hda_codec_write(codec, 0x20, 0,
13892 AC_VERB_SET_COEF_INDEX, 0x0c);
13893 snd_hda_codec_write(codec, 0x20, 0,
13894 AC_VERB_SET_PROC_COEF, 0x480);
13897 /* toggle speaker-output according to the hp-jacks state */
13898 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13900 unsigned int present;
13901 unsigned char bits;
13903 /* Check laptop headphone socket */
13904 present = snd_hda_jack_detect(codec, 0x15);
13906 /* Check port replicator headphone socket */
13907 present |= snd_hda_jack_detect(codec, 0x1a);
13909 bits = present ? HDA_AMP_MUTE : 0;
13910 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13911 HDA_AMP_MUTE, bits);
13912 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13913 HDA_AMP_MUTE, bits);
13915 snd_hda_codec_write(codec, 0x20, 0,
13916 AC_VERB_SET_COEF_INDEX, 0x0c);
13917 snd_hda_codec_write(codec, 0x20, 0,
13918 AC_VERB_SET_PROC_COEF, 0x680);
13920 snd_hda_codec_write(codec, 0x20, 0,
13921 AC_VERB_SET_COEF_INDEX, 0x0c);
13922 snd_hda_codec_write(codec, 0x20, 0,
13923 AC_VERB_SET_PROC_COEF, 0x480);
13926 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13928 unsigned int present_laptop;
13929 unsigned int present_dock;
13931 present_laptop = snd_hda_jack_detect(codec, 0x18);
13932 present_dock = snd_hda_jack_detect(codec, 0x1b);
13934 /* Laptop mic port overrides dock mic port, design decision */
13936 snd_hda_codec_write(codec, 0x23, 0,
13937 AC_VERB_SET_CONNECT_SEL, 0x3);
13938 if (present_laptop)
13939 snd_hda_codec_write(codec, 0x23, 0,
13940 AC_VERB_SET_CONNECT_SEL, 0x0);
13941 if (!present_dock && !present_laptop)
13942 snd_hda_codec_write(codec, 0x23, 0,
13943 AC_VERB_SET_CONNECT_SEL, 0x1);
13946 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13949 switch (res >> 26) {
13950 case ALC880_HP_EVENT:
13951 alc269_quanta_fl1_speaker_automute(codec);
13953 case ALC880_MIC_EVENT:
13954 alc_mic_automute(codec);
13959 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13962 if ((res >> 26) == ALC880_HP_EVENT)
13963 alc269_lifebook_speaker_automute(codec);
13964 if ((res >> 26) == ALC880_MIC_EVENT)
13965 alc269_lifebook_mic_autoswitch(codec);
13968 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13970 struct alc_spec *spec = codec->spec;
13971 spec->autocfg.hp_pins[0] = 0x15;
13972 spec->autocfg.speaker_pins[0] = 0x14;
13973 spec->ext_mic.pin = 0x18;
13974 spec->ext_mic.mux_idx = 0;
13975 spec->int_mic.pin = 0x19;
13976 spec->int_mic.mux_idx = 1;
13977 spec->auto_mic = 1;
13980 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13982 alc269_quanta_fl1_speaker_automute(codec);
13983 alc_mic_automute(codec);
13986 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13988 alc269_lifebook_speaker_automute(codec);
13989 alc269_lifebook_mic_autoswitch(codec);
13992 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13994 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13995 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13996 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13997 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13998 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13999 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14003 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14004 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14005 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14006 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14008 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14013 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14014 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14015 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14016 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14017 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14018 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14019 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14020 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14024 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14025 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14026 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14027 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14028 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14029 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14030 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14031 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14035 /* toggle speaker-output according to the hp-jack state */
14036 static void alc269_speaker_automute(struct hda_codec *codec)
14038 struct alc_spec *spec = codec->spec;
14039 unsigned int nid = spec->autocfg.hp_pins[0];
14040 unsigned int present;
14041 unsigned char bits;
14043 present = snd_hda_jack_detect(codec, nid);
14044 bits = present ? HDA_AMP_MUTE : 0;
14045 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14046 HDA_AMP_MUTE, bits);
14047 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14048 HDA_AMP_MUTE, bits);
14051 /* unsolicited event for HP jack sensing */
14052 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14055 switch (res >> 26) {
14056 case ALC880_HP_EVENT:
14057 alc269_speaker_automute(codec);
14059 case ALC880_MIC_EVENT:
14060 alc_mic_automute(codec);
14065 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14067 struct alc_spec *spec = codec->spec;
14068 spec->autocfg.hp_pins[0] = 0x15;
14069 spec->autocfg.speaker_pins[0] = 0x14;
14070 spec->ext_mic.pin = 0x18;
14071 spec->ext_mic.mux_idx = 0;
14072 spec->int_mic.pin = 0x19;
14073 spec->int_mic.mux_idx = 1;
14074 spec->auto_mic = 1;
14077 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14079 struct alc_spec *spec = codec->spec;
14080 spec->autocfg.hp_pins[0] = 0x15;
14081 spec->autocfg.speaker_pins[0] = 0x14;
14082 spec->ext_mic.pin = 0x18;
14083 spec->ext_mic.mux_idx = 0;
14084 spec->int_mic.pin = 0x12;
14085 spec->int_mic.mux_idx = 5;
14086 spec->auto_mic = 1;
14089 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14091 struct alc_spec *spec = codec->spec;
14092 spec->autocfg.hp_pins[0] = 0x21;
14093 spec->autocfg.speaker_pins[0] = 0x14;
14094 spec->ext_mic.pin = 0x18;
14095 spec->ext_mic.mux_idx = 0;
14096 spec->int_mic.pin = 0x19;
14097 spec->int_mic.mux_idx = 1;
14098 spec->auto_mic = 1;
14101 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14103 struct alc_spec *spec = codec->spec;
14104 spec->autocfg.hp_pins[0] = 0x21;
14105 spec->autocfg.speaker_pins[0] = 0x14;
14106 spec->ext_mic.pin = 0x18;
14107 spec->ext_mic.mux_idx = 0;
14108 spec->int_mic.pin = 0x12;
14109 spec->int_mic.mux_idx = 6;
14110 spec->auto_mic = 1;
14113 static void alc269_laptop_inithook(struct hda_codec *codec)
14115 alc269_speaker_automute(codec);
14116 alc_mic_automute(codec);
14120 * generic initialization of ADC, input mixers and output mixers
14122 static struct hda_verb alc269_init_verbs[] = {
14124 * Unmute ADC0 and set the default input to mic-in
14126 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14129 * Set up output mixers (0x02 - 0x03)
14131 /* set vol=0 to output mixers */
14132 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14133 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14135 /* set up input amps for analog loopback */
14136 /* Amp Indices: DAC = 0, mixer = 1 */
14137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14139 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14140 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14141 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14142 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14147 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14148 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14149 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14152 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14153 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14155 /* FIXME: use Mux-type input source selection */
14156 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14157 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14158 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14161 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14165 static struct hda_verb alc269vb_init_verbs[] = {
14167 * Unmute ADC0 and set the default input to mic-in
14169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14172 * Set up output mixers (0x02 - 0x03)
14174 /* set vol=0 to output mixers */
14175 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14176 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14178 /* set up input amps for analog loopback */
14179 /* Amp Indices: DAC = 0, mixer = 1 */
14180 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14183 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14185 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14188 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14189 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14190 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14191 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14192 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14193 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14195 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14196 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14198 /* FIXME: use Mux-type input source selection */
14199 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14200 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14201 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14204 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14208 #define alc269_auto_create_multi_out_ctls \
14209 alc268_auto_create_multi_out_ctls
14210 #define alc269_auto_create_input_ctls \
14211 alc268_auto_create_input_ctls
14213 #ifdef CONFIG_SND_HDA_POWER_SAVE
14214 #define alc269_loopbacks alc880_loopbacks
14217 /* pcm configuration: identical with ALC880 */
14218 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14219 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14220 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14221 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14223 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14227 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14228 /* NID is set in alc_build_pcms */
14230 .open = alc880_playback_pcm_open,
14231 .prepare = alc880_playback_pcm_prepare,
14232 .cleanup = alc880_playback_pcm_cleanup
14236 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14240 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14241 /* NID is set in alc_build_pcms */
14244 #ifdef CONFIG_SND_HDA_POWER_SAVE
14245 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14247 switch (codec->subsystem_id) {
14254 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14256 /* update mute-LED according to the speaker mute state */
14257 if (nid == 0x01 || nid == 0x14) {
14259 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14264 /* mic2 vref pin is used for mute LED control */
14265 snd_hda_codec_update_cache(codec, 0x19, 0,
14266 AC_VERB_SET_PIN_WIDGET_CONTROL,
14269 return alc_check_power_status(codec, nid);
14271 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14273 static int alc275_setup_dual_adc(struct hda_codec *codec)
14275 struct alc_spec *spec = codec->spec;
14277 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14279 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14280 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14281 if (spec->ext_mic.pin <= 0x12) {
14282 spec->private_adc_nids[0] = 0x08;
14283 spec->private_adc_nids[1] = 0x11;
14284 spec->private_capsrc_nids[0] = 0x23;
14285 spec->private_capsrc_nids[1] = 0x22;
14287 spec->private_adc_nids[0] = 0x11;
14288 spec->private_adc_nids[1] = 0x08;
14289 spec->private_capsrc_nids[0] = 0x22;
14290 spec->private_capsrc_nids[1] = 0x23;
14292 spec->adc_nids = spec->private_adc_nids;
14293 spec->capsrc_nids = spec->private_capsrc_nids;
14294 spec->num_adc_nids = 2;
14295 spec->dual_adc_switch = 1;
14296 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14297 spec->adc_nids[0], spec->adc_nids[1]);
14304 * BIOS auto configuration
14306 static int alc269_parse_auto_config(struct hda_codec *codec)
14308 struct alc_spec *spec = codec->spec;
14310 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14312 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14317 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14320 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14324 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14326 alc_auto_parse_digital(codec);
14328 if (spec->kctls.list)
14329 add_mixer(spec, spec->kctls.list);
14331 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14332 add_verb(spec, alc269vb_init_verbs);
14333 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14335 add_verb(spec, alc269_init_verbs);
14336 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14339 spec->num_mux_defs = 1;
14340 spec->input_mux = &spec->private_imux[0];
14342 if (!alc275_setup_dual_adc(codec))
14343 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14344 sizeof(alc269_adc_candidates));
14346 /* set default input source */
14347 if (!spec->dual_adc_switch)
14348 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
14349 0, AC_VERB_SET_CONNECT_SEL,
14350 spec->input_mux->items[0].index);
14352 err = alc_auto_add_mic_boost(codec);
14356 if (!spec->cap_mixer && !spec->no_analog)
14357 set_capture_mixer(codec);
14362 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14363 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14364 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14367 /* init callback for auto-configuration model -- overriding the default init */
14368 static void alc269_auto_init(struct hda_codec *codec)
14370 struct alc_spec *spec = codec->spec;
14371 alc269_auto_init_multi_out(codec);
14372 alc269_auto_init_hp_out(codec);
14373 alc269_auto_init_analog_input(codec);
14374 alc_auto_init_digital(codec);
14375 if (spec->unsol_event)
14376 alc_inithook(codec);
14380 ALC269_FIXUP_SONY_VAIO,
14383 static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = {
14384 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14388 static const struct alc_fixup alc269_fixups[] = {
14389 [ALC269_FIXUP_SONY_VAIO] = {
14390 .verbs = alc269_sony_vaio_fixup_verbs
14394 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14395 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14401 * configuration and preset
14403 static const char *alc269_models[ALC269_MODEL_LAST] = {
14404 [ALC269_BASIC] = "basic",
14405 [ALC269_QUANTA_FL1] = "quanta",
14406 [ALC269_AMIC] = "laptop-amic",
14407 [ALC269_DMIC] = "laptop-dmic",
14408 [ALC269_FUJITSU] = "fujitsu",
14409 [ALC269_LIFEBOOK] = "lifebook",
14410 [ALC269_AUTO] = "auto",
14413 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14414 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14415 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14417 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14418 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14419 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14420 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14421 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14422 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14423 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14424 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14425 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14426 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14427 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14428 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14429 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14430 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14431 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14432 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14433 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14434 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14435 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14436 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14437 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14438 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14439 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14440 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14441 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14442 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14443 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14444 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14445 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14446 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14447 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14448 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14449 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14450 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14451 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14452 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14453 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14455 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14457 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14458 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14459 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14460 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14461 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14462 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14463 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14464 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14465 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14466 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14470 static struct alc_config_preset alc269_presets[] = {
14472 .mixers = { alc269_base_mixer },
14473 .init_verbs = { alc269_init_verbs },
14474 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14475 .dac_nids = alc269_dac_nids,
14477 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14478 .channel_mode = alc269_modes,
14479 .input_mux = &alc269_capture_source,
14481 [ALC269_QUANTA_FL1] = {
14482 .mixers = { alc269_quanta_fl1_mixer },
14483 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14484 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14485 .dac_nids = alc269_dac_nids,
14487 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14488 .channel_mode = alc269_modes,
14489 .input_mux = &alc269_capture_source,
14490 .unsol_event = alc269_quanta_fl1_unsol_event,
14491 .setup = alc269_quanta_fl1_setup,
14492 .init_hook = alc269_quanta_fl1_init_hook,
14495 .mixers = { alc269_laptop_mixer },
14496 .cap_mixer = alc269_laptop_analog_capture_mixer,
14497 .init_verbs = { alc269_init_verbs,
14498 alc269_laptop_amic_init_verbs },
14499 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14500 .dac_nids = alc269_dac_nids,
14502 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14503 .channel_mode = alc269_modes,
14504 .unsol_event = alc269_laptop_unsol_event,
14505 .setup = alc269_laptop_amic_setup,
14506 .init_hook = alc269_laptop_inithook,
14509 .mixers = { alc269_laptop_mixer },
14510 .cap_mixer = alc269_laptop_digital_capture_mixer,
14511 .init_verbs = { alc269_init_verbs,
14512 alc269_laptop_dmic_init_verbs },
14513 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14514 .dac_nids = alc269_dac_nids,
14516 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14517 .channel_mode = alc269_modes,
14518 .unsol_event = alc269_laptop_unsol_event,
14519 .setup = alc269_laptop_dmic_setup,
14520 .init_hook = alc269_laptop_inithook,
14522 [ALC269VB_AMIC] = {
14523 .mixers = { alc269vb_laptop_mixer },
14524 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14525 .init_verbs = { alc269vb_init_verbs,
14526 alc269vb_laptop_amic_init_verbs },
14527 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14528 .dac_nids = alc269_dac_nids,
14530 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14531 .channel_mode = alc269_modes,
14532 .unsol_event = alc269_laptop_unsol_event,
14533 .setup = alc269vb_laptop_amic_setup,
14534 .init_hook = alc269_laptop_inithook,
14536 [ALC269VB_DMIC] = {
14537 .mixers = { alc269vb_laptop_mixer },
14538 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14539 .init_verbs = { alc269vb_init_verbs,
14540 alc269vb_laptop_dmic_init_verbs },
14541 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14542 .dac_nids = alc269_dac_nids,
14544 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14545 .channel_mode = alc269_modes,
14546 .unsol_event = alc269_laptop_unsol_event,
14547 .setup = alc269vb_laptop_dmic_setup,
14548 .init_hook = alc269_laptop_inithook,
14550 [ALC269_FUJITSU] = {
14551 .mixers = { alc269_fujitsu_mixer },
14552 .cap_mixer = alc269_laptop_digital_capture_mixer,
14553 .init_verbs = { alc269_init_verbs,
14554 alc269_laptop_dmic_init_verbs },
14555 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14556 .dac_nids = alc269_dac_nids,
14558 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14559 .channel_mode = alc269_modes,
14560 .unsol_event = alc269_laptop_unsol_event,
14561 .setup = alc269_laptop_dmic_setup,
14562 .init_hook = alc269_laptop_inithook,
14564 [ALC269_LIFEBOOK] = {
14565 .mixers = { alc269_lifebook_mixer },
14566 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14567 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14568 .dac_nids = alc269_dac_nids,
14570 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14571 .channel_mode = alc269_modes,
14572 .input_mux = &alc269_capture_source,
14573 .unsol_event = alc269_lifebook_unsol_event,
14574 .init_hook = alc269_lifebook_init_hook,
14578 static int patch_alc269(struct hda_codec *codec)
14580 struct alc_spec *spec;
14583 int is_alc269vb = 0;
14585 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14589 codec->spec = spec;
14591 alc_auto_parse_customize_define(codec);
14593 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14594 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14595 spec->cdefine.platform_type == 1)
14596 alc_codec_rename(codec, "ALC271X");
14598 alc_codec_rename(codec, "ALC259");
14601 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14603 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14607 if (board_config < 0) {
14608 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14610 board_config = ALC269_AUTO;
14613 if (board_config == ALC269_AUTO)
14614 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14616 if (board_config == ALC269_AUTO) {
14617 /* automatic parse from the BIOS config */
14618 err = alc269_parse_auto_config(codec);
14624 "hda_codec: Cannot set up configuration "
14625 "from BIOS. Using base mode...\n");
14626 board_config = ALC269_BASIC;
14630 if (has_cdefine_beep(codec)) {
14631 err = snd_hda_attach_beep_device(codec, 0x1);
14638 if (board_config != ALC269_AUTO)
14639 setup_preset(codec, &alc269_presets[board_config]);
14641 if (board_config == ALC269_QUANTA_FL1) {
14642 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14643 * fix the sample rate of analog I/O to 44.1kHz
14645 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14646 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14647 } else if (spec->dual_adc_switch) {
14648 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14649 /* switch ADC dynamically */
14650 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14652 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14653 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14655 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14656 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14658 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14659 if (!is_alc269vb) {
14660 spec->adc_nids = alc269_adc_nids;
14661 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14662 spec->capsrc_nids = alc269_capsrc_nids;
14664 spec->adc_nids = alc269vb_adc_nids;
14665 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14666 spec->capsrc_nids = alc269vb_capsrc_nids;
14670 if (!spec->cap_mixer)
14671 set_capture_mixer(codec);
14672 if (has_cdefine_beep(codec))
14673 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14675 if (board_config == ALC269_AUTO)
14676 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14678 spec->vmaster_nid = 0x02;
14680 codec->patch_ops = alc_patch_ops;
14681 if (board_config == ALC269_AUTO)
14682 spec->init_hook = alc269_auto_init;
14683 #ifdef CONFIG_SND_HDA_POWER_SAVE
14684 if (!spec->loopback.amplist)
14685 spec->loopback.amplist = alc269_loopbacks;
14686 if (alc269_mic2_for_mute_led(codec))
14687 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14694 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14698 * set the path ways for 2 channel output
14699 * need to set the codec line out and mic 1 pin widgets to inputs
14701 static struct hda_verb alc861_threestack_ch2_init[] = {
14702 /* set pin widget 1Ah (line in) for input */
14703 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14704 /* set pin widget 18h (mic1/2) for input, for mic also enable
14707 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14709 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14711 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14712 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14718 * need to set the codec line out and mic 1 pin widgets to outputs
14720 static struct hda_verb alc861_threestack_ch6_init[] = {
14721 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14722 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14723 /* set pin widget 18h (mic1) for output (CLFE)*/
14724 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14726 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14727 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14729 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14731 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14732 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14737 static struct hda_channel_mode alc861_threestack_modes[2] = {
14738 { 2, alc861_threestack_ch2_init },
14739 { 6, alc861_threestack_ch6_init },
14741 /* Set mic1 as input and unmute the mixer */
14742 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14743 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14744 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14747 /* Set mic1 as output and mute mixer */
14748 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14749 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14750 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14754 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14755 { 2, alc861_uniwill_m31_ch2_init },
14756 { 4, alc861_uniwill_m31_ch4_init },
14759 /* Set mic1 and line-in as input and unmute the mixer */
14760 static struct hda_verb alc861_asus_ch2_init[] = {
14761 /* set pin widget 1Ah (line in) for input */
14762 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14763 /* set pin widget 18h (mic1/2) for input, for mic also enable
14766 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14768 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14770 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14771 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14775 /* Set mic1 nad line-in as output and mute mixer */
14776 static struct hda_verb alc861_asus_ch6_init[] = {
14777 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14778 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14779 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14780 /* set pin widget 18h (mic1) for output (CLFE)*/
14781 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14782 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14783 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14784 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14786 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14788 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14789 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14794 static struct hda_channel_mode alc861_asus_modes[2] = {
14795 { 2, alc861_asus_ch2_init },
14796 { 6, alc861_asus_ch6_init },
14801 static struct snd_kcontrol_new alc861_base_mixer[] = {
14802 /* output mixer control */
14803 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14804 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14805 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14806 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14807 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14809 /*Input mixer control */
14810 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14811 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14812 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14813 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14814 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14815 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14817 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14824 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14825 /* output mixer control */
14826 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14827 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14828 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14829 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14830 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14832 /* Input mixer control */
14833 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14834 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14835 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14836 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14837 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14838 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14840 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14841 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14842 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14845 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14846 .name = "Channel Mode",
14847 .info = alc_ch_mode_info,
14848 .get = alc_ch_mode_get,
14849 .put = alc_ch_mode_put,
14850 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14855 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14856 /* output mixer control */
14857 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14859 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14864 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14865 /* output mixer control */
14866 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14867 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14868 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14869 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14870 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14872 /* Input mixer control */
14873 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14874 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14875 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14876 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14877 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14878 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14880 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14885 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14886 .name = "Channel Mode",
14887 .info = alc_ch_mode_info,
14888 .get = alc_ch_mode_get,
14889 .put = alc_ch_mode_put,
14890 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14895 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14896 /* output mixer control */
14897 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14898 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14899 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14900 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14901 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14903 /* Input mixer control */
14904 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14905 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14906 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14907 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14908 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14909 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14910 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14911 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14912 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14916 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14917 .name = "Channel Mode",
14918 .info = alc_ch_mode_info,
14919 .get = alc_ch_mode_get,
14920 .put = alc_ch_mode_put,
14921 .private_value = ARRAY_SIZE(alc861_asus_modes),
14926 /* additional mixer */
14927 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14928 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14929 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14934 * generic initialization of ADC, input mixers and output mixers
14936 static struct hda_verb alc861_base_init_verbs[] = {
14938 * Unmute ADC0 and set the default input to mic-in
14940 /* port-A for surround (rear panel) */
14941 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14942 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14943 /* port-B for mic-in (rear panel) with vref */
14944 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14945 /* port-C for line-in (rear panel) */
14946 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14947 /* port-D for Front */
14948 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14949 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14950 /* port-E for HP out (front panel) */
14951 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14952 /* route front PCM to HP */
14953 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14954 /* port-F for mic-in (front panel) with vref */
14955 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14956 /* port-G for CLFE (rear panel) */
14957 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14958 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14959 /* port-H for side (rear panel) */
14960 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14961 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14963 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14964 /* route front mic to ADC1*/
14965 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14966 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14968 /* Unmute DAC0~3 & spdif out*/
14969 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14970 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14971 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14972 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14975 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14976 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14977 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14978 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14979 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14981 /* Unmute Stereo Mixer 15 */
14982 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14983 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14984 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14987 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14988 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14989 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14990 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14991 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14993 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14995 /* hp used DAC 3 (Front) */
14996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15002 static struct hda_verb alc861_threestack_init_verbs[] = {
15004 * Unmute ADC0 and set the default input to mic-in
15006 /* port-A for surround (rear panel) */
15007 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15008 /* port-B for mic-in (rear panel) with vref */
15009 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15010 /* port-C for line-in (rear panel) */
15011 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15012 /* port-D for Front */
15013 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15014 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15015 /* port-E for HP out (front panel) */
15016 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15017 /* route front PCM to HP */
15018 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15019 /* port-F for mic-in (front panel) with vref */
15020 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15021 /* port-G for CLFE (rear panel) */
15022 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15023 /* port-H for side (rear panel) */
15024 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15026 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15027 /* route front mic to ADC1*/
15028 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15029 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15030 /* Unmute DAC0~3 & spdif out*/
15031 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15032 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15033 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15034 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15035 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15037 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15038 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15039 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15040 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15041 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15043 /* Unmute Stereo Mixer 15 */
15044 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15046 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15049 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15050 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15051 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15052 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15054 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15056 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15057 /* hp used DAC 3 (Front) */
15058 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15063 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15065 * Unmute ADC0 and set the default input to mic-in
15067 /* port-A for surround (rear panel) */
15068 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15069 /* port-B for mic-in (rear panel) with vref */
15070 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15071 /* port-C for line-in (rear panel) */
15072 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15073 /* port-D for Front */
15074 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15075 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15076 /* port-E for HP out (front panel) */
15077 /* this has to be set to VREF80 */
15078 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15079 /* route front PCM to HP */
15080 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15081 /* port-F for mic-in (front panel) with vref */
15082 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15083 /* port-G for CLFE (rear panel) */
15084 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15085 /* port-H for side (rear panel) */
15086 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15088 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15089 /* route front mic to ADC1*/
15090 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15091 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15092 /* Unmute DAC0~3 & spdif out*/
15093 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15094 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15095 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15096 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15099 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15100 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15101 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15102 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15103 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15105 /* Unmute Stereo Mixer 15 */
15106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15107 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15108 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15109 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15111 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15112 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15113 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15114 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15116 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15117 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15118 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15119 /* hp used DAC 3 (Front) */
15120 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15121 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15125 static struct hda_verb alc861_asus_init_verbs[] = {
15127 * Unmute ADC0 and set the default input to mic-in
15129 /* port-A for surround (rear panel)
15130 * according to codec#0 this is the HP jack
15132 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15133 /* route front PCM to HP */
15134 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15135 /* port-B for mic-in (rear panel) with vref */
15136 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15137 /* port-C for line-in (rear panel) */
15138 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15139 /* port-D for Front */
15140 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15141 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15142 /* port-E for HP out (front panel) */
15143 /* this has to be set to VREF80 */
15144 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15145 /* route front PCM to HP */
15146 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15147 /* port-F for mic-in (front panel) with vref */
15148 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15149 /* port-G for CLFE (rear panel) */
15150 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15151 /* port-H for side (rear panel) */
15152 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15154 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15155 /* route front mic to ADC1*/
15156 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15157 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15158 /* Unmute DAC0~3 & spdif out*/
15159 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15160 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15161 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15162 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15164 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15165 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15166 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15167 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15168 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15170 /* Unmute Stereo Mixer 15 */
15171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15174 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15176 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15177 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15178 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15179 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15180 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15182 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15183 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15184 /* hp used DAC 3 (Front) */
15185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15186 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15190 /* additional init verbs for ASUS laptops */
15191 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15192 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15193 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15198 * generic initialization of ADC, input mixers and output mixers
15200 static struct hda_verb alc861_auto_init_verbs[] = {
15202 * Unmute ADC0 and set the default input to mic-in
15204 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15207 /* Unmute DAC0~3 & spdif out*/
15208 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15209 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15210 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15211 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15214 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15215 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15216 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15217 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15218 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15220 /* Unmute Stereo Mixer 15 */
15221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15226 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15227 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15228 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15229 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15230 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15231 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15233 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15235 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15236 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15237 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15238 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15239 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15240 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15241 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15242 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15244 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15249 static struct hda_verb alc861_toshiba_init_verbs[] = {
15250 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15255 /* toggle speaker-output according to the hp-jack state */
15256 static void alc861_toshiba_automute(struct hda_codec *codec)
15258 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15260 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15261 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15262 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15263 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15266 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15269 if ((res >> 26) == ALC880_HP_EVENT)
15270 alc861_toshiba_automute(codec);
15273 /* pcm configuration: identical with ALC880 */
15274 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15275 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15276 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15277 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15280 #define ALC861_DIGOUT_NID 0x07
15282 static struct hda_channel_mode alc861_8ch_modes[1] = {
15286 static hda_nid_t alc861_dac_nids[4] = {
15287 /* front, surround, clfe, side */
15288 0x03, 0x06, 0x05, 0x04
15291 static hda_nid_t alc660_dac_nids[3] = {
15292 /* front, clfe, surround */
15296 static hda_nid_t alc861_adc_nids[1] = {
15301 static struct hda_input_mux alc861_capture_source = {
15305 { "Front Mic", 0x3 },
15312 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15314 struct alc_spec *spec = codec->spec;
15315 hda_nid_t mix, srcs[5];
15318 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15320 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15323 for (i = 0; i < num; i++) {
15325 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15326 if (type != AC_WID_AUD_OUT)
15328 for (j = 0; j < spec->multiout.num_dacs; j++)
15329 if (spec->multiout.dac_nids[j] == srcs[i])
15331 if (j >= spec->multiout.num_dacs)
15337 /* fill in the dac_nids table from the parsed pin configuration */
15338 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15339 const struct auto_pin_cfg *cfg)
15341 struct alc_spec *spec = codec->spec;
15343 hda_nid_t nid, dac;
15345 spec->multiout.dac_nids = spec->private_dac_nids;
15346 for (i = 0; i < cfg->line_outs; i++) {
15347 nid = cfg->line_out_pins[i];
15348 dac = alc861_look_for_dac(codec, nid);
15351 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15356 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15357 hda_nid_t nid, unsigned int chs)
15359 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15360 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15363 /* add playback controls from the parsed DAC table */
15364 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15365 const struct auto_pin_cfg *cfg)
15367 struct alc_spec *spec = codec->spec;
15368 static const char *chname[4] = {
15369 "Front", "Surround", NULL /*CLFE*/, "Side"
15374 if (cfg->line_outs == 1) {
15375 const char *pfx = NULL;
15378 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15381 nid = spec->multiout.dac_nids[0];
15382 return alc861_create_out_sw(codec, pfx, nid, 3);
15386 for (i = 0; i < cfg->line_outs; i++) {
15387 nid = spec->multiout.dac_nids[i];
15392 err = alc861_create_out_sw(codec, "Center", nid, 1);
15395 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15399 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15407 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15409 struct alc_spec *spec = codec->spec;
15416 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15417 nid = alc861_look_for_dac(codec, pin);
15419 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15422 spec->multiout.hp_nid = nid;
15428 /* create playback/capture controls for input pins */
15429 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15430 const struct auto_pin_cfg *cfg)
15432 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15435 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15437 int pin_type, hda_nid_t dac)
15439 hda_nid_t mix, srcs[5];
15442 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15444 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15446 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15448 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15451 for (i = 0; i < num; i++) {
15453 if (srcs[i] == dac || srcs[i] == 0x15)
15454 mute = AMP_IN_UNMUTE(i);
15456 mute = AMP_IN_MUTE(i);
15457 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15462 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15464 struct alc_spec *spec = codec->spec;
15467 for (i = 0; i < spec->autocfg.line_outs; i++) {
15468 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15469 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15471 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15472 spec->multiout.dac_nids[i]);
15476 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15478 struct alc_spec *spec = codec->spec;
15480 if (spec->autocfg.hp_outs)
15481 alc861_auto_set_output_and_unmute(codec,
15482 spec->autocfg.hp_pins[0],
15484 spec->multiout.hp_nid);
15485 if (spec->autocfg.speaker_outs)
15486 alc861_auto_set_output_and_unmute(codec,
15487 spec->autocfg.speaker_pins[0],
15489 spec->multiout.dac_nids[0]);
15492 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15494 struct alc_spec *spec = codec->spec;
15497 for (i = 0; i < AUTO_PIN_LAST; i++) {
15498 hda_nid_t nid = spec->autocfg.input_pins[i];
15499 if (nid >= 0x0c && nid <= 0x11)
15500 alc_set_input_pin(codec, nid, i);
15504 /* parse the BIOS configuration and set up the alc_spec */
15505 /* return 1 if successful, 0 if the proper config is not found,
15506 * or a negative error code
15508 static int alc861_parse_auto_config(struct hda_codec *codec)
15510 struct alc_spec *spec = codec->spec;
15512 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15514 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15518 if (!spec->autocfg.line_outs)
15519 return 0; /* can't find valid BIOS pin config */
15521 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15524 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15527 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15530 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15534 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15536 alc_auto_parse_digital(codec);
15538 if (spec->kctls.list)
15539 add_mixer(spec, spec->kctls.list);
15541 add_verb(spec, alc861_auto_init_verbs);
15543 spec->num_mux_defs = 1;
15544 spec->input_mux = &spec->private_imux[0];
15546 spec->adc_nids = alc861_adc_nids;
15547 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15548 set_capture_mixer(codec);
15550 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15555 /* additional initialization for auto-configuration model */
15556 static void alc861_auto_init(struct hda_codec *codec)
15558 struct alc_spec *spec = codec->spec;
15559 alc861_auto_init_multi_out(codec);
15560 alc861_auto_init_hp_out(codec);
15561 alc861_auto_init_analog_input(codec);
15562 alc_auto_init_digital(codec);
15563 if (spec->unsol_event)
15564 alc_inithook(codec);
15567 #ifdef CONFIG_SND_HDA_POWER_SAVE
15568 static struct hda_amp_list alc861_loopbacks[] = {
15569 { 0x15, HDA_INPUT, 0 },
15570 { 0x15, HDA_INPUT, 1 },
15571 { 0x15, HDA_INPUT, 2 },
15572 { 0x15, HDA_INPUT, 3 },
15579 * configuration and preset
15581 static const char *alc861_models[ALC861_MODEL_LAST] = {
15582 [ALC861_3ST] = "3stack",
15583 [ALC660_3ST] = "3stack-660",
15584 [ALC861_3ST_DIG] = "3stack-dig",
15585 [ALC861_6ST_DIG] = "6stack-dig",
15586 [ALC861_UNIWILL_M31] = "uniwill-m31",
15587 [ALC861_TOSHIBA] = "toshiba",
15588 [ALC861_ASUS] = "asus",
15589 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15590 [ALC861_AUTO] = "auto",
15593 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15594 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15595 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15596 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15597 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15598 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15599 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15600 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15601 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15602 * Any other models that need this preset?
15604 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15605 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15606 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15607 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15608 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15609 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15610 /* FIXME: the below seems conflict */
15611 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15612 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15613 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15617 static struct alc_config_preset alc861_presets[] = {
15619 .mixers = { alc861_3ST_mixer },
15620 .init_verbs = { alc861_threestack_init_verbs },
15621 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15622 .dac_nids = alc861_dac_nids,
15623 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15624 .channel_mode = alc861_threestack_modes,
15626 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15627 .adc_nids = alc861_adc_nids,
15628 .input_mux = &alc861_capture_source,
15630 [ALC861_3ST_DIG] = {
15631 .mixers = { alc861_base_mixer },
15632 .init_verbs = { alc861_threestack_init_verbs },
15633 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15634 .dac_nids = alc861_dac_nids,
15635 .dig_out_nid = ALC861_DIGOUT_NID,
15636 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15637 .channel_mode = alc861_threestack_modes,
15639 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15640 .adc_nids = alc861_adc_nids,
15641 .input_mux = &alc861_capture_source,
15643 [ALC861_6ST_DIG] = {
15644 .mixers = { alc861_base_mixer },
15645 .init_verbs = { alc861_base_init_verbs },
15646 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15647 .dac_nids = alc861_dac_nids,
15648 .dig_out_nid = ALC861_DIGOUT_NID,
15649 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15650 .channel_mode = alc861_8ch_modes,
15651 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15652 .adc_nids = alc861_adc_nids,
15653 .input_mux = &alc861_capture_source,
15656 .mixers = { alc861_3ST_mixer },
15657 .init_verbs = { alc861_threestack_init_verbs },
15658 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15659 .dac_nids = alc660_dac_nids,
15660 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15661 .channel_mode = alc861_threestack_modes,
15663 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15664 .adc_nids = alc861_adc_nids,
15665 .input_mux = &alc861_capture_source,
15667 [ALC861_UNIWILL_M31] = {
15668 .mixers = { alc861_uniwill_m31_mixer },
15669 .init_verbs = { alc861_uniwill_m31_init_verbs },
15670 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15671 .dac_nids = alc861_dac_nids,
15672 .dig_out_nid = ALC861_DIGOUT_NID,
15673 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15674 .channel_mode = alc861_uniwill_m31_modes,
15676 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15677 .adc_nids = alc861_adc_nids,
15678 .input_mux = &alc861_capture_source,
15680 [ALC861_TOSHIBA] = {
15681 .mixers = { alc861_toshiba_mixer },
15682 .init_verbs = { alc861_base_init_verbs,
15683 alc861_toshiba_init_verbs },
15684 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15685 .dac_nids = alc861_dac_nids,
15686 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15687 .channel_mode = alc883_3ST_2ch_modes,
15688 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15689 .adc_nids = alc861_adc_nids,
15690 .input_mux = &alc861_capture_source,
15691 .unsol_event = alc861_toshiba_unsol_event,
15692 .init_hook = alc861_toshiba_automute,
15695 .mixers = { alc861_asus_mixer },
15696 .init_verbs = { alc861_asus_init_verbs },
15697 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15698 .dac_nids = alc861_dac_nids,
15699 .dig_out_nid = ALC861_DIGOUT_NID,
15700 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15701 .channel_mode = alc861_asus_modes,
15704 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15705 .adc_nids = alc861_adc_nids,
15706 .input_mux = &alc861_capture_source,
15708 [ALC861_ASUS_LAPTOP] = {
15709 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15710 .init_verbs = { alc861_asus_init_verbs,
15711 alc861_asus_laptop_init_verbs },
15712 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15713 .dac_nids = alc861_dac_nids,
15714 .dig_out_nid = ALC861_DIGOUT_NID,
15715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15716 .channel_mode = alc883_3ST_2ch_modes,
15718 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15719 .adc_nids = alc861_adc_nids,
15720 .input_mux = &alc861_capture_source,
15724 /* Pin config fixes */
15726 PINFIX_FSC_AMILO_PI1505,
15729 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15730 { 0x0b, 0x0221101f }, /* HP */
15731 { 0x0f, 0x90170310 }, /* speaker */
15735 static const struct alc_fixup alc861_fixups[] = {
15736 [PINFIX_FSC_AMILO_PI1505] = {
15737 .pins = alc861_fsc_amilo_pi1505_pinfix
15741 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15742 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15746 static int patch_alc861(struct hda_codec *codec)
15748 struct alc_spec *spec;
15752 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15756 codec->spec = spec;
15758 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15762 if (board_config < 0) {
15763 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15765 board_config = ALC861_AUTO;
15768 if (board_config == ALC861_AUTO)
15769 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15771 if (board_config == ALC861_AUTO) {
15772 /* automatic parse from the BIOS config */
15773 err = alc861_parse_auto_config(codec);
15779 "hda_codec: Cannot set up configuration "
15780 "from BIOS. Using base mode...\n");
15781 board_config = ALC861_3ST_DIG;
15785 err = snd_hda_attach_beep_device(codec, 0x23);
15791 if (board_config != ALC861_AUTO)
15792 setup_preset(codec, &alc861_presets[board_config]);
15794 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15795 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15797 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15798 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15800 if (!spec->cap_mixer)
15801 set_capture_mixer(codec);
15802 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15804 spec->vmaster_nid = 0x03;
15806 if (board_config == ALC861_AUTO)
15807 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15809 codec->patch_ops = alc_patch_ops;
15810 if (board_config == ALC861_AUTO) {
15811 spec->init_hook = alc861_auto_init;
15812 #ifdef CONFIG_SND_HDA_POWER_SAVE
15813 spec->power_hook = alc_power_eapd;
15816 #ifdef CONFIG_SND_HDA_POWER_SAVE
15817 if (!spec->loopback.amplist)
15818 spec->loopback.amplist = alc861_loopbacks;
15825 * ALC861-VD support
15829 * In addition, an independent DAC
15831 #define ALC861VD_DIGOUT_NID 0x06
15833 static hda_nid_t alc861vd_dac_nids[4] = {
15834 /* front, surr, clfe, side surr */
15835 0x02, 0x03, 0x04, 0x05
15838 /* dac_nids for ALC660vd are in a different order - according to
15839 * Realtek's driver.
15840 * This should probably result in a different mixer for 6stack models
15841 * of ALC660vd codecs, but for now there is only 3stack mixer
15842 * - and it is the same as in 861vd.
15843 * adc_nids in ALC660vd are (is) the same as in 861vd
15845 static hda_nid_t alc660vd_dac_nids[3] = {
15846 /* front, rear, clfe, rear_surr */
15850 static hda_nid_t alc861vd_adc_nids[1] = {
15855 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15858 /* FIXME: should be a matrix-type input source selection */
15859 static struct hda_input_mux alc861vd_capture_source = {
15863 { "Front Mic", 0x1 },
15869 static struct hda_input_mux alc861vd_dallas_capture_source = {
15872 { "Ext Mic", 0x0 },
15873 { "Int Mic", 0x1 },
15877 static struct hda_input_mux alc861vd_hp_capture_source = {
15880 { "Front Mic", 0x0 },
15881 { "ATAPI Mic", 0x1 },
15888 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15895 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15896 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15897 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15898 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15899 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15906 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15907 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15908 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15909 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15910 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15914 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15915 { 6, alc861vd_6stack_ch6_init },
15916 { 8, alc861vd_6stack_ch8_init },
15919 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15921 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15922 .name = "Channel Mode",
15923 .info = alc_ch_mode_info,
15924 .get = alc_ch_mode_get,
15925 .put = alc_ch_mode_put,
15930 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15931 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15933 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15934 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15935 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15937 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15938 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15940 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15942 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15944 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15945 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15947 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15948 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15952 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15954 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15956 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15957 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15958 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15960 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15961 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15963 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15964 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15969 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15970 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15971 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15973 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15975 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15979 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15980 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15981 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15983 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15984 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15987 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15992 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15993 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15994 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15995 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15999 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16001 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16003 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16004 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16005 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16007 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16008 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16013 /* Pin assignment: Speaker=0x14, HP = 0x15,
16014 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16016 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16017 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16018 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16019 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16020 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16021 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16022 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16023 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16024 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16025 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16026 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16030 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16031 * Front Mic=0x18, ATAPI Mic = 0x19,
16033 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16034 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16035 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16036 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16037 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16038 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16039 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16040 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16041 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16047 * generic initialization of ADC, input mixers and output mixers
16049 static struct hda_verb alc861vd_volume_init_verbs[] = {
16051 * Unmute ADC0 and set the default input to mic-in
16053 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16054 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16056 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16057 * the analog-loopback mixer widget
16059 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16066 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16073 * Set up output mixers (0x02 - 0x05)
16075 /* set vol=0 to output mixers */
16076 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16077 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16078 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16079 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16081 /* set up input amps for analog loopback */
16082 /* Amp Indices: DAC = 0, mixer = 1 */
16083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16085 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16087 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16088 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16089 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16096 * 3-stack pin configuration:
16097 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16099 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16101 * Set pin mode and muting
16103 /* set front pin widgets 0x14 for output */
16104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16105 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16106 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16108 /* Mic (rear) pin: input vref at 80% */
16109 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16110 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16111 /* Front Mic pin: input vref at 80% */
16112 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16113 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16114 /* Line In pin: input */
16115 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16116 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16117 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16119 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16120 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16121 /* CD pin widget for input */
16122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16128 * 6-stack pin configuration:
16130 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16132 * Set pin mode and muting
16134 /* set front pin widgets 0x14 for output */
16135 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16136 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16137 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16139 /* Rear Pin: output 1 (0x0d) */
16140 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16143 /* CLFE Pin: output 2 (0x0e) */
16144 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16145 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16146 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16147 /* Side Pin: output 3 (0x0f) */
16148 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16149 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16150 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16152 /* Mic (rear) pin: input vref at 80% */
16153 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16154 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16155 /* Front Mic pin: input vref at 80% */
16156 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16157 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16158 /* Line In pin: input */
16159 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16160 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16161 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16163 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16164 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16165 /* CD pin widget for input */
16166 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16171 static struct hda_verb alc861vd_eapd_verbs[] = {
16172 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16176 static struct hda_verb alc660vd_eapd_verbs[] = {
16177 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16178 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16182 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16186 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16187 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16191 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16193 unsigned int present;
16194 unsigned char bits;
16196 present = snd_hda_jack_detect(codec, 0x18);
16197 bits = present ? HDA_AMP_MUTE : 0;
16199 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16200 HDA_AMP_MUTE, bits);
16203 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16205 struct alc_spec *spec = codec->spec;
16206 spec->autocfg.hp_pins[0] = 0x1b;
16207 spec->autocfg.speaker_pins[0] = 0x14;
16210 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16212 alc_automute_amp(codec);
16213 alc861vd_lenovo_mic_automute(codec);
16216 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16219 switch (res >> 26) {
16220 case ALC880_MIC_EVENT:
16221 alc861vd_lenovo_mic_automute(codec);
16224 alc_automute_amp_unsol_event(codec, res);
16229 static struct hda_verb alc861vd_dallas_verbs[] = {
16230 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16231 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16232 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16233 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16238 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16239 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16240 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16241 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16242 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16245 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16248 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16249 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16250 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16251 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16253 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16254 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16255 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16256 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16257 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16259 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16260 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16262 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16267 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16268 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16274 /* toggle speaker-output according to the hp-jack state */
16275 static void alc861vd_dallas_setup(struct hda_codec *codec)
16277 struct alc_spec *spec = codec->spec;
16279 spec->autocfg.hp_pins[0] = 0x15;
16280 spec->autocfg.speaker_pins[0] = 0x14;
16283 #ifdef CONFIG_SND_HDA_POWER_SAVE
16284 #define alc861vd_loopbacks alc880_loopbacks
16287 /* pcm configuration: identical with ALC880 */
16288 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16289 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16290 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16291 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16294 * configuration and preset
16296 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16297 [ALC660VD_3ST] = "3stack-660",
16298 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16299 [ALC660VD_ASUS_V1S] = "asus-v1s",
16300 [ALC861VD_3ST] = "3stack",
16301 [ALC861VD_3ST_DIG] = "3stack-digout",
16302 [ALC861VD_6ST_DIG] = "6stack-digout",
16303 [ALC861VD_LENOVO] = "lenovo",
16304 [ALC861VD_DALLAS] = "dallas",
16305 [ALC861VD_HP] = "hp",
16306 [ALC861VD_AUTO] = "auto",
16309 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16310 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16311 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16312 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16313 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16314 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16315 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16316 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16317 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16318 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16319 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16320 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16321 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16322 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16323 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16324 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16328 static struct alc_config_preset alc861vd_presets[] = {
16330 .mixers = { alc861vd_3st_mixer },
16331 .init_verbs = { alc861vd_volume_init_verbs,
16332 alc861vd_3stack_init_verbs },
16333 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16334 .dac_nids = alc660vd_dac_nids,
16335 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16336 .channel_mode = alc861vd_3stack_2ch_modes,
16337 .input_mux = &alc861vd_capture_source,
16339 [ALC660VD_3ST_DIG] = {
16340 .mixers = { alc861vd_3st_mixer },
16341 .init_verbs = { alc861vd_volume_init_verbs,
16342 alc861vd_3stack_init_verbs },
16343 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16344 .dac_nids = alc660vd_dac_nids,
16345 .dig_out_nid = ALC861VD_DIGOUT_NID,
16346 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16347 .channel_mode = alc861vd_3stack_2ch_modes,
16348 .input_mux = &alc861vd_capture_source,
16351 .mixers = { alc861vd_3st_mixer },
16352 .init_verbs = { alc861vd_volume_init_verbs,
16353 alc861vd_3stack_init_verbs },
16354 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16355 .dac_nids = alc861vd_dac_nids,
16356 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16357 .channel_mode = alc861vd_3stack_2ch_modes,
16358 .input_mux = &alc861vd_capture_source,
16360 [ALC861VD_3ST_DIG] = {
16361 .mixers = { alc861vd_3st_mixer },
16362 .init_verbs = { alc861vd_volume_init_verbs,
16363 alc861vd_3stack_init_verbs },
16364 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16365 .dac_nids = alc861vd_dac_nids,
16366 .dig_out_nid = ALC861VD_DIGOUT_NID,
16367 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16368 .channel_mode = alc861vd_3stack_2ch_modes,
16369 .input_mux = &alc861vd_capture_source,
16371 [ALC861VD_6ST_DIG] = {
16372 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16373 .init_verbs = { alc861vd_volume_init_verbs,
16374 alc861vd_6stack_init_verbs },
16375 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16376 .dac_nids = alc861vd_dac_nids,
16377 .dig_out_nid = ALC861VD_DIGOUT_NID,
16378 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16379 .channel_mode = alc861vd_6stack_modes,
16380 .input_mux = &alc861vd_capture_source,
16382 [ALC861VD_LENOVO] = {
16383 .mixers = { alc861vd_lenovo_mixer },
16384 .init_verbs = { alc861vd_volume_init_verbs,
16385 alc861vd_3stack_init_verbs,
16386 alc861vd_eapd_verbs,
16387 alc861vd_lenovo_unsol_verbs },
16388 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16389 .dac_nids = alc660vd_dac_nids,
16390 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16391 .channel_mode = alc861vd_3stack_2ch_modes,
16392 .input_mux = &alc861vd_capture_source,
16393 .unsol_event = alc861vd_lenovo_unsol_event,
16394 .setup = alc861vd_lenovo_setup,
16395 .init_hook = alc861vd_lenovo_init_hook,
16397 [ALC861VD_DALLAS] = {
16398 .mixers = { alc861vd_dallas_mixer },
16399 .init_verbs = { alc861vd_dallas_verbs },
16400 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16401 .dac_nids = alc861vd_dac_nids,
16402 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16403 .channel_mode = alc861vd_3stack_2ch_modes,
16404 .input_mux = &alc861vd_dallas_capture_source,
16405 .unsol_event = alc_automute_amp_unsol_event,
16406 .setup = alc861vd_dallas_setup,
16407 .init_hook = alc_automute_amp,
16410 .mixers = { alc861vd_hp_mixer },
16411 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16412 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16413 .dac_nids = alc861vd_dac_nids,
16414 .dig_out_nid = ALC861VD_DIGOUT_NID,
16415 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16416 .channel_mode = alc861vd_3stack_2ch_modes,
16417 .input_mux = &alc861vd_hp_capture_source,
16418 .unsol_event = alc_automute_amp_unsol_event,
16419 .setup = alc861vd_dallas_setup,
16420 .init_hook = alc_automute_amp,
16422 [ALC660VD_ASUS_V1S] = {
16423 .mixers = { alc861vd_lenovo_mixer },
16424 .init_verbs = { alc861vd_volume_init_verbs,
16425 alc861vd_3stack_init_verbs,
16426 alc861vd_eapd_verbs,
16427 alc861vd_lenovo_unsol_verbs },
16428 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16429 .dac_nids = alc660vd_dac_nids,
16430 .dig_out_nid = ALC861VD_DIGOUT_NID,
16431 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16432 .channel_mode = alc861vd_3stack_2ch_modes,
16433 .input_mux = &alc861vd_capture_source,
16434 .unsol_event = alc861vd_lenovo_unsol_event,
16435 .setup = alc861vd_lenovo_setup,
16436 .init_hook = alc861vd_lenovo_init_hook,
16441 * BIOS auto configuration
16443 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16444 const struct auto_pin_cfg *cfg)
16446 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16450 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16451 hda_nid_t nid, int pin_type, int dac_idx)
16453 alc_set_pin_output(codec, nid, pin_type);
16456 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16458 struct alc_spec *spec = codec->spec;
16461 for (i = 0; i <= HDA_SIDE; i++) {
16462 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16463 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16465 alc861vd_auto_set_output_and_unmute(codec, nid,
16471 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16473 struct alc_spec *spec = codec->spec;
16476 pin = spec->autocfg.hp_pins[0];
16477 if (pin) /* connect to front and use dac 0 */
16478 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16479 pin = spec->autocfg.speaker_pins[0];
16481 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16484 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16486 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16488 struct alc_spec *spec = codec->spec;
16491 for (i = 0; i < AUTO_PIN_LAST; i++) {
16492 hda_nid_t nid = spec->autocfg.input_pins[i];
16493 if (alc_is_input_pin(codec, nid)) {
16494 alc_set_input_pin(codec, nid, i);
16495 if (nid != ALC861VD_PIN_CD_NID &&
16496 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16497 snd_hda_codec_write(codec, nid, 0,
16498 AC_VERB_SET_AMP_GAIN_MUTE,
16504 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16506 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16507 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16509 /* add playback controls from the parsed DAC table */
16510 /* Based on ALC880 version. But ALC861VD has separate,
16511 * different NIDs for mute/unmute switch and volume control */
16512 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16513 const struct auto_pin_cfg *cfg)
16515 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16516 hda_nid_t nid_v, nid_s;
16519 for (i = 0; i < cfg->line_outs; i++) {
16520 if (!spec->multiout.dac_nids[i])
16522 nid_v = alc861vd_idx_to_mixer_vol(
16524 spec->multiout.dac_nids[i]));
16525 nid_s = alc861vd_idx_to_mixer_switch(
16527 spec->multiout.dac_nids[i]));
16531 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16533 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16537 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16539 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16543 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16545 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16549 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16551 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16557 if (cfg->line_outs == 1 &&
16558 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16565 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16566 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16570 if (cfg->line_outs == 1 &&
16571 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16573 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16574 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16583 /* add playback controls for speaker and HP outputs */
16584 /* Based on ALC880 version. But ALC861VD has separate,
16585 * different NIDs for mute/unmute switch and volume control */
16586 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16587 hda_nid_t pin, const char *pfx)
16589 hda_nid_t nid_v, nid_s;
16595 if (alc880_is_fixed_pin(pin)) {
16596 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16597 /* specify the DAC as the extra output */
16598 if (!spec->multiout.hp_nid)
16599 spec->multiout.hp_nid = nid_v;
16601 spec->multiout.extra_out_nid[0] = nid_v;
16602 /* control HP volume/switch on the output mixer amp */
16603 nid_v = alc861vd_idx_to_mixer_vol(
16604 alc880_fixed_pin_idx(pin));
16605 nid_s = alc861vd_idx_to_mixer_switch(
16606 alc880_fixed_pin_idx(pin));
16608 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16609 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16612 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16613 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16616 } else if (alc880_is_multi_pin(pin)) {
16617 /* set manual connection */
16618 /* we have only a switch on HP-out PIN */
16619 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16620 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16627 /* parse the BIOS configuration and set up the alc_spec
16628 * return 1 if successful, 0 if the proper config is not found,
16629 * or a negative error code
16630 * Based on ALC880 version - had to change it to override
16631 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16632 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16634 struct alc_spec *spec = codec->spec;
16636 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16638 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16642 if (!spec->autocfg.line_outs)
16643 return 0; /* can't find valid BIOS pin config */
16645 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16648 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16651 err = alc861vd_auto_create_extra_out(spec,
16652 spec->autocfg.speaker_pins[0],
16656 err = alc861vd_auto_create_extra_out(spec,
16657 spec->autocfg.hp_pins[0],
16661 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16665 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16667 alc_auto_parse_digital(codec);
16669 if (spec->kctls.list)
16670 add_mixer(spec, spec->kctls.list);
16672 add_verb(spec, alc861vd_volume_init_verbs);
16674 spec->num_mux_defs = 1;
16675 spec->input_mux = &spec->private_imux[0];
16677 err = alc_auto_add_mic_boost(codec);
16681 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16686 /* additional initialization for auto-configuration model */
16687 static void alc861vd_auto_init(struct hda_codec *codec)
16689 struct alc_spec *spec = codec->spec;
16690 alc861vd_auto_init_multi_out(codec);
16691 alc861vd_auto_init_hp_out(codec);
16692 alc861vd_auto_init_analog_input(codec);
16693 alc861vd_auto_init_input_src(codec);
16694 alc_auto_init_digital(codec);
16695 if (spec->unsol_event)
16696 alc_inithook(codec);
16700 ALC660VD_FIX_ASUS_GPIO1
16704 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
16705 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16706 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16707 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16711 static const struct alc_fixup alc861vd_fixups[] = {
16712 [ALC660VD_FIX_ASUS_GPIO1] = {
16713 .verbs = alc660vd_fix_asus_gpio1_verbs,
16717 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16718 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16722 static int patch_alc861vd(struct hda_codec *codec)
16724 struct alc_spec *spec;
16725 int err, board_config;
16727 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16731 codec->spec = spec;
16733 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16737 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16738 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16740 board_config = ALC861VD_AUTO;
16743 if (board_config == ALC861VD_AUTO)
16744 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16746 if (board_config == ALC861VD_AUTO) {
16747 /* automatic parse from the BIOS config */
16748 err = alc861vd_parse_auto_config(codec);
16754 "hda_codec: Cannot set up configuration "
16755 "from BIOS. Using base mode...\n");
16756 board_config = ALC861VD_3ST;
16760 err = snd_hda_attach_beep_device(codec, 0x23);
16766 if (board_config != ALC861VD_AUTO)
16767 setup_preset(codec, &alc861vd_presets[board_config]);
16769 if (codec->vendor_id == 0x10ec0660) {
16770 /* always turn on EAPD */
16771 add_verb(spec, alc660vd_eapd_verbs);
16774 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16775 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16777 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16778 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16780 if (!spec->adc_nids) {
16781 spec->adc_nids = alc861vd_adc_nids;
16782 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16784 if (!spec->capsrc_nids)
16785 spec->capsrc_nids = alc861vd_capsrc_nids;
16787 set_capture_mixer(codec);
16788 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16790 spec->vmaster_nid = 0x02;
16792 if (board_config == ALC861VD_AUTO)
16793 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16795 codec->patch_ops = alc_patch_ops;
16797 if (board_config == ALC861VD_AUTO)
16798 spec->init_hook = alc861vd_auto_init;
16799 #ifdef CONFIG_SND_HDA_POWER_SAVE
16800 if (!spec->loopback.amplist)
16801 spec->loopback.amplist = alc861vd_loopbacks;
16810 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16811 * configuration. Each pin widget can choose any input DACs and a mixer.
16812 * Each ADC is connected from a mixer of all inputs. This makes possible
16813 * 6-channel independent captures.
16815 * In addition, an independent DAC for the multi-playback (not used in this
16818 #define ALC662_DIGOUT_NID 0x06
16819 #define ALC662_DIGIN_NID 0x0a
16821 static hda_nid_t alc662_dac_nids[4] = {
16822 /* front, rear, clfe, rear_surr */
16826 static hda_nid_t alc272_dac_nids[2] = {
16830 static hda_nid_t alc662_adc_nids[2] = {
16835 static hda_nid_t alc272_adc_nids[1] = {
16840 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16841 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16845 /* FIXME: should be a matrix-type input source selection */
16846 static struct hda_input_mux alc662_capture_source = {
16850 { "Front Mic", 0x1 },
16856 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16864 static struct hda_input_mux alc663_capture_source = {
16868 { "Front Mic", 0x1 },
16873 #if 0 /* set to 1 for testing other input sources below */
16874 static struct hda_input_mux alc272_nc10_capture_source = {
16877 { "Autoselect Mic", 0x0 },
16878 { "Internal Mic", 0x1 },
16879 { "In-0x02", 0x2 },
16880 { "In-0x03", 0x3 },
16881 { "In-0x04", 0x4 },
16882 { "In-0x05", 0x5 },
16883 { "In-0x06", 0x6 },
16884 { "In-0x07", 0x7 },
16885 { "In-0x08", 0x8 },
16886 { "In-0x09", 0x9 },
16887 { "In-0x0a", 0x0a },
16888 { "In-0x0b", 0x0b },
16889 { "In-0x0c", 0x0c },
16890 { "In-0x0d", 0x0d },
16891 { "In-0x0e", 0x0e },
16892 { "In-0x0f", 0x0f },
16900 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16907 static struct hda_verb alc662_3ST_ch2_init[] = {
16908 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16909 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16910 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16911 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16918 static struct hda_verb alc662_3ST_ch6_init[] = {
16919 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16920 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16921 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16922 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16923 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16924 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16928 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16929 { 2, alc662_3ST_ch2_init },
16930 { 6, alc662_3ST_ch6_init },
16936 static struct hda_verb alc662_sixstack_ch6_init[] = {
16937 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16938 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16939 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16946 static struct hda_verb alc662_sixstack_ch8_init[] = {
16947 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16948 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16949 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16953 static struct hda_channel_mode alc662_5stack_modes[2] = {
16954 { 2, alc662_sixstack_ch6_init },
16955 { 6, alc662_sixstack_ch8_init },
16958 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16959 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16962 static struct snd_kcontrol_new alc662_base_mixer[] = {
16963 /* output mixer control */
16964 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16965 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16966 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16967 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16968 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16969 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16970 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16971 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16974 /*Input mixer control */
16975 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16976 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16977 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16978 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16979 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16980 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16981 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16982 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16986 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16987 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16988 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16996 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17001 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17002 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17003 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17004 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17005 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17006 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17007 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17008 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17009 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17011 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17012 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17013 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17014 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17017 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17022 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17023 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17024 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17025 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17026 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17029 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17035 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17036 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17037 ALC262_HIPPO_MASTER_SWITCH,
17039 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17040 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17041 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17043 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17044 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17045 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17049 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17050 ALC262_HIPPO_MASTER_SWITCH,
17051 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17052 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17053 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17054 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17055 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17059 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17063 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17064 .ops = &snd_hda_bind_vol,
17066 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17067 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17072 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17073 .ops = &snd_hda_bind_sw,
17075 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17076 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17081 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17082 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17083 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17089 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17090 .ops = &snd_hda_bind_sw,
17092 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17093 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17094 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17099 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17100 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17101 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17104 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17105 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17110 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17111 .ops = &snd_hda_bind_sw,
17113 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17114 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17115 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17120 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17121 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17122 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17125 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17126 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17130 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17131 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17132 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17136 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17137 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17141 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17142 .ops = &snd_hda_bind_vol,
17144 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17145 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17150 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17151 .ops = &snd_hda_bind_sw,
17153 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17154 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17159 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17160 HDA_BIND_VOL("Master Playback Volume",
17161 &alc663_asus_two_bind_master_vol),
17162 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17163 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17170 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17171 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17172 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17173 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17175 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17176 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17180 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17181 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17182 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17183 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17184 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17189 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17190 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17194 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17195 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17196 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17199 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17201 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17202 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17203 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17204 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17208 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17209 .ops = &snd_hda_bind_sw,
17211 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17212 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17213 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17214 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17215 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17220 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17221 .ops = &snd_hda_bind_sw,
17223 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17224 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17229 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17230 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17231 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17232 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17233 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17234 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17235 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17236 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17242 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17243 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17244 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17245 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17246 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17247 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17254 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17256 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17257 .name = "Channel Mode",
17258 .info = alc_ch_mode_info,
17259 .get = alc_ch_mode_get,
17260 .put = alc_ch_mode_put,
17265 static struct hda_verb alc662_init_verbs[] = {
17266 /* ADC: mute amp left and right */
17267 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17268 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17271 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17272 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17275 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17277 /* Front Pin: output 0 (0x0c) */
17278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17279 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17281 /* Rear Pin: output 1 (0x0d) */
17282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17285 /* CLFE Pin: output 2 (0x0e) */
17286 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17287 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17289 /* Mic (rear) pin: input vref at 80% */
17290 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17292 /* Front Mic pin: input vref at 80% */
17293 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17295 /* Line In pin: input */
17296 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17298 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17299 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17300 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17301 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17302 /* CD pin widget for input */
17303 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17305 /* FIXME: use matrix-type input source selection */
17306 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17311 /* always trun on EAPD */
17312 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17313 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17318 static struct hda_verb alc663_init_verbs[] = {
17319 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17320 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17321 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17322 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17328 static struct hda_verb alc272_init_verbs[] = {
17329 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17330 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17331 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17332 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17333 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17334 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17335 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17340 static struct hda_verb alc662_sue_init_verbs[] = {
17341 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17342 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17346 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17347 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17348 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17352 /* Set Unsolicited Event*/
17353 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17355 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17359 static struct hda_verb alc663_m51va_init_verbs[] = {
17360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17362 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17363 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17364 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17367 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17368 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17372 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17373 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17374 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17375 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17378 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17379 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17383 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17384 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17386 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17387 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17390 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17391 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17395 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17402 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17406 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17407 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17408 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17409 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17410 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17411 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17412 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17413 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17416 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17417 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17418 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17422 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17423 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17424 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17425 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17426 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17432 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17433 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17438 static struct hda_verb alc663_g71v_init_verbs[] = {
17439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17440 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17441 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17443 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17444 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17445 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17447 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17448 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17449 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17453 static struct hda_verb alc663_g50v_init_verbs[] = {
17454 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17455 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17456 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17458 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17459 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17463 static struct hda_verb alc662_ecs_init_verbs[] = {
17464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17471 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17473 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17476 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17477 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17478 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17481 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17482 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17486 static struct hda_verb alc272_dell_init_verbs[] = {
17487 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17488 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17490 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17491 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17492 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17493 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17494 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17496 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17497 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17501 static struct hda_verb alc663_mode7_init_verbs[] = {
17502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17503 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17504 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17505 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17506 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17507 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17508 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17509 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17510 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17511 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17514 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17515 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17516 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17520 static struct hda_verb alc663_mode8_init_verbs[] = {
17521 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17525 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17526 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17527 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17529 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17530 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17531 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17534 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17535 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17536 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17540 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17541 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17542 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17546 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17547 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17548 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17552 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17554 unsigned int present;
17555 unsigned char bits;
17557 present = snd_hda_jack_detect(codec, 0x14);
17558 bits = present ? HDA_AMP_MUTE : 0;
17560 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17561 HDA_AMP_MUTE, bits);
17564 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17566 unsigned int present;
17567 unsigned char bits;
17569 present = snd_hda_jack_detect(codec, 0x1b);
17570 bits = present ? HDA_AMP_MUTE : 0;
17572 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17573 HDA_AMP_MUTE, bits);
17574 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17575 HDA_AMP_MUTE, bits);
17578 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17581 if ((res >> 26) == ALC880_HP_EVENT)
17582 alc662_lenovo_101e_all_automute(codec);
17583 if ((res >> 26) == ALC880_FRONT_EVENT)
17584 alc662_lenovo_101e_ispeaker_automute(codec);
17587 /* unsolicited event for HP jack sensing */
17588 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17591 if ((res >> 26) == ALC880_MIC_EVENT)
17592 alc_mic_automute(codec);
17594 alc262_hippo_unsol_event(codec, res);
17597 static void alc662_eeepc_setup(struct hda_codec *codec)
17599 struct alc_spec *spec = codec->spec;
17601 alc262_hippo1_setup(codec);
17602 spec->ext_mic.pin = 0x18;
17603 spec->ext_mic.mux_idx = 0;
17604 spec->int_mic.pin = 0x19;
17605 spec->int_mic.mux_idx = 1;
17606 spec->auto_mic = 1;
17609 static void alc662_eeepc_inithook(struct hda_codec *codec)
17611 alc262_hippo_automute(codec);
17612 alc_mic_automute(codec);
17615 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17617 struct alc_spec *spec = codec->spec;
17619 spec->autocfg.hp_pins[0] = 0x14;
17620 spec->autocfg.speaker_pins[0] = 0x1b;
17623 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17625 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17627 unsigned int present;
17628 unsigned char bits;
17630 present = snd_hda_jack_detect(codec, 0x21);
17631 bits = present ? HDA_AMP_MUTE : 0;
17632 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17633 HDA_AMP_MUTE, bits);
17634 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17635 HDA_AMP_MUTE, bits);
17638 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17640 unsigned int present;
17641 unsigned char bits;
17643 present = snd_hda_jack_detect(codec, 0x21);
17644 bits = present ? HDA_AMP_MUTE : 0;
17645 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17646 HDA_AMP_MUTE, bits);
17647 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17648 HDA_AMP_MUTE, bits);
17649 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17650 HDA_AMP_MUTE, bits);
17651 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17652 HDA_AMP_MUTE, bits);
17655 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17657 unsigned int present;
17658 unsigned char bits;
17660 present = snd_hda_jack_detect(codec, 0x15);
17661 bits = present ? HDA_AMP_MUTE : 0;
17662 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17663 HDA_AMP_MUTE, bits);
17664 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17665 HDA_AMP_MUTE, bits);
17666 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17667 HDA_AMP_MUTE, bits);
17668 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17669 HDA_AMP_MUTE, bits);
17672 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17674 unsigned int present;
17675 unsigned char bits;
17677 present = snd_hda_jack_detect(codec, 0x1b);
17678 bits = present ? 0 : PIN_OUT;
17679 snd_hda_codec_write(codec, 0x14, 0,
17680 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17683 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17685 unsigned int present1, present2;
17687 present1 = snd_hda_jack_detect(codec, 0x21);
17688 present2 = snd_hda_jack_detect(codec, 0x15);
17690 if (present1 || present2) {
17691 snd_hda_codec_write_cache(codec, 0x14, 0,
17692 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17694 snd_hda_codec_write_cache(codec, 0x14, 0,
17695 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17699 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17701 unsigned int present1, present2;
17703 present1 = snd_hda_jack_detect(codec, 0x1b);
17704 present2 = snd_hda_jack_detect(codec, 0x15);
17706 if (present1 || present2) {
17707 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17708 HDA_AMP_MUTE, HDA_AMP_MUTE);
17709 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17710 HDA_AMP_MUTE, HDA_AMP_MUTE);
17712 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17714 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17719 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17721 unsigned int present1, present2;
17723 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17724 AC_VERB_GET_PIN_SENSE, 0)
17725 & AC_PINSENSE_PRESENCE;
17726 present2 = snd_hda_codec_read(codec, 0x21, 0,
17727 AC_VERB_GET_PIN_SENSE, 0)
17728 & AC_PINSENSE_PRESENCE;
17730 if (present1 || present2) {
17731 snd_hda_codec_write_cache(codec, 0x14, 0,
17732 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17733 snd_hda_codec_write_cache(codec, 0x17, 0,
17734 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17736 snd_hda_codec_write_cache(codec, 0x14, 0,
17737 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17738 snd_hda_codec_write_cache(codec, 0x17, 0,
17739 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17743 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17745 unsigned int present1, present2;
17747 present1 = snd_hda_codec_read(codec, 0x21, 0,
17748 AC_VERB_GET_PIN_SENSE, 0)
17749 & AC_PINSENSE_PRESENCE;
17750 present2 = snd_hda_codec_read(codec, 0x15, 0,
17751 AC_VERB_GET_PIN_SENSE, 0)
17752 & AC_PINSENSE_PRESENCE;
17754 if (present1 || present2) {
17755 snd_hda_codec_write_cache(codec, 0x14, 0,
17756 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17757 snd_hda_codec_write_cache(codec, 0x17, 0,
17758 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17760 snd_hda_codec_write_cache(codec, 0x14, 0,
17761 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17762 snd_hda_codec_write_cache(codec, 0x17, 0,
17763 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17767 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17770 switch (res >> 26) {
17771 case ALC880_HP_EVENT:
17772 alc663_m51va_speaker_automute(codec);
17774 case ALC880_MIC_EVENT:
17775 alc_mic_automute(codec);
17780 static void alc663_m51va_setup(struct hda_codec *codec)
17782 struct alc_spec *spec = codec->spec;
17783 spec->ext_mic.pin = 0x18;
17784 spec->ext_mic.mux_idx = 0;
17785 spec->int_mic.pin = 0x12;
17786 spec->int_mic.mux_idx = 9;
17787 spec->auto_mic = 1;
17790 static void alc663_m51va_inithook(struct hda_codec *codec)
17792 alc663_m51va_speaker_automute(codec);
17793 alc_mic_automute(codec);
17796 /* ***************** Mode1 ******************************/
17797 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17799 static void alc663_mode1_setup(struct hda_codec *codec)
17801 struct alc_spec *spec = codec->spec;
17802 spec->ext_mic.pin = 0x18;
17803 spec->ext_mic.mux_idx = 0;
17804 spec->int_mic.pin = 0x19;
17805 spec->int_mic.mux_idx = 1;
17806 spec->auto_mic = 1;
17809 #define alc663_mode1_inithook alc663_m51va_inithook
17811 /* ***************** Mode2 ******************************/
17812 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17815 switch (res >> 26) {
17816 case ALC880_HP_EVENT:
17817 alc662_f5z_speaker_automute(codec);
17819 case ALC880_MIC_EVENT:
17820 alc_mic_automute(codec);
17825 #define alc662_mode2_setup alc663_mode1_setup
17827 static void alc662_mode2_inithook(struct hda_codec *codec)
17829 alc662_f5z_speaker_automute(codec);
17830 alc_mic_automute(codec);
17832 /* ***************** Mode3 ******************************/
17833 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17836 switch (res >> 26) {
17837 case ALC880_HP_EVENT:
17838 alc663_two_hp_m1_speaker_automute(codec);
17840 case ALC880_MIC_EVENT:
17841 alc_mic_automute(codec);
17846 #define alc663_mode3_setup alc663_mode1_setup
17848 static void alc663_mode3_inithook(struct hda_codec *codec)
17850 alc663_two_hp_m1_speaker_automute(codec);
17851 alc_mic_automute(codec);
17853 /* ***************** Mode4 ******************************/
17854 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17857 switch (res >> 26) {
17858 case ALC880_HP_EVENT:
17859 alc663_21jd_two_speaker_automute(codec);
17861 case ALC880_MIC_EVENT:
17862 alc_mic_automute(codec);
17867 #define alc663_mode4_setup alc663_mode1_setup
17869 static void alc663_mode4_inithook(struct hda_codec *codec)
17871 alc663_21jd_two_speaker_automute(codec);
17872 alc_mic_automute(codec);
17874 /* ***************** Mode5 ******************************/
17875 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17878 switch (res >> 26) {
17879 case ALC880_HP_EVENT:
17880 alc663_15jd_two_speaker_automute(codec);
17882 case ALC880_MIC_EVENT:
17883 alc_mic_automute(codec);
17888 #define alc663_mode5_setup alc663_mode1_setup
17890 static void alc663_mode5_inithook(struct hda_codec *codec)
17892 alc663_15jd_two_speaker_automute(codec);
17893 alc_mic_automute(codec);
17895 /* ***************** Mode6 ******************************/
17896 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17899 switch (res >> 26) {
17900 case ALC880_HP_EVENT:
17901 alc663_two_hp_m2_speaker_automute(codec);
17903 case ALC880_MIC_EVENT:
17904 alc_mic_automute(codec);
17909 #define alc663_mode6_setup alc663_mode1_setup
17911 static void alc663_mode6_inithook(struct hda_codec *codec)
17913 alc663_two_hp_m2_speaker_automute(codec);
17914 alc_mic_automute(codec);
17917 /* ***************** Mode7 ******************************/
17918 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17921 switch (res >> 26) {
17922 case ALC880_HP_EVENT:
17923 alc663_two_hp_m7_speaker_automute(codec);
17925 case ALC880_MIC_EVENT:
17926 alc_mic_automute(codec);
17931 #define alc663_mode7_setup alc663_mode1_setup
17933 static void alc663_mode7_inithook(struct hda_codec *codec)
17935 alc663_two_hp_m7_speaker_automute(codec);
17936 alc_mic_automute(codec);
17939 /* ***************** Mode8 ******************************/
17940 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17943 switch (res >> 26) {
17944 case ALC880_HP_EVENT:
17945 alc663_two_hp_m8_speaker_automute(codec);
17947 case ALC880_MIC_EVENT:
17948 alc_mic_automute(codec);
17953 #define alc663_mode8_setup alc663_m51va_setup
17955 static void alc663_mode8_inithook(struct hda_codec *codec)
17957 alc663_two_hp_m8_speaker_automute(codec);
17958 alc_mic_automute(codec);
17961 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17963 unsigned int present;
17964 unsigned char bits;
17966 present = snd_hda_jack_detect(codec, 0x21);
17967 bits = present ? HDA_AMP_MUTE : 0;
17968 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17969 HDA_AMP_MUTE, bits);
17970 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17971 HDA_AMP_MUTE, bits);
17974 static void alc663_g71v_front_automute(struct hda_codec *codec)
17976 unsigned int present;
17977 unsigned char bits;
17979 present = snd_hda_jack_detect(codec, 0x15);
17980 bits = present ? HDA_AMP_MUTE : 0;
17981 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17982 HDA_AMP_MUTE, bits);
17985 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17988 switch (res >> 26) {
17989 case ALC880_HP_EVENT:
17990 alc663_g71v_hp_automute(codec);
17992 case ALC880_FRONT_EVENT:
17993 alc663_g71v_front_automute(codec);
17995 case ALC880_MIC_EVENT:
17996 alc_mic_automute(codec);
18001 #define alc663_g71v_setup alc663_m51va_setup
18003 static void alc663_g71v_inithook(struct hda_codec *codec)
18005 alc663_g71v_front_automute(codec);
18006 alc663_g71v_hp_automute(codec);
18007 alc_mic_automute(codec);
18010 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18013 switch (res >> 26) {
18014 case ALC880_HP_EVENT:
18015 alc663_m51va_speaker_automute(codec);
18017 case ALC880_MIC_EVENT:
18018 alc_mic_automute(codec);
18023 #define alc663_g50v_setup alc663_m51va_setup
18025 static void alc663_g50v_inithook(struct hda_codec *codec)
18027 alc663_m51va_speaker_automute(codec);
18028 alc_mic_automute(codec);
18031 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18032 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18033 ALC262_HIPPO_MASTER_SWITCH,
18035 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18036 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18037 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18039 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18040 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18041 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18045 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18046 /* Master Playback automatically created from Speaker and Headphone */
18047 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18048 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18049 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18052 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18053 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18054 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18056 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18057 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18058 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18062 #ifdef CONFIG_SND_HDA_POWER_SAVE
18063 #define alc662_loopbacks alc880_loopbacks
18067 /* pcm configuration: identical with ALC880 */
18068 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18069 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18070 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18071 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18074 * configuration and preset
18076 static const char *alc662_models[ALC662_MODEL_LAST] = {
18077 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18078 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18079 [ALC662_3ST_6ch] = "3stack-6ch",
18080 [ALC662_5ST_DIG] = "6stack-dig",
18081 [ALC662_LENOVO_101E] = "lenovo-101e",
18082 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18083 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18084 [ALC662_ECS] = "ecs",
18085 [ALC663_ASUS_M51VA] = "m51va",
18086 [ALC663_ASUS_G71V] = "g71v",
18087 [ALC663_ASUS_H13] = "h13",
18088 [ALC663_ASUS_G50V] = "g50v",
18089 [ALC663_ASUS_MODE1] = "asus-mode1",
18090 [ALC662_ASUS_MODE2] = "asus-mode2",
18091 [ALC663_ASUS_MODE3] = "asus-mode3",
18092 [ALC663_ASUS_MODE4] = "asus-mode4",
18093 [ALC663_ASUS_MODE5] = "asus-mode5",
18094 [ALC663_ASUS_MODE6] = "asus-mode6",
18095 [ALC663_ASUS_MODE7] = "asus-mode7",
18096 [ALC663_ASUS_MODE8] = "asus-mode8",
18097 [ALC272_DELL] = "dell",
18098 [ALC272_DELL_ZM1] = "dell-zm1",
18099 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18100 [ALC662_AUTO] = "auto",
18103 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18104 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18105 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18106 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18107 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18108 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18109 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18110 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18111 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18112 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18113 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18114 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18115 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18116 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18117 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18118 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18119 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18120 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18121 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18122 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18123 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18124 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18125 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18126 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18127 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18128 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18129 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18130 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18131 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18132 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18133 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18134 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18135 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18136 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18137 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18138 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18139 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18140 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18141 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18142 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18143 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18144 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18145 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18146 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18147 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18148 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18149 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18150 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18151 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18152 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18153 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18154 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18155 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18156 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18157 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18158 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18159 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18160 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18161 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18162 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18163 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18164 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18165 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18166 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18167 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18168 ALC662_3ST_6ch_DIG),
18169 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18170 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18171 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18172 ALC662_3ST_6ch_DIG),
18173 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18174 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18175 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18176 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18177 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18178 ALC662_3ST_6ch_DIG),
18179 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18184 static struct alc_config_preset alc662_presets[] = {
18185 [ALC662_3ST_2ch_DIG] = {
18186 .mixers = { alc662_3ST_2ch_mixer },
18187 .init_verbs = { alc662_init_verbs },
18188 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18189 .dac_nids = alc662_dac_nids,
18190 .dig_out_nid = ALC662_DIGOUT_NID,
18191 .dig_in_nid = ALC662_DIGIN_NID,
18192 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18193 .channel_mode = alc662_3ST_2ch_modes,
18194 .input_mux = &alc662_capture_source,
18196 [ALC662_3ST_6ch_DIG] = {
18197 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18198 .init_verbs = { alc662_init_verbs },
18199 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18200 .dac_nids = alc662_dac_nids,
18201 .dig_out_nid = ALC662_DIGOUT_NID,
18202 .dig_in_nid = ALC662_DIGIN_NID,
18203 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18204 .channel_mode = alc662_3ST_6ch_modes,
18206 .input_mux = &alc662_capture_source,
18208 [ALC662_3ST_6ch] = {
18209 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18210 .init_verbs = { alc662_init_verbs },
18211 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18212 .dac_nids = alc662_dac_nids,
18213 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18214 .channel_mode = alc662_3ST_6ch_modes,
18216 .input_mux = &alc662_capture_source,
18218 [ALC662_5ST_DIG] = {
18219 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18220 .init_verbs = { alc662_init_verbs },
18221 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18222 .dac_nids = alc662_dac_nids,
18223 .dig_out_nid = ALC662_DIGOUT_NID,
18224 .dig_in_nid = ALC662_DIGIN_NID,
18225 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18226 .channel_mode = alc662_5stack_modes,
18227 .input_mux = &alc662_capture_source,
18229 [ALC662_LENOVO_101E] = {
18230 .mixers = { alc662_lenovo_101e_mixer },
18231 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18232 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18233 .dac_nids = alc662_dac_nids,
18234 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18235 .channel_mode = alc662_3ST_2ch_modes,
18236 .input_mux = &alc662_lenovo_101e_capture_source,
18237 .unsol_event = alc662_lenovo_101e_unsol_event,
18238 .init_hook = alc662_lenovo_101e_all_automute,
18240 [ALC662_ASUS_EEEPC_P701] = {
18241 .mixers = { alc662_eeepc_p701_mixer },
18242 .init_verbs = { alc662_init_verbs,
18243 alc662_eeepc_sue_init_verbs },
18244 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18245 .dac_nids = alc662_dac_nids,
18246 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18247 .channel_mode = alc662_3ST_2ch_modes,
18248 .unsol_event = alc662_eeepc_unsol_event,
18249 .setup = alc662_eeepc_setup,
18250 .init_hook = alc662_eeepc_inithook,
18252 [ALC662_ASUS_EEEPC_EP20] = {
18253 .mixers = { alc662_eeepc_ep20_mixer,
18254 alc662_chmode_mixer },
18255 .init_verbs = { alc662_init_verbs,
18256 alc662_eeepc_ep20_sue_init_verbs },
18257 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18258 .dac_nids = alc662_dac_nids,
18259 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18260 .channel_mode = alc662_3ST_6ch_modes,
18261 .input_mux = &alc662_lenovo_101e_capture_source,
18262 .unsol_event = alc662_eeepc_unsol_event,
18263 .setup = alc662_eeepc_ep20_setup,
18264 .init_hook = alc662_eeepc_ep20_inithook,
18267 .mixers = { alc662_ecs_mixer },
18268 .init_verbs = { alc662_init_verbs,
18269 alc662_ecs_init_verbs },
18270 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18271 .dac_nids = alc662_dac_nids,
18272 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18273 .channel_mode = alc662_3ST_2ch_modes,
18274 .unsol_event = alc662_eeepc_unsol_event,
18275 .setup = alc662_eeepc_setup,
18276 .init_hook = alc662_eeepc_inithook,
18278 [ALC663_ASUS_M51VA] = {
18279 .mixers = { alc663_m51va_mixer },
18280 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18281 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18282 .dac_nids = alc662_dac_nids,
18283 .dig_out_nid = ALC662_DIGOUT_NID,
18284 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18285 .channel_mode = alc662_3ST_2ch_modes,
18286 .unsol_event = alc663_m51va_unsol_event,
18287 .setup = alc663_m51va_setup,
18288 .init_hook = alc663_m51va_inithook,
18290 [ALC663_ASUS_G71V] = {
18291 .mixers = { alc663_g71v_mixer },
18292 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18293 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18294 .dac_nids = alc662_dac_nids,
18295 .dig_out_nid = ALC662_DIGOUT_NID,
18296 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18297 .channel_mode = alc662_3ST_2ch_modes,
18298 .unsol_event = alc663_g71v_unsol_event,
18299 .setup = alc663_g71v_setup,
18300 .init_hook = alc663_g71v_inithook,
18302 [ALC663_ASUS_H13] = {
18303 .mixers = { alc663_m51va_mixer },
18304 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18305 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18306 .dac_nids = alc662_dac_nids,
18307 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18308 .channel_mode = alc662_3ST_2ch_modes,
18309 .unsol_event = alc663_m51va_unsol_event,
18310 .init_hook = alc663_m51va_inithook,
18312 [ALC663_ASUS_G50V] = {
18313 .mixers = { alc663_g50v_mixer },
18314 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18315 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18316 .dac_nids = alc662_dac_nids,
18317 .dig_out_nid = ALC662_DIGOUT_NID,
18318 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18319 .channel_mode = alc662_3ST_6ch_modes,
18320 .input_mux = &alc663_capture_source,
18321 .unsol_event = alc663_g50v_unsol_event,
18322 .setup = alc663_g50v_setup,
18323 .init_hook = alc663_g50v_inithook,
18325 [ALC663_ASUS_MODE1] = {
18326 .mixers = { alc663_m51va_mixer },
18327 .cap_mixer = alc662_auto_capture_mixer,
18328 .init_verbs = { alc662_init_verbs,
18329 alc663_21jd_amic_init_verbs },
18330 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18332 .dac_nids = alc662_dac_nids,
18333 .dig_out_nid = ALC662_DIGOUT_NID,
18334 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18335 .channel_mode = alc662_3ST_2ch_modes,
18336 .unsol_event = alc663_mode1_unsol_event,
18337 .setup = alc663_mode1_setup,
18338 .init_hook = alc663_mode1_inithook,
18340 [ALC662_ASUS_MODE2] = {
18341 .mixers = { alc662_1bjd_mixer },
18342 .cap_mixer = alc662_auto_capture_mixer,
18343 .init_verbs = { alc662_init_verbs,
18344 alc662_1bjd_amic_init_verbs },
18345 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18346 .dac_nids = alc662_dac_nids,
18347 .dig_out_nid = ALC662_DIGOUT_NID,
18348 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18349 .channel_mode = alc662_3ST_2ch_modes,
18350 .unsol_event = alc662_mode2_unsol_event,
18351 .setup = alc662_mode2_setup,
18352 .init_hook = alc662_mode2_inithook,
18354 [ALC663_ASUS_MODE3] = {
18355 .mixers = { alc663_two_hp_m1_mixer },
18356 .cap_mixer = alc662_auto_capture_mixer,
18357 .init_verbs = { alc662_init_verbs,
18358 alc663_two_hp_amic_m1_init_verbs },
18359 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18361 .dac_nids = alc662_dac_nids,
18362 .dig_out_nid = ALC662_DIGOUT_NID,
18363 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18364 .channel_mode = alc662_3ST_2ch_modes,
18365 .unsol_event = alc663_mode3_unsol_event,
18366 .setup = alc663_mode3_setup,
18367 .init_hook = alc663_mode3_inithook,
18369 [ALC663_ASUS_MODE4] = {
18370 .mixers = { alc663_asus_21jd_clfe_mixer },
18371 .cap_mixer = alc662_auto_capture_mixer,
18372 .init_verbs = { alc662_init_verbs,
18373 alc663_21jd_amic_init_verbs},
18374 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18376 .dac_nids = alc662_dac_nids,
18377 .dig_out_nid = ALC662_DIGOUT_NID,
18378 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18379 .channel_mode = alc662_3ST_2ch_modes,
18380 .unsol_event = alc663_mode4_unsol_event,
18381 .setup = alc663_mode4_setup,
18382 .init_hook = alc663_mode4_inithook,
18384 [ALC663_ASUS_MODE5] = {
18385 .mixers = { alc663_asus_15jd_clfe_mixer },
18386 .cap_mixer = alc662_auto_capture_mixer,
18387 .init_verbs = { alc662_init_verbs,
18388 alc663_15jd_amic_init_verbs },
18389 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18391 .dac_nids = alc662_dac_nids,
18392 .dig_out_nid = ALC662_DIGOUT_NID,
18393 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18394 .channel_mode = alc662_3ST_2ch_modes,
18395 .unsol_event = alc663_mode5_unsol_event,
18396 .setup = alc663_mode5_setup,
18397 .init_hook = alc663_mode5_inithook,
18399 [ALC663_ASUS_MODE6] = {
18400 .mixers = { alc663_two_hp_m2_mixer },
18401 .cap_mixer = alc662_auto_capture_mixer,
18402 .init_verbs = { alc662_init_verbs,
18403 alc663_two_hp_amic_m2_init_verbs },
18404 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18406 .dac_nids = alc662_dac_nids,
18407 .dig_out_nid = ALC662_DIGOUT_NID,
18408 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18409 .channel_mode = alc662_3ST_2ch_modes,
18410 .unsol_event = alc663_mode6_unsol_event,
18411 .setup = alc663_mode6_setup,
18412 .init_hook = alc663_mode6_inithook,
18414 [ALC663_ASUS_MODE7] = {
18415 .mixers = { alc663_mode7_mixer },
18416 .cap_mixer = alc662_auto_capture_mixer,
18417 .init_verbs = { alc662_init_verbs,
18418 alc663_mode7_init_verbs },
18419 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18421 .dac_nids = alc662_dac_nids,
18422 .dig_out_nid = ALC662_DIGOUT_NID,
18423 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18424 .channel_mode = alc662_3ST_2ch_modes,
18425 .unsol_event = alc663_mode7_unsol_event,
18426 .setup = alc663_mode7_setup,
18427 .init_hook = alc663_mode7_inithook,
18429 [ALC663_ASUS_MODE8] = {
18430 .mixers = { alc663_mode8_mixer },
18431 .cap_mixer = alc662_auto_capture_mixer,
18432 .init_verbs = { alc662_init_verbs,
18433 alc663_mode8_init_verbs },
18434 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18436 .dac_nids = alc662_dac_nids,
18437 .dig_out_nid = ALC662_DIGOUT_NID,
18438 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18439 .channel_mode = alc662_3ST_2ch_modes,
18440 .unsol_event = alc663_mode8_unsol_event,
18441 .setup = alc663_mode8_setup,
18442 .init_hook = alc663_mode8_inithook,
18445 .mixers = { alc663_m51va_mixer },
18446 .cap_mixer = alc272_auto_capture_mixer,
18447 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18448 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18449 .dac_nids = alc662_dac_nids,
18450 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18451 .adc_nids = alc272_adc_nids,
18452 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18453 .capsrc_nids = alc272_capsrc_nids,
18454 .channel_mode = alc662_3ST_2ch_modes,
18455 .unsol_event = alc663_m51va_unsol_event,
18456 .setup = alc663_m51va_setup,
18457 .init_hook = alc663_m51va_inithook,
18459 [ALC272_DELL_ZM1] = {
18460 .mixers = { alc663_m51va_mixer },
18461 .cap_mixer = alc662_auto_capture_mixer,
18462 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18463 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18464 .dac_nids = alc662_dac_nids,
18465 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18466 .adc_nids = alc662_adc_nids,
18468 .capsrc_nids = alc662_capsrc_nids,
18469 .channel_mode = alc662_3ST_2ch_modes,
18470 .unsol_event = alc663_m51va_unsol_event,
18471 .setup = alc663_m51va_setup,
18472 .init_hook = alc663_m51va_inithook,
18474 [ALC272_SAMSUNG_NC10] = {
18475 .mixers = { alc272_nc10_mixer },
18476 .init_verbs = { alc662_init_verbs,
18477 alc663_21jd_amic_init_verbs },
18478 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18479 .dac_nids = alc272_dac_nids,
18480 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18481 .channel_mode = alc662_3ST_2ch_modes,
18482 /*.input_mux = &alc272_nc10_capture_source,*/
18483 .unsol_event = alc663_mode4_unsol_event,
18484 .setup = alc663_mode4_setup,
18485 .init_hook = alc663_mode4_inithook,
18491 * BIOS auto configuration
18494 /* convert from MIX nid to DAC */
18495 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18499 else if (nid >= 0x0c && nid <= 0x0e)
18500 return nid - 0x0c + 0x02;
18505 /* get MIX nid connected to the given pin targeted to DAC */
18506 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18512 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18513 for (i = 0; i < num; i++) {
18514 if (alc662_mix_to_dac(mix[i]) == dac)
18520 /* look for an empty DAC slot */
18521 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18523 struct alc_spec *spec = codec->spec;
18527 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18530 for (i = 0; i < num; i++) {
18531 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18534 for (j = 0; j < spec->multiout.num_dacs; j++)
18535 if (spec->multiout.dac_nids[j] == nid)
18537 if (j >= spec->multiout.num_dacs)
18543 /* fill in the dac_nids table from the parsed pin configuration */
18544 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18545 const struct auto_pin_cfg *cfg)
18547 struct alc_spec *spec = codec->spec;
18551 spec->multiout.dac_nids = spec->private_dac_nids;
18552 for (i = 0; i < cfg->line_outs; i++) {
18553 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18556 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18561 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18562 hda_nid_t nid, unsigned int chs)
18564 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18565 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18568 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18569 hda_nid_t nid, unsigned int chs)
18571 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18572 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18575 #define alc662_add_stereo_vol(spec, pfx, nid) \
18576 alc662_add_vol_ctl(spec, pfx, nid, 3)
18577 #define alc662_add_stereo_sw(spec, pfx, nid) \
18578 alc662_add_sw_ctl(spec, pfx, nid, 3)
18580 /* add playback controls from the parsed DAC table */
18581 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18582 const struct auto_pin_cfg *cfg)
18584 struct alc_spec *spec = codec->spec;
18585 static const char *chname[4] = {
18586 "Front", "Surround", NULL /*CLFE*/, "Side"
18588 hda_nid_t nid, mix;
18591 for (i = 0; i < cfg->line_outs; i++) {
18592 nid = spec->multiout.dac_nids[i];
18595 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18600 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18603 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18606 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18609 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18614 if (cfg->line_outs == 1 &&
18615 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18622 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18625 if (cfg->line_outs == 1 &&
18626 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18628 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18636 /* add playback controls for speaker and HP outputs */
18637 /* return DAC nid if any new DAC is assigned */
18638 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18641 struct alc_spec *spec = codec->spec;
18642 hda_nid_t nid, mix;
18647 nid = alc662_look_for_dac(codec, pin);
18649 /* the corresponding DAC is already occupied */
18650 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18651 return 0; /* no way */
18652 /* create a switch only */
18653 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18654 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18657 mix = alc662_dac_to_mix(codec, pin, nid);
18660 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18663 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18669 /* create playback/capture controls for input pins */
18670 #define alc662_auto_create_input_ctls \
18671 alc882_auto_create_input_ctls
18673 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18674 hda_nid_t nid, int pin_type,
18678 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18680 alc_set_pin_output(codec, nid, pin_type);
18681 /* need the manual connection? */
18682 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18685 for (i = 0; i < num; i++) {
18686 if (alc662_mix_to_dac(srcs[i]) != dac)
18688 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18693 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18695 struct alc_spec *spec = codec->spec;
18696 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18699 for (i = 0; i <= HDA_SIDE; i++) {
18700 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18702 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18703 spec->multiout.dac_nids[i]);
18707 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18709 struct alc_spec *spec = codec->spec;
18712 pin = spec->autocfg.hp_pins[0];
18714 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18715 spec->multiout.hp_nid);
18716 pin = spec->autocfg.speaker_pins[0];
18718 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18719 spec->multiout.extra_out_nid[0]);
18722 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18724 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18726 struct alc_spec *spec = codec->spec;
18729 for (i = 0; i < AUTO_PIN_LAST; i++) {
18730 hda_nid_t nid = spec->autocfg.input_pins[i];
18731 if (alc_is_input_pin(codec, nid)) {
18732 alc_set_input_pin(codec, nid, i);
18733 if (nid != ALC662_PIN_CD_NID &&
18734 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18735 snd_hda_codec_write(codec, nid, 0,
18736 AC_VERB_SET_AMP_GAIN_MUTE,
18742 #define alc662_auto_init_input_src alc882_auto_init_input_src
18744 static int alc662_parse_auto_config(struct hda_codec *codec)
18746 struct alc_spec *spec = codec->spec;
18748 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18750 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18754 if (!spec->autocfg.line_outs)
18755 return 0; /* can't find valid BIOS pin config */
18757 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18760 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18763 err = alc662_auto_create_extra_out(codec,
18764 spec->autocfg.speaker_pins[0],
18769 spec->multiout.extra_out_nid[0] = err;
18770 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18775 spec->multiout.hp_nid = err;
18776 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18780 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18782 alc_auto_parse_digital(codec);
18784 if (spec->kctls.list)
18785 add_mixer(spec, spec->kctls.list);
18787 spec->num_mux_defs = 1;
18788 spec->input_mux = &spec->private_imux[0];
18790 add_verb(spec, alc662_init_verbs);
18791 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18792 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18793 add_verb(spec, alc663_init_verbs);
18795 if (codec->vendor_id == 0x10ec0272)
18796 add_verb(spec, alc272_init_verbs);
18798 err = alc_auto_add_mic_boost(codec);
18802 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18803 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18804 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18806 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18811 /* additional initialization for auto-configuration model */
18812 static void alc662_auto_init(struct hda_codec *codec)
18814 struct alc_spec *spec = codec->spec;
18815 alc662_auto_init_multi_out(codec);
18816 alc662_auto_init_hp_out(codec);
18817 alc662_auto_init_analog_input(codec);
18818 alc662_auto_init_input_src(codec);
18819 alc_auto_init_digital(codec);
18820 if (spec->unsol_event)
18821 alc_inithook(codec);
18824 static int patch_alc662(struct hda_codec *codec)
18826 struct alc_spec *spec;
18827 int err, board_config;
18829 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18833 codec->spec = spec;
18835 alc_auto_parse_customize_define(codec);
18837 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18839 if (alc_read_coef_idx(codec, 0) == 0x8020)
18840 alc_codec_rename(codec, "ALC661");
18841 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18842 codec->bus->pci->subsystem_vendor == 0x1025 &&
18843 spec->cdefine.platform_type == 1)
18844 alc_codec_rename(codec, "ALC272X");
18846 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18849 if (board_config < 0) {
18850 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18852 board_config = ALC662_AUTO;
18855 if (board_config == ALC662_AUTO) {
18856 /* automatic parse from the BIOS config */
18857 err = alc662_parse_auto_config(codec);
18863 "hda_codec: Cannot set up configuration "
18864 "from BIOS. Using base mode...\n");
18865 board_config = ALC662_3ST_2ch_DIG;
18869 if (has_cdefine_beep(codec)) {
18870 err = snd_hda_attach_beep_device(codec, 0x1);
18877 if (board_config != ALC662_AUTO)
18878 setup_preset(codec, &alc662_presets[board_config]);
18880 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18881 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18883 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18884 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18886 if (!spec->adc_nids) {
18887 spec->adc_nids = alc662_adc_nids;
18888 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18890 if (!spec->capsrc_nids)
18891 spec->capsrc_nids = alc662_capsrc_nids;
18893 if (!spec->cap_mixer)
18894 set_capture_mixer(codec);
18896 if (has_cdefine_beep(codec)) {
18897 switch (codec->vendor_id) {
18899 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18904 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18907 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18911 spec->vmaster_nid = 0x02;
18913 codec->patch_ops = alc_patch_ops;
18914 if (board_config == ALC662_AUTO)
18915 spec->init_hook = alc662_auto_init;
18916 #ifdef CONFIG_SND_HDA_POWER_SAVE
18917 if (!spec->loopback.amplist)
18918 spec->loopback.amplist = alc662_loopbacks;
18924 static int patch_alc888(struct hda_codec *codec)
18926 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18927 kfree(codec->chip_name);
18928 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18929 if (!codec->chip_name) {
18933 return patch_alc662(codec);
18935 return patch_alc882(codec);
18941 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
18942 #define alc680_modes alc260_modes
18944 static hda_nid_t alc680_dac_nids[3] = {
18945 /* Lout1, Lout2, hp */
18949 static hda_nid_t alc680_adc_nids[3] = {
18951 /* DMIC, MIC, Line-in*/
18955 static struct snd_kcontrol_new alc680_base_mixer[] = {
18956 /* output mixer control */
18957 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
18958 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18959 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
18960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
18961 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
18965 static struct snd_kcontrol_new alc680_capture_mixer[] = {
18966 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
18967 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
18968 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
18969 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
18970 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
18971 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
18976 * generic initialization of ADC, input mixers and output mixers
18978 static struct hda_verb alc680_init_verbs[] = {
18979 /* Unmute DAC0-1 and set vol = 0 */
18980 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
18981 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
18982 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
18984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
18985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
18986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
18987 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
18988 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
18990 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18993 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
18998 /* create input playback/capture controls for the given pin */
18999 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19000 const char *ctlname, int idx)
19018 if (spec->multiout.dac_nids[0] != dac &&
19019 spec->multiout.dac_nids[1] != dac) {
19020 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19021 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19026 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19027 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19031 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19037 /* add playback controls from the parsed DAC table */
19038 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19039 const struct auto_pin_cfg *cfg)
19044 spec->multiout.dac_nids = spec->private_dac_nids;
19046 nid = cfg->line_out_pins[0];
19049 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19053 err = alc680_new_analog_output(spec, nid, name, 0);
19058 nid = cfg->speaker_pins[0];
19060 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19064 nid = cfg->hp_pins[0];
19066 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19074 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19075 hda_nid_t nid, int pin_type)
19077 alc_set_pin_output(codec, nid, pin_type);
19080 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19082 struct alc_spec *spec = codec->spec;
19083 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19085 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19086 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19090 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19092 struct alc_spec *spec = codec->spec;
19095 pin = spec->autocfg.hp_pins[0];
19097 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19098 pin = spec->autocfg.speaker_pins[0];
19100 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19103 /* pcm configuration: identical with ALC880 */
19104 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19105 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19106 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19107 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19109 static struct hda_input_mux alc680_capture_source = {
19117 * BIOS auto configuration
19119 static int alc680_parse_auto_config(struct hda_codec *codec)
19121 struct alc_spec *spec = codec->spec;
19123 static hda_nid_t alc680_ignore[] = { 0 };
19125 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19129 if (!spec->autocfg.line_outs) {
19130 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19131 spec->multiout.max_channels = 2;
19132 spec->no_analog = 1;
19135 return 0; /* can't find valid BIOS pin config */
19137 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19141 spec->multiout.max_channels = 2;
19144 /* digital only support output */
19145 alc_auto_parse_digital(codec);
19146 if (spec->kctls.list)
19147 add_mixer(spec, spec->kctls.list);
19149 add_verb(spec, alc680_init_verbs);
19150 spec->num_mux_defs = 1;
19151 spec->input_mux = &alc680_capture_source;
19153 err = alc_auto_add_mic_boost(codec);
19160 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19162 /* init callback for auto-configuration model -- overriding the default init */
19163 static void alc680_auto_init(struct hda_codec *codec)
19165 struct alc_spec *spec = codec->spec;
19166 alc680_auto_init_multi_out(codec);
19167 alc680_auto_init_hp_out(codec);
19168 alc680_auto_init_analog_input(codec);
19169 alc_auto_init_digital(codec);
19170 if (spec->unsol_event)
19171 alc_inithook(codec);
19175 * configuration and preset
19177 static const char *alc680_models[ALC680_MODEL_LAST] = {
19178 [ALC680_BASE] = "base",
19179 [ALC680_AUTO] = "auto",
19182 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19183 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19187 static struct alc_config_preset alc680_presets[] = {
19189 .mixers = { alc680_base_mixer },
19190 .cap_mixer = alc680_capture_mixer,
19191 .init_verbs = { alc680_init_verbs },
19192 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19193 .dac_nids = alc680_dac_nids,
19194 .num_adc_nids = ARRAY_SIZE(alc680_adc_nids),
19195 .adc_nids = alc680_adc_nids,
19197 .dig_out_nid = ALC680_DIGOUT_NID,
19198 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19199 .channel_mode = alc680_modes,
19200 .input_mux = &alc680_capture_source,
19204 static int patch_alc680(struct hda_codec *codec)
19206 struct alc_spec *spec;
19210 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19214 codec->spec = spec;
19216 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19220 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19221 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19223 board_config = ALC680_AUTO;
19226 if (board_config == ALC680_AUTO) {
19227 /* automatic parse from the BIOS config */
19228 err = alc680_parse_auto_config(codec);
19234 "hda_codec: Cannot set up configuration "
19235 "from BIOS. Using base mode...\n");
19236 board_config = ALC680_BASE;
19240 if (board_config != ALC680_AUTO)
19241 setup_preset(codec, &alc680_presets[board_config]);
19243 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19244 spec->stream_analog_capture = &alc680_pcm_analog_capture;
19245 spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture;
19246 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19248 if (!spec->adc_nids) {
19249 spec->adc_nids = alc680_adc_nids;
19250 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19253 if (!spec->cap_mixer)
19254 set_capture_mixer(codec);
19256 spec->vmaster_nid = 0x02;
19258 codec->patch_ops = alc_patch_ops;
19259 if (board_config == ALC680_AUTO)
19260 spec->init_hook = alc680_auto_init;
19268 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19269 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19270 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19271 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19272 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19273 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19274 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19275 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19276 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19277 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19278 .patch = patch_alc861 },
19279 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19280 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19281 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19282 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19283 .patch = patch_alc882 },
19284 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19285 .patch = patch_alc662 },
19286 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19287 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19288 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19289 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19290 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19291 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19292 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19293 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19294 .patch = patch_alc882 },
19295 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19296 .patch = patch_alc882 },
19297 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19298 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19299 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19300 .patch = patch_alc882 },
19301 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19302 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19303 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19304 {} /* terminator */
19307 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19309 MODULE_LICENSE("GPL");
19310 MODULE_DESCRIPTION("Realtek HD-audio codec");
19312 static struct hda_codec_preset_list realtek_list = {
19313 .preset = snd_hda_preset_realtek,
19314 .owner = THIS_MODULE,
19317 static int __init patch_realtek_init(void)
19319 return snd_hda_add_codec_preset(&realtek_list);
19322 static void __exit patch_realtek_exit(void)
19324 snd_hda_delete_codec_preset(&realtek_list);
19327 module_init(patch_realtek_init)
19328 module_exit(patch_realtek_exit)