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 */
142 ALC269_MODEL_LAST /* last tag */
159 /* ALC861-VD models */
181 ALC662_ASUS_EEEPC_P701,
182 ALC662_ASUS_EEEPC_EP20,
224 ALC883_TARGA_2ch_DIG,
225 ALC883_TARGA_8ch_DIG,
228 ALC888_ACER_ASPIRE_4930G,
229 ALC888_ACER_ASPIRE_6530G,
230 ALC888_ACER_ASPIRE_8930G,
231 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define {
288 unsigned int sku_cfg;
289 unsigned char port_connectivity;
290 unsigned char check_sum;
291 unsigned char customization;
292 unsigned char external_amp;
293 unsigned int enable_pcbeep:1;
294 unsigned int platform_type:1;
296 unsigned int override:1;
300 /* codec parameterization */
301 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
302 unsigned int num_mixers;
303 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
304 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
306 const struct hda_verb *init_verbs[10]; /* initialization verbs
310 unsigned int num_init_verbs;
312 char stream_name_analog[32]; /* analog PCM stream */
313 struct hda_pcm_stream *stream_analog_playback;
314 struct hda_pcm_stream *stream_analog_capture;
315 struct hda_pcm_stream *stream_analog_alt_playback;
316 struct hda_pcm_stream *stream_analog_alt_capture;
318 char stream_name_digital[32]; /* digital PCM stream */
319 struct hda_pcm_stream *stream_digital_playback;
320 struct hda_pcm_stream *stream_digital_capture;
323 struct hda_multi_out multiout; /* playback set-up
324 * max_channels, dacs must be set
325 * dig_out_nid and hp_nid are optional
327 hda_nid_t alt_dac_nid;
328 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
332 unsigned int num_adc_nids;
334 hda_nid_t *capsrc_nids;
335 hda_nid_t dig_in_nid; /* digital-in NID; optional */
337 /* capture setup for dynamic dual-adc switch */
338 unsigned int cur_adc_idx;
340 unsigned int cur_adc_stream_tag;
341 unsigned int cur_adc_format;
344 unsigned int num_mux_defs;
345 const struct hda_input_mux *input_mux;
346 unsigned int cur_mux[3];
347 struct alc_mic_route ext_mic;
348 struct alc_mic_route int_mic;
351 const struct hda_channel_mode *channel_mode;
352 int num_channel_mode;
354 int const_channel_count;
355 int ext_channel_count;
357 /* PCM information */
358 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
360 /* dynamic controls, init_verbs and input_mux */
361 struct auto_pin_cfg autocfg;
362 struct alc_customize_define cdefine;
363 struct snd_array kctls;
364 struct hda_input_mux private_imux[3];
365 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
366 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
367 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
370 void (*init_hook)(struct hda_codec *codec);
371 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
372 #ifdef CONFIG_SND_HDA_POWER_SAVE
373 void (*power_hook)(struct hda_codec *codec);
376 /* for pin sensing */
377 unsigned int sense_updated: 1;
378 unsigned int jack_present: 1;
379 unsigned int master_sw: 1;
380 unsigned int auto_mic:1;
383 unsigned int no_analog :1; /* digital I/O only */
384 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
387 /* for virtual master */
388 hda_nid_t vmaster_nid;
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 struct hda_loopback_check loopback;
395 unsigned int pll_coef_idx, pll_coef_bit;
399 * configuration template - to be copied to the spec instance
401 struct alc_config_preset {
402 struct snd_kcontrol_new *mixers[5]; /* should be identical size
405 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
406 const struct hda_verb *init_verbs[5];
407 unsigned int num_dacs;
409 hda_nid_t dig_out_nid; /* optional */
410 hda_nid_t hp_nid; /* optional */
411 hda_nid_t *slave_dig_outs;
412 unsigned int num_adc_nids;
414 hda_nid_t *capsrc_nids;
415 hda_nid_t dig_in_nid;
416 unsigned int num_channel_mode;
417 const struct hda_channel_mode *channel_mode;
419 int const_channel_count;
420 unsigned int num_mux_defs;
421 const struct hda_input_mux *input_mux;
422 void (*unsol_event)(struct hda_codec *, unsigned int);
423 void (*setup)(struct hda_codec *);
424 void (*init_hook)(struct hda_codec *);
425 #ifdef CONFIG_SND_HDA_POWER_SAVE
426 struct hda_amp_list *loopbacks;
427 void (*power_hook)(struct hda_codec *codec);
435 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_info *uinfo)
438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
439 struct alc_spec *spec = codec->spec;
440 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
441 if (mux_idx >= spec->num_mux_defs)
443 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
445 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
448 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_value *ucontrol)
451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
452 struct alc_spec *spec = codec->spec;
453 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
455 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
459 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 const struct hda_input_mux *imux;
465 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
466 unsigned int mux_idx;
467 hda_nid_t nid = spec->capsrc_nids ?
468 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
471 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
472 imux = &spec->input_mux[mux_idx];
473 if (!imux->num_items && mux_idx > 0)
474 imux = &spec->input_mux[0];
476 type = get_wcaps_type(get_wcaps(codec, nid));
477 if (type == AC_WID_AUD_MIX) {
478 /* Matrix-mixer style (e.g. ALC882) */
479 unsigned int *cur_val = &spec->cur_mux[adc_idx];
482 idx = ucontrol->value.enumerated.item[0];
483 if (idx >= imux->num_items)
484 idx = imux->num_items - 1;
487 for (i = 0; i < imux->num_items; i++) {
488 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
489 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
490 imux->items[i].index,
496 /* MUX style (e.g. ALC880) */
497 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
498 &spec->cur_mux[adc_idx]);
503 * channel mode setting
505 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
506 struct snd_ctl_elem_info *uinfo)
508 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
509 struct alc_spec *spec = codec->spec;
510 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
511 spec->num_channel_mode);
514 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_value *ucontrol)
517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
518 struct alc_spec *spec = codec->spec;
519 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
520 spec->num_channel_mode,
521 spec->ext_channel_count);
524 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
525 struct snd_ctl_elem_value *ucontrol)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 struct alc_spec *spec = codec->spec;
529 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
530 spec->num_channel_mode,
531 &spec->ext_channel_count);
532 if (err >= 0 && !spec->const_channel_count) {
533 spec->multiout.max_channels = spec->ext_channel_count;
534 if (spec->need_dac_fix)
535 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
541 * Control the mode of pin widget settings via the mixer. "pc" is used
542 * instead of "%" to avoid consequences of accidently treating the % as
543 * being part of a format specifier. Maximum allowed length of a value is
544 * 63 characters plus NULL terminator.
546 * Note: some retasking pin complexes seem to ignore requests for input
547 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
548 * are requested. Therefore order this list so that this behaviour will not
549 * cause problems when mixer clients move through the enum sequentially.
550 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
553 static char *alc_pin_mode_names[] = {
554 "Mic 50pc bias", "Mic 80pc bias",
555 "Line in", "Line out", "Headphone out",
557 static unsigned char alc_pin_mode_values[] = {
558 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
560 /* The control can present all 5 options, or it can limit the options based
561 * in the pin being assumed to be exclusively an input or an output pin. In
562 * addition, "input" pins may or may not process the mic bias option
563 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
564 * accept requests for bias as of chip versions up to March 2006) and/or
565 * wiring in the computer.
567 #define ALC_PIN_DIR_IN 0x00
568 #define ALC_PIN_DIR_OUT 0x01
569 #define ALC_PIN_DIR_INOUT 0x02
570 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
571 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
573 /* Info about the pin modes supported by the different pin direction modes.
574 * For each direction the minimum and maximum values are given.
576 static signed char alc_pin_mode_dir_info[5][2] = {
577 { 0, 2 }, /* ALC_PIN_DIR_IN */
578 { 3, 4 }, /* ALC_PIN_DIR_OUT */
579 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
580 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
581 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
583 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
584 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
585 #define alc_pin_mode_n_items(_dir) \
586 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
588 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
589 struct snd_ctl_elem_info *uinfo)
591 unsigned int item_num = uinfo->value.enumerated.item;
592 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
596 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
598 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
599 item_num = alc_pin_mode_min(dir);
600 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
604 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
605 struct snd_ctl_elem_value *ucontrol)
608 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
609 hda_nid_t nid = kcontrol->private_value & 0xffff;
610 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
611 long *valp = ucontrol->value.integer.value;
612 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
613 AC_VERB_GET_PIN_WIDGET_CONTROL,
616 /* Find enumerated value for current pinctl setting */
617 i = alc_pin_mode_min(dir);
618 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
620 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
624 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
625 struct snd_ctl_elem_value *ucontrol)
628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
629 hda_nid_t nid = kcontrol->private_value & 0xffff;
630 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
631 long val = *ucontrol->value.integer.value;
632 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
633 AC_VERB_GET_PIN_WIDGET_CONTROL,
636 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
637 val = alc_pin_mode_min(dir);
639 change = pinctl != alc_pin_mode_values[val];
641 /* Set pin mode to that requested */
642 snd_hda_codec_write_cache(codec, nid, 0,
643 AC_VERB_SET_PIN_WIDGET_CONTROL,
644 alc_pin_mode_values[val]);
646 /* Also enable the retasking pin's input/output as required
647 * for the requested pin mode. Enum values of 2 or less are
650 * Dynamically switching the input/output buffers probably
651 * reduces noise slightly (particularly on input) so we'll
652 * do it. However, having both input and output buffers
653 * enabled simultaneously doesn't seem to be problematic if
654 * this turns out to be necessary in the future.
657 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
658 HDA_AMP_MUTE, HDA_AMP_MUTE);
659 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
662 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
663 HDA_AMP_MUTE, HDA_AMP_MUTE);
664 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
671 #define ALC_PIN_MODE(xname, nid, dir) \
672 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
673 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
674 .info = alc_pin_mode_info, \
675 .get = alc_pin_mode_get, \
676 .put = alc_pin_mode_put, \
677 .private_value = nid | (dir<<16) }
679 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
680 * together using a mask with more than one bit set. This control is
681 * currently used only by the ALC260 test model. At this stage they are not
682 * needed for any "production" models.
684 #ifdef CONFIG_SND_DEBUG
685 #define alc_gpio_data_info snd_ctl_boolean_mono_info
687 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
688 struct snd_ctl_elem_value *ucontrol)
690 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
691 hda_nid_t nid = kcontrol->private_value & 0xffff;
692 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
693 long *valp = ucontrol->value.integer.value;
694 unsigned int val = snd_hda_codec_read(codec, nid, 0,
695 AC_VERB_GET_GPIO_DATA, 0x00);
697 *valp = (val & mask) != 0;
700 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
701 struct snd_ctl_elem_value *ucontrol)
704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
705 hda_nid_t nid = kcontrol->private_value & 0xffff;
706 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
707 long val = *ucontrol->value.integer.value;
708 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
709 AC_VERB_GET_GPIO_DATA,
712 /* Set/unset the masked GPIO bit(s) as needed */
713 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
718 snd_hda_codec_write_cache(codec, nid, 0,
719 AC_VERB_SET_GPIO_DATA, gpio_data);
723 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
724 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
725 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
726 .info = alc_gpio_data_info, \
727 .get = alc_gpio_data_get, \
728 .put = alc_gpio_data_put, \
729 .private_value = nid | (mask<<16) }
730 #endif /* CONFIG_SND_DEBUG */
732 /* A switch control to allow the enabling of the digital IO pins on the
733 * ALC260. This is incredibly simplistic; the intention of this control is
734 * to provide something in the test model allowing digital outputs to be
735 * identified if present. If models are found which can utilise these
736 * outputs a more complete mixer control can be devised for those models if
739 #ifdef CONFIG_SND_DEBUG
740 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
742 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
743 struct snd_ctl_elem_value *ucontrol)
745 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
746 hda_nid_t nid = kcontrol->private_value & 0xffff;
747 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
748 long *valp = ucontrol->value.integer.value;
749 unsigned int val = snd_hda_codec_read(codec, nid, 0,
750 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
752 *valp = (val & mask) != 0;
755 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
756 struct snd_ctl_elem_value *ucontrol)
759 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
760 hda_nid_t nid = kcontrol->private_value & 0xffff;
761 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
762 long val = *ucontrol->value.integer.value;
763 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
764 AC_VERB_GET_DIGI_CONVERT_1,
767 /* Set/unset the masked control bit(s) as needed */
768 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
773 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
778 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
779 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
780 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
781 .info = alc_spdif_ctrl_info, \
782 .get = alc_spdif_ctrl_get, \
783 .put = alc_spdif_ctrl_put, \
784 .private_value = nid | (mask<<16) }
785 #endif /* CONFIG_SND_DEBUG */
787 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
788 * Again, this is only used in the ALC26x test models to help identify when
789 * the EAPD line must be asserted for features to work.
791 #ifdef CONFIG_SND_DEBUG
792 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
794 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
795 struct snd_ctl_elem_value *ucontrol)
797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
798 hda_nid_t nid = kcontrol->private_value & 0xffff;
799 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
800 long *valp = ucontrol->value.integer.value;
801 unsigned int val = snd_hda_codec_read(codec, nid, 0,
802 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
804 *valp = (val & mask) != 0;
808 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
809 struct snd_ctl_elem_value *ucontrol)
812 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
813 hda_nid_t nid = kcontrol->private_value & 0xffff;
814 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
815 long val = *ucontrol->value.integer.value;
816 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
817 AC_VERB_GET_EAPD_BTLENABLE,
820 /* Set/unset the masked control bit(s) as needed */
821 change = (!val ? 0 : mask) != (ctrl_data & mask);
826 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
832 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
833 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
834 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
835 .info = alc_eapd_ctrl_info, \
836 .get = alc_eapd_ctrl_get, \
837 .put = alc_eapd_ctrl_put, \
838 .private_value = nid | (mask<<16) }
839 #endif /* CONFIG_SND_DEBUG */
842 * set up the input pin config (depending on the given auto-pin type)
844 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
847 unsigned int val = PIN_IN;
849 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
852 oldval = snd_hda_codec_read(codec, nid, 0,
853 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
854 pincap = snd_hda_query_pin_caps(codec, nid);
855 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
856 /* if the default pin setup is vref50, we give it priority */
857 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
859 else if (pincap & AC_PINCAP_VREF_50)
861 else if (pincap & AC_PINCAP_VREF_100)
863 else if (pincap & AC_PINCAP_VREF_GRD)
866 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
871 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
873 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
875 spec->mixers[spec->num_mixers++] = mix;
878 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
880 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
882 spec->init_verbs[spec->num_init_verbs++] = verb;
886 * set up from the preset table
888 static void setup_preset(struct hda_codec *codec,
889 const struct alc_config_preset *preset)
891 struct alc_spec *spec = codec->spec;
894 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
895 add_mixer(spec, preset->mixers[i]);
896 spec->cap_mixer = preset->cap_mixer;
897 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
899 add_verb(spec, preset->init_verbs[i]);
901 spec->channel_mode = preset->channel_mode;
902 spec->num_channel_mode = preset->num_channel_mode;
903 spec->need_dac_fix = preset->need_dac_fix;
904 spec->const_channel_count = preset->const_channel_count;
906 if (preset->const_channel_count)
907 spec->multiout.max_channels = preset->const_channel_count;
909 spec->multiout.max_channels = spec->channel_mode[0].channels;
910 spec->ext_channel_count = spec->channel_mode[0].channels;
912 spec->multiout.num_dacs = preset->num_dacs;
913 spec->multiout.dac_nids = preset->dac_nids;
914 spec->multiout.dig_out_nid = preset->dig_out_nid;
915 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
916 spec->multiout.hp_nid = preset->hp_nid;
918 spec->num_mux_defs = preset->num_mux_defs;
919 if (!spec->num_mux_defs)
920 spec->num_mux_defs = 1;
921 spec->input_mux = preset->input_mux;
923 spec->num_adc_nids = preset->num_adc_nids;
924 spec->adc_nids = preset->adc_nids;
925 spec->capsrc_nids = preset->capsrc_nids;
926 spec->dig_in_nid = preset->dig_in_nid;
928 spec->unsol_event = preset->unsol_event;
929 spec->init_hook = preset->init_hook;
930 #ifdef CONFIG_SND_HDA_POWER_SAVE
931 spec->power_hook = preset->power_hook;
932 spec->loopback.amplist = preset->loopbacks;
936 preset->setup(codec);
939 /* Enable GPIO mask and set output */
940 static struct hda_verb alc_gpio1_init_verbs[] = {
941 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
942 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
943 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
947 static struct hda_verb alc_gpio2_init_verbs[] = {
948 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
949 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
950 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
954 static struct hda_verb alc_gpio3_init_verbs[] = {
955 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
956 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
957 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
962 * Fix hardware PLL issue
963 * On some codecs, the analog PLL gating control must be off while
964 * the default value is 1.
966 static void alc_fix_pll(struct hda_codec *codec)
968 struct alc_spec *spec = codec->spec;
973 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
975 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
976 AC_VERB_GET_PROC_COEF, 0);
977 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
979 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
980 val & ~(1 << spec->pll_coef_bit));
983 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
984 unsigned int coef_idx, unsigned int coef_bit)
986 struct alc_spec *spec = codec->spec;
988 spec->pll_coef_idx = coef_idx;
989 spec->pll_coef_bit = coef_bit;
993 static void alc_automute_pin(struct hda_codec *codec)
995 struct alc_spec *spec = codec->spec;
996 unsigned int nid = spec->autocfg.hp_pins[0];
1001 spec->jack_present = snd_hda_jack_detect(codec, nid);
1002 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1003 nid = spec->autocfg.speaker_pins[i];
1006 snd_hda_codec_write(codec, nid, 0,
1007 AC_VERB_SET_PIN_WIDGET_CONTROL,
1008 spec->jack_present ? 0 : PIN_OUT);
1012 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1015 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1018 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1019 for (i = 0; i < nums; i++)
1025 /* switch the current ADC according to the jack state */
1026 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1028 struct alc_spec *spec = codec->spec;
1029 unsigned int present;
1032 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1034 spec->cur_adc_idx = 1;
1036 spec->cur_adc_idx = 0;
1037 new_adc = spec->adc_nids[spec->cur_adc_idx];
1038 if (spec->cur_adc && spec->cur_adc != new_adc) {
1039 /* stream is running, let's swap the current ADC */
1040 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1041 spec->cur_adc = new_adc;
1042 snd_hda_codec_setup_stream(codec, new_adc,
1043 spec->cur_adc_stream_tag, 0,
1044 spec->cur_adc_format);
1048 static void alc_mic_automute(struct hda_codec *codec)
1050 struct alc_spec *spec = codec->spec;
1051 struct alc_mic_route *dead, *alive;
1052 unsigned int present, type;
1055 if (!spec->auto_mic)
1057 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1059 if (snd_BUG_ON(!spec->adc_nids))
1062 if (spec->dual_adc_switch) {
1063 alc_dual_mic_adc_auto_switch(codec);
1067 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1069 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1071 alive = &spec->ext_mic;
1072 dead = &spec->int_mic;
1074 alive = &spec->int_mic;
1075 dead = &spec->ext_mic;
1078 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1079 if (type == AC_WID_AUD_MIX) {
1080 /* Matrix-mixer style (e.g. ALC882) */
1081 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1084 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1086 HDA_AMP_MUTE, HDA_AMP_MUTE);
1088 /* MUX style (e.g. ALC880) */
1089 snd_hda_codec_write_cache(codec, cap_nid, 0,
1090 AC_VERB_SET_CONNECT_SEL,
1094 /* FIXME: analog mixer */
1097 /* unsolicited event for HP jack sensing */
1098 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1100 if (codec->vendor_id == 0x10ec0880)
1105 case ALC880_HP_EVENT:
1106 alc_automute_pin(codec);
1108 case ALC880_MIC_EVENT:
1109 alc_mic_automute(codec);
1114 static void alc_inithook(struct hda_codec *codec)
1116 alc_automute_pin(codec);
1117 alc_mic_automute(codec);
1120 /* additional initialization for ALC888 variants */
1121 static void alc888_coef_init(struct hda_codec *codec)
1125 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1126 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1127 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1128 if ((tmp & 0xf0) == 0x20)
1130 snd_hda_codec_read(codec, 0x20, 0,
1131 AC_VERB_SET_PROC_COEF, 0x830);
1134 snd_hda_codec_read(codec, 0x20, 0,
1135 AC_VERB_SET_PROC_COEF, 0x3030);
1138 static void alc889_coef_init(struct hda_codec *codec)
1142 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1143 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1144 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1145 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1148 /* turn on/off EAPD control (only if available) */
1149 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1151 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1153 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1158 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1163 case ALC_INIT_GPIO1:
1164 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1166 case ALC_INIT_GPIO2:
1167 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1169 case ALC_INIT_GPIO3:
1170 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1172 case ALC_INIT_DEFAULT:
1173 switch (codec->vendor_id) {
1175 set_eapd(codec, 0x0f, 1);
1176 set_eapd(codec, 0x10, 1);
1189 set_eapd(codec, 0x14, 1);
1190 set_eapd(codec, 0x15, 1);
1193 switch (codec->vendor_id) {
1195 snd_hda_codec_write(codec, 0x1a, 0,
1196 AC_VERB_SET_COEF_INDEX, 7);
1197 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1198 AC_VERB_GET_PROC_COEF, 0);
1199 snd_hda_codec_write(codec, 0x1a, 0,
1200 AC_VERB_SET_COEF_INDEX, 7);
1201 snd_hda_codec_write(codec, 0x1a, 0,
1202 AC_VERB_SET_PROC_COEF,
1212 alc889_coef_init(codec);
1215 alc888_coef_init(codec);
1217 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1220 snd_hda_codec_write(codec, 0x20, 0,
1221 AC_VERB_SET_COEF_INDEX, 7);
1222 tmp = snd_hda_codec_read(codec, 0x20, 0,
1223 AC_VERB_GET_PROC_COEF, 0);
1224 snd_hda_codec_write(codec, 0x20, 0,
1225 AC_VERB_SET_COEF_INDEX, 7);
1226 snd_hda_codec_write(codec, 0x20, 0,
1227 AC_VERB_SET_PROC_COEF,
1236 static void alc_init_auto_hp(struct hda_codec *codec)
1238 struct alc_spec *spec = codec->spec;
1240 if (!spec->autocfg.hp_pins[0])
1243 if (!spec->autocfg.speaker_pins[0]) {
1244 if (spec->autocfg.line_out_pins[0] &&
1245 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1246 spec->autocfg.speaker_pins[0] =
1247 spec->autocfg.line_out_pins[0];
1252 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1253 spec->autocfg.hp_pins[0]);
1254 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1255 AC_VERB_SET_UNSOLICITED_ENABLE,
1256 AC_USRSP_EN | ALC880_HP_EVENT);
1257 spec->unsol_event = alc_sku_unsol_event;
1260 static void alc_init_auto_mic(struct hda_codec *codec)
1262 struct alc_spec *spec = codec->spec;
1263 struct auto_pin_cfg *cfg = &spec->autocfg;
1264 hda_nid_t fixed, ext;
1267 /* there must be only two mic inputs exclusively */
1268 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1269 if (cfg->input_pins[i])
1273 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1274 hda_nid_t nid = cfg->input_pins[i];
1275 unsigned int defcfg;
1278 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1279 switch (get_defcfg_connect(defcfg)) {
1280 case AC_JACK_PORT_FIXED:
1282 return; /* already occupied */
1285 case AC_JACK_PORT_COMPLEX:
1287 return; /* already occupied */
1291 return; /* invalid entry */
1296 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1297 return; /* no unsol support */
1298 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1300 spec->ext_mic.pin = ext;
1301 spec->int_mic.pin = fixed;
1302 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1303 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1305 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1306 AC_VERB_SET_UNSOLICITED_ENABLE,
1307 AC_USRSP_EN | ALC880_MIC_EVENT);
1308 spec->unsol_event = alc_sku_unsol_event;
1311 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1313 unsigned int ass, tmp, i;
1315 struct alc_spec *spec = codec->spec;
1317 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1319 ass = codec->subsystem_id & 0xffff;
1320 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1324 if (codec->vendor_id == 0x10ec0260)
1326 ass = snd_hda_codec_get_pincfg(codec, nid);
1329 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1330 codec->chip_name, ass);
1336 for (i = 1; i < 16; i++) {
1340 if (((ass >> 16) & 0xf) != tmp)
1343 spec->cdefine.port_connectivity = ass >> 30;
1344 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1345 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1346 spec->cdefine.customization = ass >> 8;
1348 spec->cdefine.sku_cfg = ass;
1349 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1350 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1351 spec->cdefine.swap = (ass & 0x2) >> 1;
1352 spec->cdefine.override = ass & 0x1;
1354 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1355 nid, spec->cdefine.sku_cfg);
1356 snd_printd("SKU: port_connectivity=0x%x\n",
1357 spec->cdefine.port_connectivity);
1358 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1359 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1360 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1361 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1362 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1363 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1364 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1369 /* check subsystem ID and set up device-specific initialization;
1370 * return 1 if initialized, 0 if invalid SSID
1372 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1373 * 31 ~ 16 : Manufacture ID
1375 * 7 ~ 0 : Assembly ID
1376 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1378 static int alc_subsystem_id(struct hda_codec *codec,
1379 hda_nid_t porta, hda_nid_t porte,
1380 hda_nid_t portd, hda_nid_t porti)
1382 unsigned int ass, tmp, i;
1384 struct alc_spec *spec = codec->spec;
1386 ass = codec->subsystem_id & 0xffff;
1387 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1390 /* invalid SSID, check the special NID pin defcfg instead */
1392 * 31~30 : port connectivity
1395 * 19~16 : Check sum (15:1)
1400 if (codec->vendor_id == 0x10ec0260)
1402 ass = snd_hda_codec_get_pincfg(codec, nid);
1403 snd_printd("realtek: No valid SSID, "
1404 "checking pincfg 0x%08x for NID 0x%x\n",
1408 if ((ass >> 30) != 1) /* no physical connection */
1413 for (i = 1; i < 16; i++) {
1417 if (((ass >> 16) & 0xf) != tmp)
1420 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1421 ass & 0xffff, codec->vendor_id);
1425 * 2 : 0 --> Desktop, 1 --> Laptop
1426 * 3~5 : External Amplifier control
1429 tmp = (ass & 0x38) >> 3; /* external Amp control */
1432 spec->init_amp = ALC_INIT_GPIO1;
1435 spec->init_amp = ALC_INIT_GPIO2;
1438 spec->init_amp = ALC_INIT_GPIO3;
1441 spec->init_amp = ALC_INIT_DEFAULT;
1445 /* is laptop or Desktop and enable the function "Mute internal speaker
1446 * when the external headphone out jack is plugged"
1448 if (!(ass & 0x8000))
1451 * 10~8 : Jack location
1452 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1454 * 15 : 1 --> enable the function "Mute internal speaker
1455 * when the external headphone out jack is plugged"
1457 if (!spec->autocfg.hp_pins[0]) {
1459 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1470 for (i = 0; i < spec->autocfg.line_outs; i++)
1471 if (spec->autocfg.line_out_pins[i] == nid)
1473 spec->autocfg.hp_pins[0] = nid;
1476 alc_init_auto_hp(codec);
1477 alc_init_auto_mic(codec);
1481 static void alc_ssid_check(struct hda_codec *codec,
1482 hda_nid_t porta, hda_nid_t porte,
1483 hda_nid_t portd, hda_nid_t porti)
1485 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1486 struct alc_spec *spec = codec->spec;
1487 snd_printd("realtek: "
1488 "Enable default setup for auto mode as fallback\n");
1489 spec->init_amp = ALC_INIT_DEFAULT;
1490 alc_init_auto_hp(codec);
1491 alc_init_auto_mic(codec);
1496 * Fix-up pin default configurations and add default verbs
1505 const struct alc_pincfg *pins;
1506 const struct hda_verb *verbs;
1509 static void alc_pick_fixup(struct hda_codec *codec,
1510 const struct snd_pci_quirk *quirk,
1511 const struct alc_fixup *fix,
1514 const struct alc_pincfg *cfg;
1516 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1519 fix += quirk->value;
1521 if (pre_init && cfg) {
1522 #ifdef CONFIG_SND_DEBUG_VERBOSE
1523 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1524 codec->chip_name, quirk->name);
1526 for (; cfg->nid; cfg++)
1527 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1529 if (!pre_init && fix->verbs) {
1530 #ifdef CONFIG_SND_DEBUG_VERBOSE
1531 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1532 codec->chip_name, quirk->name);
1534 add_verb(codec->spec, fix->verbs);
1538 static int alc_read_coef_idx(struct hda_codec *codec,
1539 unsigned int coef_idx)
1542 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1544 val = snd_hda_codec_read(codec, 0x20, 0,
1545 AC_VERB_GET_PROC_COEF, 0);
1549 /* set right pin controls for digital I/O */
1550 static void alc_auto_init_digital(struct hda_codec *codec)
1552 struct alc_spec *spec = codec->spec;
1556 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1557 pin = spec->autocfg.dig_out_pins[i];
1559 snd_hda_codec_write(codec, pin, 0,
1560 AC_VERB_SET_PIN_WIDGET_CONTROL,
1564 pin = spec->autocfg.dig_in_pin;
1566 snd_hda_codec_write(codec, pin, 0,
1567 AC_VERB_SET_PIN_WIDGET_CONTROL,
1571 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1572 static void alc_auto_parse_digital(struct hda_codec *codec)
1574 struct alc_spec *spec = codec->spec;
1578 /* support multiple SPDIFs; the secondary is set up as a slave */
1579 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1580 err = snd_hda_get_connections(codec,
1581 spec->autocfg.dig_out_pins[i],
1586 spec->multiout.dig_out_nid = dig_nid;
1587 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1589 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1590 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1592 spec->slave_dig_outs[i - 1] = dig_nid;
1596 if (spec->autocfg.dig_in_pin) {
1598 err = snd_hda_get_connections(codec,
1599 spec->autocfg.dig_in_pin,
1602 spec->dig_in_nid = dig_nid;
1613 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1614 /* Mic-in jack as mic in */
1615 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1616 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1617 /* Line-in jack as Line in */
1618 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1619 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1620 /* Line-Out as Front */
1621 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1628 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1629 /* Mic-in jack as mic in */
1630 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1631 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1632 /* Line-in jack as Surround */
1633 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1634 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1635 /* Line-Out as Front */
1636 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1643 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1644 /* Mic-in jack as CLFE */
1645 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1646 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1647 /* Line-in jack as Surround */
1648 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1649 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1650 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1651 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1658 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1659 /* Mic-in jack as CLFE */
1660 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1661 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1662 /* Line-in jack as Surround */
1663 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1664 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1665 /* Line-Out as Side */
1666 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1670 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1671 { 2, alc888_4ST_ch2_intel_init },
1672 { 4, alc888_4ST_ch4_intel_init },
1673 { 6, alc888_4ST_ch6_intel_init },
1674 { 8, alc888_4ST_ch8_intel_init },
1678 * ALC888 Fujitsu Siemens Amillo xa3530
1681 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1682 /* Front Mic: set to PIN_IN (empty by default) */
1683 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1684 /* Connect Internal HP to Front */
1685 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1687 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1688 /* Connect Bass HP to Front */
1689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1690 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1691 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1692 /* Connect Line-Out side jack (SPDIF) to Side */
1693 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1694 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1695 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1696 /* Connect Mic jack to CLFE */
1697 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1698 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1699 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1700 /* Connect Line-in jack to Surround */
1701 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1702 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1703 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1704 /* Connect HP out jack to Front */
1705 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1706 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1707 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1708 /* Enable unsolicited event for HP jack and Line-out jack */
1709 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1710 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1714 static void alc_automute_amp(struct hda_codec *codec)
1716 struct alc_spec *spec = codec->spec;
1721 spec->jack_present = 0;
1722 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1723 nid = spec->autocfg.hp_pins[i];
1726 if (snd_hda_jack_detect(codec, nid)) {
1727 spec->jack_present = 1;
1732 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1733 /* Toggle internal speakers muting */
1734 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1735 nid = spec->autocfg.speaker_pins[i];
1738 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1739 HDA_AMP_MUTE, mute);
1743 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1746 if (codec->vendor_id == 0x10ec0880)
1750 if (res == ALC880_HP_EVENT)
1751 alc_automute_amp(codec);
1754 static void alc889_automute_setup(struct hda_codec *codec)
1756 struct alc_spec *spec = codec->spec;
1758 spec->autocfg.hp_pins[0] = 0x15;
1759 spec->autocfg.speaker_pins[0] = 0x14;
1760 spec->autocfg.speaker_pins[1] = 0x16;
1761 spec->autocfg.speaker_pins[2] = 0x17;
1762 spec->autocfg.speaker_pins[3] = 0x19;
1763 spec->autocfg.speaker_pins[4] = 0x1a;
1766 static void alc889_intel_init_hook(struct hda_codec *codec)
1768 alc889_coef_init(codec);
1769 alc_automute_amp(codec);
1772 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1774 struct alc_spec *spec = codec->spec;
1776 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1777 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1778 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1779 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1783 * ALC888 Acer Aspire 4930G model
1786 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1787 /* Front Mic: set to PIN_IN (empty by default) */
1788 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1789 /* Unselect Front Mic by default in input mixer 3 */
1790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1791 /* Enable unsolicited event for HP jack */
1792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1793 /* Connect Internal HP to front */
1794 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1795 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1796 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1797 /* Connect HP out to front */
1798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1805 * ALC888 Acer Aspire 6530G model
1808 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1809 /* Route to built-in subwoofer as well as speakers */
1810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1812 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1813 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1814 /* Bias voltage on for external mic port */
1815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1816 /* Front Mic: set to PIN_IN (empty by default) */
1817 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1818 /* Unselect Front Mic by default in input mixer 3 */
1819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1820 /* Enable unsolicited event for HP jack */
1821 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1822 /* Enable speaker output */
1823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1825 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1826 /* Enable headphone output */
1827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1829 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1830 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1835 * ALC889 Acer Aspire 8930G model
1838 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1839 /* Front Mic: set to PIN_IN (empty by default) */
1840 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1841 /* Unselect Front Mic by default in input mixer 3 */
1842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1843 /* Enable unsolicited event for HP jack */
1844 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1845 /* Connect Internal Front to Front */
1846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1848 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1849 /* Connect Internal Rear to Rear */
1850 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1851 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1852 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1853 /* Connect Internal CLFE to CLFE */
1854 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1855 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1856 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1857 /* Connect HP out to Front */
1858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1860 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1861 /* Enable all DACs */
1862 /* DAC DISABLE/MUTE 1? */
1863 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1864 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1865 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1866 /* DAC DISABLE/MUTE 2? */
1867 /* some bit here disables the other DACs. Init=0x4900 */
1868 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1869 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1871 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1872 * which makes the stereo useless. However, either the mic or the ALC889
1873 * makes the signal become a difference/sum signal instead of standard
1874 * stereo, which is annoying. So instead we flip this bit which makes the
1875 * codec replicate the sum signal to both channels, turning it into a
1878 /* DMIC_CONTROL? Init value = 0x0001 */
1879 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1880 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1884 static struct hda_input_mux alc888_2_capture_sources[2] = {
1885 /* Front mic only available on one ADC */
1892 { "Front Mic", 0xb },
1905 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1906 /* Interal mic only available on one ADC */
1913 { "Input Mix", 0xa },
1923 { "Input Mix", 0xa },
1928 static struct hda_input_mux alc889_capture_sources[3] = {
1929 /* Digital mic only available on first "ADC" */
1936 { "Front Mic", 0xb },
1937 { "Input Mix", 0xa },
1946 { "Input Mix", 0xa },
1955 { "Input Mix", 0xa },
1960 static struct snd_kcontrol_new alc888_base_mixer[] = {
1961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1962 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1963 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1964 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1965 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1967 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1968 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1969 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1970 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1971 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1977 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1978 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1982 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1984 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1985 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1986 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1987 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1989 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1990 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1991 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1994 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1995 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2001 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2003 struct alc_spec *spec = codec->spec;
2005 spec->autocfg.hp_pins[0] = 0x15;
2006 spec->autocfg.speaker_pins[0] = 0x14;
2007 spec->autocfg.speaker_pins[1] = 0x16;
2008 spec->autocfg.speaker_pins[2] = 0x17;
2011 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2013 struct alc_spec *spec = codec->spec;
2015 spec->autocfg.hp_pins[0] = 0x15;
2016 spec->autocfg.speaker_pins[0] = 0x14;
2017 spec->autocfg.speaker_pins[1] = 0x16;
2018 spec->autocfg.speaker_pins[2] = 0x17;
2021 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2023 struct alc_spec *spec = codec->spec;
2025 spec->autocfg.hp_pins[0] = 0x15;
2026 spec->autocfg.speaker_pins[0] = 0x14;
2027 spec->autocfg.speaker_pins[1] = 0x16;
2028 spec->autocfg.speaker_pins[2] = 0x1b;
2032 * ALC880 3-stack model
2034 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2035 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2036 * F-Mic = 0x1b, HP = 0x19
2039 static hda_nid_t alc880_dac_nids[4] = {
2040 /* front, rear, clfe, rear_surr */
2041 0x02, 0x05, 0x04, 0x03
2044 static hda_nid_t alc880_adc_nids[3] = {
2049 /* The datasheet says the node 0x07 is connected from inputs,
2050 * but it shows zero connection in the real implementation on some devices.
2051 * Note: this is a 915GAV bug, fixed on 915GLV
2053 static hda_nid_t alc880_adc_nids_alt[2] = {
2058 #define ALC880_DIGOUT_NID 0x06
2059 #define ALC880_DIGIN_NID 0x0a
2061 static struct hda_input_mux alc880_capture_source = {
2065 { "Front Mic", 0x3 },
2071 /* channel source setting (2/6 channel selection for 3-stack) */
2073 static struct hda_verb alc880_threestack_ch2_init[] = {
2074 /* set line-in to input, mute it */
2075 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2076 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2077 /* set mic-in to input vref 80%, mute it */
2078 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2079 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2084 static struct hda_verb alc880_threestack_ch6_init[] = {
2085 /* set line-in to output, unmute it */
2086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2088 /* set mic-in to output, unmute it */
2089 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2090 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2094 static struct hda_channel_mode alc880_threestack_modes[2] = {
2095 { 2, alc880_threestack_ch2_init },
2096 { 6, alc880_threestack_ch6_init },
2099 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2100 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2103 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2104 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2105 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2106 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2107 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2108 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2109 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2114 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2115 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2118 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2119 .name = "Channel Mode",
2120 .info = alc_ch_mode_info,
2121 .get = alc_ch_mode_get,
2122 .put = alc_ch_mode_put,
2127 /* capture mixer elements */
2128 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2129 struct snd_ctl_elem_info *uinfo)
2131 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2132 struct alc_spec *spec = codec->spec;
2135 mutex_lock(&codec->control_mutex);
2136 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2138 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2139 mutex_unlock(&codec->control_mutex);
2143 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2144 unsigned int size, unsigned int __user *tlv)
2146 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2147 struct alc_spec *spec = codec->spec;
2150 mutex_lock(&codec->control_mutex);
2151 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2153 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2154 mutex_unlock(&codec->control_mutex);
2158 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2159 struct snd_ctl_elem_value *ucontrol);
2161 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2162 struct snd_ctl_elem_value *ucontrol,
2165 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2166 struct alc_spec *spec = codec->spec;
2167 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2170 mutex_lock(&codec->control_mutex);
2171 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2173 err = func(kcontrol, ucontrol);
2174 mutex_unlock(&codec->control_mutex);
2178 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2179 struct snd_ctl_elem_value *ucontrol)
2181 return alc_cap_getput_caller(kcontrol, ucontrol,
2182 snd_hda_mixer_amp_volume_get);
2185 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2186 struct snd_ctl_elem_value *ucontrol)
2188 return alc_cap_getput_caller(kcontrol, ucontrol,
2189 snd_hda_mixer_amp_volume_put);
2192 /* capture mixer elements */
2193 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2195 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2196 struct snd_ctl_elem_value *ucontrol)
2198 return alc_cap_getput_caller(kcontrol, ucontrol,
2199 snd_hda_mixer_amp_switch_get);
2202 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2203 struct snd_ctl_elem_value *ucontrol)
2205 return alc_cap_getput_caller(kcontrol, ucontrol,
2206 snd_hda_mixer_amp_switch_put);
2209 #define _DEFINE_CAPMIX(num) \
2211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2212 .name = "Capture Switch", \
2213 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2215 .info = alc_cap_sw_info, \
2216 .get = alc_cap_sw_get, \
2217 .put = alc_cap_sw_put, \
2220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2221 .name = "Capture Volume", \
2222 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2223 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2224 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2226 .info = alc_cap_vol_info, \
2227 .get = alc_cap_vol_get, \
2228 .put = alc_cap_vol_put, \
2229 .tlv = { .c = alc_cap_vol_tlv }, \
2232 #define _DEFINE_CAPSRC(num) \
2234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2235 /* .name = "Capture Source", */ \
2236 .name = "Input Source", \
2238 .info = alc_mux_enum_info, \
2239 .get = alc_mux_enum_get, \
2240 .put = alc_mux_enum_put, \
2243 #define DEFINE_CAPMIX(num) \
2244 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2245 _DEFINE_CAPMIX(num), \
2246 _DEFINE_CAPSRC(num), \
2250 #define DEFINE_CAPMIX_NOSRC(num) \
2251 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2252 _DEFINE_CAPMIX(num), \
2256 /* up to three ADCs */
2260 DEFINE_CAPMIX_NOSRC(1);
2261 DEFINE_CAPMIX_NOSRC(2);
2262 DEFINE_CAPMIX_NOSRC(3);
2265 * ALC880 5-stack model
2267 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2269 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2270 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2273 /* additional mixers to alc880_three_stack_mixer */
2274 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2275 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2280 /* channel source setting (6/8 channel selection for 5-stack) */
2282 static struct hda_verb alc880_fivestack_ch6_init[] = {
2283 /* set line-in to input, mute it */
2284 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2285 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2290 static struct hda_verb alc880_fivestack_ch8_init[] = {
2291 /* set line-in to output, unmute it */
2292 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2293 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2297 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2298 { 6, alc880_fivestack_ch6_init },
2299 { 8, alc880_fivestack_ch8_init },
2304 * ALC880 6-stack model
2306 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2307 * Side = 0x05 (0x0f)
2308 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2309 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2312 static hda_nid_t alc880_6st_dac_nids[4] = {
2313 /* front, rear, clfe, rear_surr */
2314 0x02, 0x03, 0x04, 0x05
2317 static struct hda_input_mux alc880_6stack_capture_source = {
2321 { "Front Mic", 0x1 },
2327 /* fixed 8-channels */
2328 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2332 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2333 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2334 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2336 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2337 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2338 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2339 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2340 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2342 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2343 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2344 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2345 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2346 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2349 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2350 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2353 .name = "Channel Mode",
2354 .info = alc_ch_mode_info,
2355 .get = alc_ch_mode_get,
2356 .put = alc_ch_mode_put,
2365 * W810 has rear IO for:
2368 * Center/LFE (DAC 04)
2371 * The system also has a pair of internal speakers, and a headphone jack.
2372 * These are both connected to Line2 on the codec, hence to DAC 02.
2374 * There is a variable resistor to control the speaker or headphone
2375 * volume. This is a hardware-only device without a software API.
2377 * Plugging headphones in will disable the internal speakers. This is
2378 * implemented in hardware, not via the driver using jack sense. In
2379 * a similar fashion, plugging into the rear socket marked "front" will
2380 * disable both the speakers and headphones.
2382 * For input, there's a microphone jack, and an "audio in" jack.
2383 * These may not do anything useful with this driver yet, because I
2384 * haven't setup any initialization verbs for these yet...
2387 static hda_nid_t alc880_w810_dac_nids[3] = {
2388 /* front, rear/surround, clfe */
2392 /* fixed 6 channels */
2393 static struct hda_channel_mode alc880_w810_modes[1] = {
2397 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2398 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2399 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2400 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2401 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2402 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2403 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2404 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2405 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2406 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2415 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2416 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2420 static hda_nid_t alc880_z71v_dac_nids[1] = {
2423 #define ALC880_Z71V_HP_DAC 0x03
2425 /* fixed 2 channels */
2426 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2430 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2431 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2432 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2433 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2434 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2438 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2444 * ALC880 F1734 model
2446 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2447 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2450 static hda_nid_t alc880_f1734_dac_nids[1] = {
2453 #define ALC880_F1734_HP_DAC 0x02
2455 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2456 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2457 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2458 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2459 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2467 static struct hda_input_mux alc880_f1734_capture_source = {
2479 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2480 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2481 * Mic = 0x18, Line = 0x1a
2484 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2485 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2487 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2488 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2489 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2490 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2491 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2492 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2493 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2494 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2495 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2496 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2497 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2498 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2499 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2503 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2504 .name = "Channel Mode",
2505 .info = alc_ch_mode_info,
2506 .get = alc_ch_mode_get,
2507 .put = alc_ch_mode_put,
2513 * ALC880 ASUS W1V model
2515 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2516 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2517 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2520 /* additional mixers to alc880_asus_mixer */
2521 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2522 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2523 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2528 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2529 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2530 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2531 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2532 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2533 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2536 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2537 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2542 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2543 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2544 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2545 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2546 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2547 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2548 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2549 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2550 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2551 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2552 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2553 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2554 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2557 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2561 .name = "Channel Mode",
2562 .info = alc_ch_mode_info,
2563 .get = alc_ch_mode_get,
2564 .put = alc_ch_mode_put,
2569 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2570 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2571 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2573 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2574 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2575 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2576 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2577 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2578 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2579 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2583 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2584 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2585 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2586 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2587 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2594 * virtual master controls
2598 * slave controls for virtual master
2600 static const char *alc_slave_vols[] = {
2601 "Front Playback Volume",
2602 "Surround Playback Volume",
2603 "Center Playback Volume",
2604 "LFE Playback Volume",
2605 "Side Playback Volume",
2606 "Headphone Playback Volume",
2607 "Speaker Playback Volume",
2608 "Mono Playback Volume",
2609 "Line-Out Playback Volume",
2610 "PCM Playback Volume",
2614 static const char *alc_slave_sws[] = {
2615 "Front Playback Switch",
2616 "Surround Playback Switch",
2617 "Center Playback Switch",
2618 "LFE Playback Switch",
2619 "Side Playback Switch",
2620 "Headphone Playback Switch",
2621 "Speaker Playback Switch",
2622 "Mono Playback Switch",
2623 "IEC958 Playback Switch",
2624 "Line-Out Playback Switch",
2625 "PCM Playback Switch",
2630 * build control elements
2633 #define NID_MAPPING (-1)
2635 #define SUBDEV_SPEAKER_ (0 << 6)
2636 #define SUBDEV_HP_ (1 << 6)
2637 #define SUBDEV_LINE_ (2 << 6)
2638 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2639 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2640 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2642 static void alc_free_kctls(struct hda_codec *codec);
2644 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2645 /* additional beep mixers; the actual parameters are overwritten at build */
2646 static struct snd_kcontrol_new alc_beep_mixer[] = {
2647 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2648 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2653 static int alc_build_controls(struct hda_codec *codec)
2655 struct alc_spec *spec = codec->spec;
2656 struct snd_kcontrol *kctl = NULL;
2657 struct snd_kcontrol_new *knew;
2662 for (i = 0; i < spec->num_mixers; i++) {
2663 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2667 if (spec->cap_mixer) {
2668 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2672 if (spec->multiout.dig_out_nid) {
2673 err = snd_hda_create_spdif_out_ctls(codec,
2674 spec->multiout.dig_out_nid);
2677 if (!spec->no_analog) {
2678 err = snd_hda_create_spdif_share_sw(codec,
2682 spec->multiout.share_spdif = 1;
2685 if (spec->dig_in_nid) {
2686 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2691 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2692 /* create beep controls if needed */
2693 if (spec->beep_amp) {
2694 struct snd_kcontrol_new *knew;
2695 for (knew = alc_beep_mixer; knew->name; knew++) {
2696 struct snd_kcontrol *kctl;
2697 kctl = snd_ctl_new1(knew, codec);
2700 kctl->private_value = spec->beep_amp;
2701 err = snd_hda_ctl_add(codec, 0, kctl);
2708 /* if we have no master control, let's create it */
2709 if (!spec->no_analog &&
2710 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2711 unsigned int vmaster_tlv[4];
2712 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2713 HDA_OUTPUT, vmaster_tlv);
2714 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2715 vmaster_tlv, alc_slave_vols);
2719 if (!spec->no_analog &&
2720 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2721 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2722 NULL, alc_slave_sws);
2727 /* assign Capture Source enums to NID */
2728 if (spec->capsrc_nids || spec->adc_nids) {
2729 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2731 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2732 for (i = 0; kctl && i < kctl->count; i++) {
2733 hda_nid_t *nids = spec->capsrc_nids;
2735 nids = spec->adc_nids;
2736 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2741 if (spec->cap_mixer) {
2742 const char *kname = kctl ? kctl->id.name : NULL;
2743 for (knew = spec->cap_mixer; knew->name; knew++) {
2744 if (kname && strcmp(knew->name, kname) == 0)
2746 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2747 for (i = 0; kctl && i < kctl->count; i++) {
2748 err = snd_hda_add_nid(codec, kctl, i,
2756 /* other nid->control mapping */
2757 for (i = 0; i < spec->num_mixers; i++) {
2758 for (knew = spec->mixers[i]; knew->name; knew++) {
2759 if (knew->iface != NID_MAPPING)
2761 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2764 u = knew->subdevice;
2765 for (j = 0; j < 4; j++, u >>= 8) {
2770 case SUBDEV_SPEAKER_:
2771 nid = spec->autocfg.speaker_pins[nid];
2774 nid = spec->autocfg.line_out_pins[nid];
2777 nid = spec->autocfg.hp_pins[nid];
2782 err = snd_hda_add_nid(codec, kctl, 0, nid);
2786 u = knew->private_value;
2787 for (j = 0; j < 4; j++, u >>= 8) {
2791 err = snd_hda_add_nid(codec, kctl, 0, nid);
2798 alc_free_kctls(codec); /* no longer needed */
2805 * initialize the codec volumes, etc
2809 * generic initialization of ADC, input mixers and output mixers
2811 static struct hda_verb alc880_volume_init_verbs[] = {
2813 * Unmute ADC0-2 and set the default input to mic-in
2815 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2816 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2817 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2818 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2819 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2820 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2822 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2824 * Note: PASD motherboards uses the Line In 2 as the input for front
2827 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2832 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2837 * Set up output mixers (0x0c - 0x0f)
2839 /* set vol=0 to output mixers */
2840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2844 /* set up input amps for analog loopback */
2845 /* Amp Indices: DAC = 0, mixer = 1 */
2846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2849 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2851 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2852 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2859 * 3-stack pin configuration:
2860 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2862 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2864 * preset connection lists of input pins
2865 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2867 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2868 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2869 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2872 * Set pin mode and muting
2874 /* set front pin widgets 0x14 for output */
2875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2876 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2877 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2878 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2880 /* Mic2 (as headphone out) for HP output */
2881 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2882 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2883 /* Line In pin widget for input */
2884 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2886 /* Line2 (as front mic) pin widget for input and vref at 80% */
2887 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2888 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2889 /* CD pin widget for input */
2890 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2896 * 5-stack pin configuration:
2897 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2898 * line-in/side = 0x1a, f-mic = 0x1b
2900 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2902 * preset connection lists of input pins
2903 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2905 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2906 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2909 * Set pin mode and muting
2911 /* set pin widgets 0x14-0x17 for output */
2912 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2913 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2914 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2915 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2916 /* unmute pins for output (no gain on this amp) */
2917 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2918 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2920 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2923 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2924 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2925 /* Mic2 (as headphone out) for HP output */
2926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2927 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2928 /* Line In pin widget for input */
2929 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2931 /* Line2 (as front mic) pin widget for input and vref at 80% */
2932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2934 /* CD pin widget for input */
2935 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2941 * W810 pin configuration:
2942 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2944 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2945 /* hphone/speaker input selector: front DAC */
2946 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2948 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2949 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2950 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2951 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2952 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2953 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2955 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2956 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2962 * Z71V pin configuration:
2963 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2965 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2972 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2974 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2980 * 6-stack pin configuration:
2981 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2982 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2984 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2985 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2987 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2993 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2994 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2996 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2997 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2998 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2999 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3000 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3001 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3002 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3003 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3004 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3010 * Uniwill pin configuration:
3011 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3014 static struct hda_verb alc880_uniwill_init_verbs[] = {
3015 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3017 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3018 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3020 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3024 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3029 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3030 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3032 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3033 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3034 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3035 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3036 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3037 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3038 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3039 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3040 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3042 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3043 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3050 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3052 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3053 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3058 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3060 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3072 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3073 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3075 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3076 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3081 static struct hda_verb alc880_beep_init_verbs[] = {
3082 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3086 /* auto-toggle front mic */
3087 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3089 unsigned int present;
3092 present = snd_hda_jack_detect(codec, 0x18);
3093 bits = present ? HDA_AMP_MUTE : 0;
3094 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3097 static void alc880_uniwill_setup(struct hda_codec *codec)
3099 struct alc_spec *spec = codec->spec;
3101 spec->autocfg.hp_pins[0] = 0x14;
3102 spec->autocfg.speaker_pins[0] = 0x15;
3103 spec->autocfg.speaker_pins[0] = 0x16;
3106 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3108 alc_automute_amp(codec);
3109 alc880_uniwill_mic_automute(codec);
3112 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3115 /* Looks like the unsol event is incompatible with the standard
3116 * definition. 4bit tag is placed at 28 bit!
3118 switch (res >> 28) {
3119 case ALC880_MIC_EVENT:
3120 alc880_uniwill_mic_automute(codec);
3123 alc_automute_amp_unsol_event(codec, res);
3128 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3130 struct alc_spec *spec = codec->spec;
3132 spec->autocfg.hp_pins[0] = 0x14;
3133 spec->autocfg.speaker_pins[0] = 0x15;
3136 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3138 unsigned int present;
3140 present = snd_hda_codec_read(codec, 0x21, 0,
3141 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3142 present &= HDA_AMP_VOLMASK;
3143 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3144 HDA_AMP_VOLMASK, present);
3145 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3146 HDA_AMP_VOLMASK, present);
3149 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3152 /* Looks like the unsol event is incompatible with the standard
3153 * definition. 4bit tag is placed at 28 bit!
3155 if ((res >> 28) == ALC880_DCVOL_EVENT)
3156 alc880_uniwill_p53_dcvol_automute(codec);
3158 alc_automute_amp_unsol_event(codec, res);
3162 * F1734 pin configuration:
3163 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3165 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3166 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3167 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3168 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3169 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3170 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3172 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3173 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3174 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3178 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3179 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3181 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3182 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3183 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3184 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3185 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3187 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3188 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3194 * ASUS pin configuration:
3195 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3197 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3198 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3199 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3200 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3201 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3204 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3206 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3207 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3209 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3210 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3212 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3213 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3214 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3215 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3216 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3217 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3220 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3225 /* Enable GPIO mask and set output */
3226 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3227 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3228 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3230 /* Clevo m520g init */
3231 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3232 /* headphone output */
3233 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3238 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3239 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3241 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3242 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3243 /* Mic1 (rear panel) */
3244 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3246 /* Mic2 (front panel) */
3247 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3248 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3250 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3252 /* change to EAPD mode */
3253 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3254 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3259 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3260 /* change to EAPD mode */
3261 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3262 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3264 /* Headphone output */
3265 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3267 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3268 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3270 /* Line In pin widget for input */
3271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3272 /* CD pin widget for input */
3273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3274 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3275 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3277 /* change to EAPD mode */
3278 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3279 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3285 * LG m1 express dual
3288 * Rear Line-In/Out (blue): 0x14
3289 * Build-in Mic-In: 0x15
3291 * HP-Out (green): 0x1b
3292 * Mic-In/Out (red): 0x19
3296 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3297 static hda_nid_t alc880_lg_dac_nids[3] = {
3301 /* seems analog CD is not working */
3302 static struct hda_input_mux alc880_lg_capture_source = {
3307 { "Internal Mic", 0x6 },
3311 /* 2,4,6 channel modes */
3312 static struct hda_verb alc880_lg_ch2_init[] = {
3313 /* set line-in and mic-in to input */
3314 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3315 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3319 static struct hda_verb alc880_lg_ch4_init[] = {
3320 /* set line-in to out and mic-in to input */
3321 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3322 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3326 static struct hda_verb alc880_lg_ch6_init[] = {
3327 /* set line-in and mic-in to output */
3328 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3329 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3333 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3334 { 2, alc880_lg_ch2_init },
3335 { 4, alc880_lg_ch4_init },
3336 { 6, alc880_lg_ch6_init },
3339 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3340 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3341 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3342 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3343 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3352 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3353 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3356 .name = "Channel Mode",
3357 .info = alc_ch_mode_info,
3358 .get = alc_ch_mode_get,
3359 .put = alc_ch_mode_put,
3364 static struct hda_verb alc880_lg_init_verbs[] = {
3365 /* set capture source to mic-in */
3366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3368 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3369 /* mute all amp mixer inputs */
3370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3373 /* line-in to input */
3374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3375 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3377 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3378 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3380 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3381 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3382 /* mic-in to input */
3383 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3384 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3385 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3387 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3388 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3389 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3391 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3395 /* toggle speaker-output according to the hp-jack state */
3396 static void alc880_lg_setup(struct hda_codec *codec)
3398 struct alc_spec *spec = codec->spec;
3400 spec->autocfg.hp_pins[0] = 0x1b;
3401 spec->autocfg.speaker_pins[0] = 0x17;
3410 * Built-in Mic-In: 0x19
3416 static struct hda_input_mux alc880_lg_lw_capture_source = {
3420 { "Internal Mic", 0x1 },
3425 #define alc880_lg_lw_modes alc880_threestack_modes
3427 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3430 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3431 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3432 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3433 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3434 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3435 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3436 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3437 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3439 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3440 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3441 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3444 .name = "Channel Mode",
3445 .info = alc_ch_mode_info,
3446 .get = alc_ch_mode_get,
3447 .put = alc_ch_mode_put,
3452 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3453 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3454 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3455 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3457 /* set capture source to mic-in */
3458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3460 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3466 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3467 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3468 /* mic-in to input */
3469 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3470 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3473 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3479 /* toggle speaker-output according to the hp-jack state */
3480 static void alc880_lg_lw_setup(struct hda_codec *codec)
3482 struct alc_spec *spec = codec->spec;
3484 spec->autocfg.hp_pins[0] = 0x1b;
3485 spec->autocfg.speaker_pins[0] = 0x14;
3488 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3489 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3490 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3493 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3494 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3498 static struct hda_input_mux alc880_medion_rim_capture_source = {
3502 { "Internal Mic", 0x1 },
3506 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3507 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3509 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3512 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3514 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3515 /* Mic2 (as headphone out) for HP output */
3516 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3517 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3518 /* Internal Speaker */
3519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3520 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3522 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3523 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3525 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3529 /* toggle speaker-output according to the hp-jack state */
3530 static void alc880_medion_rim_automute(struct hda_codec *codec)
3532 struct alc_spec *spec = codec->spec;
3533 alc_automute_amp(codec);
3535 if (spec->jack_present)
3536 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3538 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3541 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3544 /* Looks like the unsol event is incompatible with the standard
3545 * definition. 4bit tag is placed at 28 bit!
3547 if ((res >> 28) == ALC880_HP_EVENT)
3548 alc880_medion_rim_automute(codec);
3551 static void alc880_medion_rim_setup(struct hda_codec *codec)
3553 struct alc_spec *spec = codec->spec;
3555 spec->autocfg.hp_pins[0] = 0x14;
3556 spec->autocfg.speaker_pins[0] = 0x1b;
3559 #ifdef CONFIG_SND_HDA_POWER_SAVE
3560 static struct hda_amp_list alc880_loopbacks[] = {
3561 { 0x0b, HDA_INPUT, 0 },
3562 { 0x0b, HDA_INPUT, 1 },
3563 { 0x0b, HDA_INPUT, 2 },
3564 { 0x0b, HDA_INPUT, 3 },
3565 { 0x0b, HDA_INPUT, 4 },
3569 static struct hda_amp_list alc880_lg_loopbacks[] = {
3570 { 0x0b, HDA_INPUT, 1 },
3571 { 0x0b, HDA_INPUT, 6 },
3572 { 0x0b, HDA_INPUT, 7 },
3581 static int alc_init(struct hda_codec *codec)
3583 struct alc_spec *spec = codec->spec;
3587 alc_auto_init_amp(codec, spec->init_amp);
3589 for (i = 0; i < spec->num_init_verbs; i++)
3590 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3592 if (spec->init_hook)
3593 spec->init_hook(codec);
3595 #ifdef CONFIG_SND_HDA_POWER_SAVE
3596 if (codec->patch_ops.check_power_status)
3597 codec->patch_ops.check_power_status(codec, 0x01);
3602 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3604 struct alc_spec *spec = codec->spec;
3606 if (spec->unsol_event)
3607 spec->unsol_event(codec, res);
3610 #ifdef CONFIG_SND_HDA_POWER_SAVE
3611 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3613 struct alc_spec *spec = codec->spec;
3614 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3619 * Analog playback callbacks
3621 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3622 struct hda_codec *codec,
3623 struct snd_pcm_substream *substream)
3625 struct alc_spec *spec = codec->spec;
3626 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3630 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3631 struct hda_codec *codec,
3632 unsigned int stream_tag,
3633 unsigned int format,
3634 struct snd_pcm_substream *substream)
3636 struct alc_spec *spec = codec->spec;
3637 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3638 stream_tag, format, substream);
3641 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3642 struct hda_codec *codec,
3643 struct snd_pcm_substream *substream)
3645 struct alc_spec *spec = codec->spec;
3646 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3652 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3653 struct hda_codec *codec,
3654 struct snd_pcm_substream *substream)
3656 struct alc_spec *spec = codec->spec;
3657 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3660 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3661 struct hda_codec *codec,
3662 unsigned int stream_tag,
3663 unsigned int format,
3664 struct snd_pcm_substream *substream)
3666 struct alc_spec *spec = codec->spec;
3667 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3668 stream_tag, format, substream);
3671 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3672 struct hda_codec *codec,
3673 struct snd_pcm_substream *substream)
3675 struct alc_spec *spec = codec->spec;
3676 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3679 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3680 struct hda_codec *codec,
3681 struct snd_pcm_substream *substream)
3683 struct alc_spec *spec = codec->spec;
3684 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3690 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3691 struct hda_codec *codec,
3692 unsigned int stream_tag,
3693 unsigned int format,
3694 struct snd_pcm_substream *substream)
3696 struct alc_spec *spec = codec->spec;
3698 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3699 stream_tag, 0, format);
3703 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3704 struct hda_codec *codec,
3705 struct snd_pcm_substream *substream)
3707 struct alc_spec *spec = codec->spec;
3709 snd_hda_codec_cleanup_stream(codec,
3710 spec->adc_nids[substream->number + 1]);
3714 /* analog capture with dynamic dual-adc changes */
3715 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3716 struct hda_codec *codec,
3717 unsigned int stream_tag,
3718 unsigned int format,
3719 struct snd_pcm_substream *substream)
3721 struct alc_spec *spec = codec->spec;
3722 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3723 spec->cur_adc_stream_tag = stream_tag;
3724 spec->cur_adc_format = format;
3725 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3729 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3730 struct hda_codec *codec,
3731 struct snd_pcm_substream *substream)
3733 struct alc_spec *spec = codec->spec;
3734 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3739 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3743 .nid = 0, /* fill later */
3745 .prepare = dualmic_capture_pcm_prepare,
3746 .cleanup = dualmic_capture_pcm_cleanup
3752 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3756 /* NID is set in alc_build_pcms */
3758 .open = alc880_playback_pcm_open,
3759 .prepare = alc880_playback_pcm_prepare,
3760 .cleanup = alc880_playback_pcm_cleanup
3764 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3768 /* NID is set in alc_build_pcms */
3771 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3775 /* NID is set in alc_build_pcms */
3778 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3779 .substreams = 2, /* can be overridden */
3782 /* NID is set in alc_build_pcms */
3784 .prepare = alc880_alt_capture_pcm_prepare,
3785 .cleanup = alc880_alt_capture_pcm_cleanup
3789 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3793 /* NID is set in alc_build_pcms */
3795 .open = alc880_dig_playback_pcm_open,
3796 .close = alc880_dig_playback_pcm_close,
3797 .prepare = alc880_dig_playback_pcm_prepare,
3798 .cleanup = alc880_dig_playback_pcm_cleanup
3802 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3806 /* NID is set in alc_build_pcms */
3809 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3810 static struct hda_pcm_stream alc_pcm_null_stream = {
3816 static int alc_build_pcms(struct hda_codec *codec)
3818 struct alc_spec *spec = codec->spec;
3819 struct hda_pcm *info = spec->pcm_rec;
3822 codec->num_pcms = 1;
3823 codec->pcm_info = info;
3825 if (spec->no_analog)
3828 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3829 "%s Analog", codec->chip_name);
3830 info->name = spec->stream_name_analog;
3832 if (spec->stream_analog_playback) {
3833 if (snd_BUG_ON(!spec->multiout.dac_nids))
3835 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3836 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3838 if (spec->stream_analog_capture) {
3839 if (snd_BUG_ON(!spec->adc_nids))
3841 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3842 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3845 if (spec->channel_mode) {
3846 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3847 for (i = 0; i < spec->num_channel_mode; i++) {
3848 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3849 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3855 /* SPDIF for stream index #1 */
3856 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3857 snprintf(spec->stream_name_digital,
3858 sizeof(spec->stream_name_digital),
3859 "%s Digital", codec->chip_name);
3860 codec->num_pcms = 2;
3861 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3862 info = spec->pcm_rec + 1;
3863 info->name = spec->stream_name_digital;
3864 if (spec->dig_out_type)
3865 info->pcm_type = spec->dig_out_type;
3867 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3868 if (spec->multiout.dig_out_nid &&
3869 spec->stream_digital_playback) {
3870 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3871 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3873 if (spec->dig_in_nid &&
3874 spec->stream_digital_capture) {
3875 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3876 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3878 /* FIXME: do we need this for all Realtek codec models? */
3879 codec->spdif_status_reset = 1;
3882 if (spec->no_analog)
3885 /* If the use of more than one ADC is requested for the current
3886 * model, configure a second analog capture-only PCM.
3888 /* Additional Analaog capture for index #2 */
3889 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3890 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3891 codec->num_pcms = 3;
3892 info = spec->pcm_rec + 2;
3893 info->name = spec->stream_name_analog;
3894 if (spec->alt_dac_nid) {
3895 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3896 *spec->stream_analog_alt_playback;
3897 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3900 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3901 alc_pcm_null_stream;
3902 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3904 if (spec->num_adc_nids > 1) {
3905 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3906 *spec->stream_analog_alt_capture;
3907 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3909 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3910 spec->num_adc_nids - 1;
3912 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3913 alc_pcm_null_stream;
3914 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3921 static inline void alc_shutup(struct hda_codec *codec)
3923 snd_hda_shutup_pins(codec);
3926 static void alc_free_kctls(struct hda_codec *codec)
3928 struct alc_spec *spec = codec->spec;
3930 if (spec->kctls.list) {
3931 struct snd_kcontrol_new *kctl = spec->kctls.list;
3933 for (i = 0; i < spec->kctls.used; i++)
3934 kfree(kctl[i].name);
3936 snd_array_free(&spec->kctls);
3939 static void alc_free(struct hda_codec *codec)
3941 struct alc_spec *spec = codec->spec;
3947 alc_free_kctls(codec);
3949 snd_hda_detach_beep_device(codec);
3952 #ifdef CONFIG_SND_HDA_POWER_SAVE
3953 static void alc_power_eapd(struct hda_codec *codec)
3955 /* We currently only handle front, HP */
3956 switch (codec->vendor_id) {
3958 set_eapd(codec, 0x0f, 0);
3959 set_eapd(codec, 0x10, 0);
3972 set_eapd(codec, 0x14, 0);
3973 set_eapd(codec, 0x15, 0);
3978 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3980 struct alc_spec *spec = codec->spec;
3982 if (spec && spec->power_hook)
3983 spec->power_hook(codec);
3988 #ifdef SND_HDA_NEEDS_RESUME
3989 static int alc_resume(struct hda_codec *codec)
3991 codec->patch_ops.init(codec);
3992 snd_hda_codec_resume_amp(codec);
3993 snd_hda_codec_resume_cache(codec);
3994 #ifdef CONFIG_SND_HDA_POWER_SAVE
3995 if (codec->patch_ops.check_power_status)
3996 codec->patch_ops.check_power_status(codec, 0x01);
4004 static struct hda_codec_ops alc_patch_ops = {
4005 .build_controls = alc_build_controls,
4006 .build_pcms = alc_build_pcms,
4009 .unsol_event = alc_unsol_event,
4010 #ifdef SND_HDA_NEEDS_RESUME
4011 .resume = alc_resume,
4013 #ifdef CONFIG_SND_HDA_POWER_SAVE
4014 .suspend = alc_suspend,
4015 .check_power_status = alc_check_power_status,
4017 .reboot_notify = alc_shutup,
4020 /* replace the codec chip_name with the given string */
4021 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4023 kfree(codec->chip_name);
4024 codec->chip_name = kstrdup(name, GFP_KERNEL);
4025 if (!codec->chip_name) {
4033 * Test configuration for debugging
4035 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4038 #ifdef CONFIG_SND_DEBUG
4039 static hda_nid_t alc880_test_dac_nids[4] = {
4040 0x02, 0x03, 0x04, 0x05
4043 static struct hda_input_mux alc880_test_capture_source = {
4052 { "Surround", 0x6 },
4056 static struct hda_channel_mode alc880_test_modes[4] = {
4063 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4064 struct snd_ctl_elem_info *uinfo)
4066 static char *texts[] = {
4067 "N/A", "Line Out", "HP Out",
4068 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4070 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4072 uinfo->value.enumerated.items = 8;
4073 if (uinfo->value.enumerated.item >= 8)
4074 uinfo->value.enumerated.item = 7;
4075 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4079 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4080 struct snd_ctl_elem_value *ucontrol)
4082 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4083 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4084 unsigned int pin_ctl, item = 0;
4086 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4087 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4088 if (pin_ctl & AC_PINCTL_OUT_EN) {
4089 if (pin_ctl & AC_PINCTL_HP_EN)
4093 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4094 switch (pin_ctl & AC_PINCTL_VREFEN) {
4095 case AC_PINCTL_VREF_HIZ: item = 3; break;
4096 case AC_PINCTL_VREF_50: item = 4; break;
4097 case AC_PINCTL_VREF_GRD: item = 5; break;
4098 case AC_PINCTL_VREF_80: item = 6; break;
4099 case AC_PINCTL_VREF_100: item = 7; break;
4102 ucontrol->value.enumerated.item[0] = item;
4106 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4107 struct snd_ctl_elem_value *ucontrol)
4109 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4110 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4111 static unsigned int ctls[] = {
4112 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4113 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4114 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4115 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4116 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4117 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4119 unsigned int old_ctl, new_ctl;
4121 old_ctl = snd_hda_codec_read(codec, nid, 0,
4122 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4123 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4124 if (old_ctl != new_ctl) {
4126 snd_hda_codec_write_cache(codec, nid, 0,
4127 AC_VERB_SET_PIN_WIDGET_CONTROL,
4129 val = ucontrol->value.enumerated.item[0] >= 3 ?
4131 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4138 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4139 struct snd_ctl_elem_info *uinfo)
4141 static char *texts[] = {
4142 "Front", "Surround", "CLFE", "Side"
4144 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4146 uinfo->value.enumerated.items = 4;
4147 if (uinfo->value.enumerated.item >= 4)
4148 uinfo->value.enumerated.item = 3;
4149 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4153 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4154 struct snd_ctl_elem_value *ucontrol)
4156 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4157 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4160 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4161 ucontrol->value.enumerated.item[0] = sel & 3;
4165 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4166 struct snd_ctl_elem_value *ucontrol)
4168 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4169 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4172 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4173 if (ucontrol->value.enumerated.item[0] != sel) {
4174 sel = ucontrol->value.enumerated.item[0] & 3;
4175 snd_hda_codec_write_cache(codec, nid, 0,
4176 AC_VERB_SET_CONNECT_SEL, sel);
4182 #define PIN_CTL_TEST(xname,nid) { \
4183 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4185 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4186 .info = alc_test_pin_ctl_info, \
4187 .get = alc_test_pin_ctl_get, \
4188 .put = alc_test_pin_ctl_put, \
4189 .private_value = nid \
4192 #define PIN_SRC_TEST(xname,nid) { \
4193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4195 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4196 .info = alc_test_pin_src_info, \
4197 .get = alc_test_pin_src_get, \
4198 .put = alc_test_pin_src_put, \
4199 .private_value = nid \
4202 static struct snd_kcontrol_new alc880_test_mixer[] = {
4203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4204 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4205 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4206 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4207 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4209 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4210 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4211 PIN_CTL_TEST("Front Pin Mode", 0x14),
4212 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4213 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4214 PIN_CTL_TEST("Side Pin Mode", 0x17),
4215 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4216 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4217 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4218 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4219 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4220 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4221 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4222 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4223 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4224 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4225 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4226 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4227 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4228 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4229 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4230 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4235 .name = "Channel Mode",
4236 .info = alc_ch_mode_info,
4237 .get = alc_ch_mode_get,
4238 .put = alc_ch_mode_put,
4243 static struct hda_verb alc880_test_init_verbs[] = {
4244 /* Unmute inputs of 0x0c - 0x0f */
4245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4246 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4248 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4249 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4250 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4251 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4252 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4253 /* Vol output for 0x0c-0x0f */
4254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4255 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4258 /* Set output pins 0x14-0x17 */
4259 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4261 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4262 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4263 /* Unmute output pins 0x14-0x17 */
4264 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4265 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4266 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4267 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4268 /* Set input pins 0x18-0x1c */
4269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4270 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4273 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4274 /* Mute input pins 0x18-0x1b */
4275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4276 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4277 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4278 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4281 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4282 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4283 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4285 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4286 /* Analog input/passthru */
4287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4299 static const char *alc880_models[ALC880_MODEL_LAST] = {
4300 [ALC880_3ST] = "3stack",
4301 [ALC880_TCL_S700] = "tcl",
4302 [ALC880_3ST_DIG] = "3stack-digout",
4303 [ALC880_CLEVO] = "clevo",
4304 [ALC880_5ST] = "5stack",
4305 [ALC880_5ST_DIG] = "5stack-digout",
4306 [ALC880_W810] = "w810",
4307 [ALC880_Z71V] = "z71v",
4308 [ALC880_6ST] = "6stack",
4309 [ALC880_6ST_DIG] = "6stack-digout",
4310 [ALC880_ASUS] = "asus",
4311 [ALC880_ASUS_W1V] = "asus-w1v",
4312 [ALC880_ASUS_DIG] = "asus-dig",
4313 [ALC880_ASUS_DIG2] = "asus-dig2",
4314 [ALC880_UNIWILL_DIG] = "uniwill",
4315 [ALC880_UNIWILL_P53] = "uniwill-p53",
4316 [ALC880_FUJITSU] = "fujitsu",
4317 [ALC880_F1734] = "F1734",
4319 [ALC880_LG_LW] = "lg-lw",
4320 [ALC880_MEDION_RIM] = "medion",
4321 #ifdef CONFIG_SND_DEBUG
4322 [ALC880_TEST] = "test",
4324 [ALC880_AUTO] = "auto",
4327 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4328 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4329 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4330 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4331 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4332 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4333 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4334 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4335 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4336 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4337 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4338 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4339 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4340 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4341 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4342 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4343 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4344 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4345 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4346 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4347 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4348 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4349 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4350 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4351 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4352 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4353 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4354 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4355 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4356 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4357 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4358 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4359 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4360 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4361 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4362 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4363 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4364 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4365 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4366 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4367 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4368 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4369 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4370 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4371 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4372 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4373 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4374 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4375 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4376 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4377 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4378 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4379 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4380 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4381 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4382 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4383 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4384 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4385 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4386 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4387 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4388 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4389 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4390 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4391 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4392 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4393 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4394 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4395 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4397 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4398 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4399 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4404 * ALC880 codec presets
4406 static struct alc_config_preset alc880_presets[] = {
4408 .mixers = { alc880_three_stack_mixer },
4409 .init_verbs = { alc880_volume_init_verbs,
4410 alc880_pin_3stack_init_verbs },
4411 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4412 .dac_nids = alc880_dac_nids,
4413 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4414 .channel_mode = alc880_threestack_modes,
4416 .input_mux = &alc880_capture_source,
4418 [ALC880_3ST_DIG] = {
4419 .mixers = { alc880_three_stack_mixer },
4420 .init_verbs = { alc880_volume_init_verbs,
4421 alc880_pin_3stack_init_verbs },
4422 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4423 .dac_nids = alc880_dac_nids,
4424 .dig_out_nid = ALC880_DIGOUT_NID,
4425 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4426 .channel_mode = alc880_threestack_modes,
4428 .input_mux = &alc880_capture_source,
4430 [ALC880_TCL_S700] = {
4431 .mixers = { alc880_tcl_s700_mixer },
4432 .init_verbs = { alc880_volume_init_verbs,
4433 alc880_pin_tcl_S700_init_verbs,
4434 alc880_gpio2_init_verbs },
4435 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4436 .dac_nids = alc880_dac_nids,
4437 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4438 .num_adc_nids = 1, /* single ADC */
4440 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4441 .channel_mode = alc880_2_jack_modes,
4442 .input_mux = &alc880_capture_source,
4445 .mixers = { alc880_three_stack_mixer,
4446 alc880_five_stack_mixer},
4447 .init_verbs = { alc880_volume_init_verbs,
4448 alc880_pin_5stack_init_verbs },
4449 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4450 .dac_nids = alc880_dac_nids,
4451 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4452 .channel_mode = alc880_fivestack_modes,
4453 .input_mux = &alc880_capture_source,
4455 [ALC880_5ST_DIG] = {
4456 .mixers = { alc880_three_stack_mixer,
4457 alc880_five_stack_mixer },
4458 .init_verbs = { alc880_volume_init_verbs,
4459 alc880_pin_5stack_init_verbs },
4460 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4461 .dac_nids = alc880_dac_nids,
4462 .dig_out_nid = ALC880_DIGOUT_NID,
4463 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4464 .channel_mode = alc880_fivestack_modes,
4465 .input_mux = &alc880_capture_source,
4468 .mixers = { alc880_six_stack_mixer },
4469 .init_verbs = { alc880_volume_init_verbs,
4470 alc880_pin_6stack_init_verbs },
4471 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4472 .dac_nids = alc880_6st_dac_nids,
4473 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4474 .channel_mode = alc880_sixstack_modes,
4475 .input_mux = &alc880_6stack_capture_source,
4477 [ALC880_6ST_DIG] = {
4478 .mixers = { alc880_six_stack_mixer },
4479 .init_verbs = { alc880_volume_init_verbs,
4480 alc880_pin_6stack_init_verbs },
4481 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4482 .dac_nids = alc880_6st_dac_nids,
4483 .dig_out_nid = ALC880_DIGOUT_NID,
4484 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4485 .channel_mode = alc880_sixstack_modes,
4486 .input_mux = &alc880_6stack_capture_source,
4489 .mixers = { alc880_w810_base_mixer },
4490 .init_verbs = { alc880_volume_init_verbs,
4491 alc880_pin_w810_init_verbs,
4492 alc880_gpio2_init_verbs },
4493 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4494 .dac_nids = alc880_w810_dac_nids,
4495 .dig_out_nid = ALC880_DIGOUT_NID,
4496 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4497 .channel_mode = alc880_w810_modes,
4498 .input_mux = &alc880_capture_source,
4501 .mixers = { alc880_z71v_mixer },
4502 .init_verbs = { alc880_volume_init_verbs,
4503 alc880_pin_z71v_init_verbs },
4504 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4505 .dac_nids = alc880_z71v_dac_nids,
4506 .dig_out_nid = ALC880_DIGOUT_NID,
4508 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4509 .channel_mode = alc880_2_jack_modes,
4510 .input_mux = &alc880_capture_source,
4513 .mixers = { alc880_f1734_mixer },
4514 .init_verbs = { alc880_volume_init_verbs,
4515 alc880_pin_f1734_init_verbs },
4516 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4517 .dac_nids = alc880_f1734_dac_nids,
4519 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4520 .channel_mode = alc880_2_jack_modes,
4521 .input_mux = &alc880_f1734_capture_source,
4522 .unsol_event = alc880_uniwill_p53_unsol_event,
4523 .setup = alc880_uniwill_p53_setup,
4524 .init_hook = alc_automute_amp,
4527 .mixers = { alc880_asus_mixer },
4528 .init_verbs = { alc880_volume_init_verbs,
4529 alc880_pin_asus_init_verbs,
4530 alc880_gpio1_init_verbs },
4531 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4532 .dac_nids = alc880_asus_dac_nids,
4533 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4534 .channel_mode = alc880_asus_modes,
4536 .input_mux = &alc880_capture_source,
4538 [ALC880_ASUS_DIG] = {
4539 .mixers = { alc880_asus_mixer },
4540 .init_verbs = { alc880_volume_init_verbs,
4541 alc880_pin_asus_init_verbs,
4542 alc880_gpio1_init_verbs },
4543 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4544 .dac_nids = alc880_asus_dac_nids,
4545 .dig_out_nid = ALC880_DIGOUT_NID,
4546 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4547 .channel_mode = alc880_asus_modes,
4549 .input_mux = &alc880_capture_source,
4551 [ALC880_ASUS_DIG2] = {
4552 .mixers = { alc880_asus_mixer },
4553 .init_verbs = { alc880_volume_init_verbs,
4554 alc880_pin_asus_init_verbs,
4555 alc880_gpio2_init_verbs }, /* use GPIO2 */
4556 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4557 .dac_nids = alc880_asus_dac_nids,
4558 .dig_out_nid = ALC880_DIGOUT_NID,
4559 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4560 .channel_mode = alc880_asus_modes,
4562 .input_mux = &alc880_capture_source,
4564 [ALC880_ASUS_W1V] = {
4565 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4566 .init_verbs = { alc880_volume_init_verbs,
4567 alc880_pin_asus_init_verbs,
4568 alc880_gpio1_init_verbs },
4569 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4570 .dac_nids = alc880_asus_dac_nids,
4571 .dig_out_nid = ALC880_DIGOUT_NID,
4572 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4573 .channel_mode = alc880_asus_modes,
4575 .input_mux = &alc880_capture_source,
4577 [ALC880_UNIWILL_DIG] = {
4578 .mixers = { alc880_asus_mixer },
4579 .init_verbs = { alc880_volume_init_verbs,
4580 alc880_pin_asus_init_verbs },
4581 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4582 .dac_nids = alc880_asus_dac_nids,
4583 .dig_out_nid = ALC880_DIGOUT_NID,
4584 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4585 .channel_mode = alc880_asus_modes,
4587 .input_mux = &alc880_capture_source,
4589 [ALC880_UNIWILL] = {
4590 .mixers = { alc880_uniwill_mixer },
4591 .init_verbs = { alc880_volume_init_verbs,
4592 alc880_uniwill_init_verbs },
4593 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4594 .dac_nids = alc880_asus_dac_nids,
4595 .dig_out_nid = ALC880_DIGOUT_NID,
4596 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4597 .channel_mode = alc880_threestack_modes,
4599 .input_mux = &alc880_capture_source,
4600 .unsol_event = alc880_uniwill_unsol_event,
4601 .setup = alc880_uniwill_setup,
4602 .init_hook = alc880_uniwill_init_hook,
4604 [ALC880_UNIWILL_P53] = {
4605 .mixers = { alc880_uniwill_p53_mixer },
4606 .init_verbs = { alc880_volume_init_verbs,
4607 alc880_uniwill_p53_init_verbs },
4608 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4609 .dac_nids = alc880_asus_dac_nids,
4610 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4611 .channel_mode = alc880_threestack_modes,
4612 .input_mux = &alc880_capture_source,
4613 .unsol_event = alc880_uniwill_p53_unsol_event,
4614 .setup = alc880_uniwill_p53_setup,
4615 .init_hook = alc_automute_amp,
4617 [ALC880_FUJITSU] = {
4618 .mixers = { alc880_fujitsu_mixer },
4619 .init_verbs = { alc880_volume_init_verbs,
4620 alc880_uniwill_p53_init_verbs,
4621 alc880_beep_init_verbs },
4622 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4623 .dac_nids = alc880_dac_nids,
4624 .dig_out_nid = ALC880_DIGOUT_NID,
4625 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4626 .channel_mode = alc880_2_jack_modes,
4627 .input_mux = &alc880_capture_source,
4628 .unsol_event = alc880_uniwill_p53_unsol_event,
4629 .setup = alc880_uniwill_p53_setup,
4630 .init_hook = alc_automute_amp,
4633 .mixers = { alc880_three_stack_mixer },
4634 .init_verbs = { alc880_volume_init_verbs,
4635 alc880_pin_clevo_init_verbs },
4636 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4637 .dac_nids = alc880_dac_nids,
4639 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4640 .channel_mode = alc880_threestack_modes,
4642 .input_mux = &alc880_capture_source,
4645 .mixers = { alc880_lg_mixer },
4646 .init_verbs = { alc880_volume_init_verbs,
4647 alc880_lg_init_verbs },
4648 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4649 .dac_nids = alc880_lg_dac_nids,
4650 .dig_out_nid = ALC880_DIGOUT_NID,
4651 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4652 .channel_mode = alc880_lg_ch_modes,
4654 .input_mux = &alc880_lg_capture_source,
4655 .unsol_event = alc_automute_amp_unsol_event,
4656 .setup = alc880_lg_setup,
4657 .init_hook = alc_automute_amp,
4658 #ifdef CONFIG_SND_HDA_POWER_SAVE
4659 .loopbacks = alc880_lg_loopbacks,
4663 .mixers = { alc880_lg_lw_mixer },
4664 .init_verbs = { alc880_volume_init_verbs,
4665 alc880_lg_lw_init_verbs },
4666 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4667 .dac_nids = alc880_dac_nids,
4668 .dig_out_nid = ALC880_DIGOUT_NID,
4669 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4670 .channel_mode = alc880_lg_lw_modes,
4671 .input_mux = &alc880_lg_lw_capture_source,
4672 .unsol_event = alc_automute_amp_unsol_event,
4673 .setup = alc880_lg_lw_setup,
4674 .init_hook = alc_automute_amp,
4676 [ALC880_MEDION_RIM] = {
4677 .mixers = { alc880_medion_rim_mixer },
4678 .init_verbs = { alc880_volume_init_verbs,
4679 alc880_medion_rim_init_verbs,
4680 alc_gpio2_init_verbs },
4681 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4682 .dac_nids = alc880_dac_nids,
4683 .dig_out_nid = ALC880_DIGOUT_NID,
4684 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4685 .channel_mode = alc880_2_jack_modes,
4686 .input_mux = &alc880_medion_rim_capture_source,
4687 .unsol_event = alc880_medion_rim_unsol_event,
4688 .setup = alc880_medion_rim_setup,
4689 .init_hook = alc880_medion_rim_automute,
4691 #ifdef CONFIG_SND_DEBUG
4693 .mixers = { alc880_test_mixer },
4694 .init_verbs = { alc880_test_init_verbs },
4695 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4696 .dac_nids = alc880_test_dac_nids,
4697 .dig_out_nid = ALC880_DIGOUT_NID,
4698 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4699 .channel_mode = alc880_test_modes,
4700 .input_mux = &alc880_test_capture_source,
4706 * Automatic parse of I/O pins from the BIOS configuration
4711 ALC_CTL_WIDGET_MUTE,
4714 static struct snd_kcontrol_new alc880_control_templates[] = {
4715 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4716 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4717 HDA_BIND_MUTE(NULL, 0, 0, 0),
4720 /* add dynamic controls */
4721 static int add_control(struct alc_spec *spec, int type, const char *name,
4724 struct snd_kcontrol_new *knew;
4726 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4727 knew = snd_array_new(&spec->kctls);
4730 *knew = alc880_control_templates[type];
4731 knew->name = kstrdup(name, GFP_KERNEL);
4734 if (get_amp_nid_(val))
4735 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4736 knew->private_value = val;
4740 static int add_control_with_pfx(struct alc_spec *spec, int type,
4741 const char *pfx, const char *dir,
4742 const char *sfx, unsigned long val)
4745 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4746 return add_control(spec, type, name, val);
4749 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4750 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4751 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4752 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4754 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4755 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4756 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4757 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4758 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4759 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4760 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4761 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4762 #define ALC880_PIN_CD_NID 0x1c
4764 /* fill in the dac_nids table from the parsed pin configuration */
4765 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4766 const struct auto_pin_cfg *cfg)
4772 memset(assigned, 0, sizeof(assigned));
4773 spec->multiout.dac_nids = spec->private_dac_nids;
4775 /* check the pins hardwired to audio widget */
4776 for (i = 0; i < cfg->line_outs; i++) {
4777 nid = cfg->line_out_pins[i];
4778 if (alc880_is_fixed_pin(nid)) {
4779 int idx = alc880_fixed_pin_idx(nid);
4780 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4784 /* left pins can be connect to any audio widget */
4785 for (i = 0; i < cfg->line_outs; i++) {
4786 nid = cfg->line_out_pins[i];
4787 if (alc880_is_fixed_pin(nid))
4789 /* search for an empty channel */
4790 for (j = 0; j < cfg->line_outs; j++) {
4792 spec->multiout.dac_nids[i] =
4793 alc880_idx_to_dac(j);
4799 spec->multiout.num_dacs = cfg->line_outs;
4803 /* add playback controls from the parsed DAC table */
4804 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4805 const struct auto_pin_cfg *cfg)
4807 static const char *chname[4] = {
4808 "Front", "Surround", NULL /*CLFE*/, "Side"
4813 for (i = 0; i < cfg->line_outs; i++) {
4814 if (!spec->multiout.dac_nids[i])
4816 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4819 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4821 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4825 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4827 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4831 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4833 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4837 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4839 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4845 if (cfg->line_outs == 1 &&
4846 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4850 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4851 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4855 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4856 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4865 /* add playback controls for speaker and HP outputs */
4866 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4875 if (alc880_is_fixed_pin(pin)) {
4876 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4877 /* specify the DAC as the extra output */
4878 if (!spec->multiout.hp_nid)
4879 spec->multiout.hp_nid = nid;
4881 spec->multiout.extra_out_nid[0] = nid;
4882 /* control HP volume/switch on the output mixer amp */
4883 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4884 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4885 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4888 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4889 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4892 } else if (alc880_is_multi_pin(pin)) {
4893 /* set manual connection */
4894 /* we have only a switch on HP-out PIN */
4895 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4896 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4903 /* create input playback/capture controls for the given pin */
4904 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4905 const char *ctlname,
4906 int idx, hda_nid_t mix_nid)
4910 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4911 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4914 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4915 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4921 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4923 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4924 return (pincap & AC_PINCAP_IN) != 0;
4927 /* create playback/capture controls for input pins */
4928 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4929 const struct auto_pin_cfg *cfg,
4931 hda_nid_t cap1, hda_nid_t cap2)
4933 struct alc_spec *spec = codec->spec;
4934 struct hda_input_mux *imux = &spec->private_imux[0];
4937 for (i = 0; i < AUTO_PIN_LAST; i++) {
4940 pin = cfg->input_pins[i];
4941 if (!alc_is_input_pin(codec, pin))
4945 idx = get_connection_index(codec, mixer, pin);
4947 err = new_analog_input(spec, pin,
4948 auto_pin_cfg_labels[i],
4957 idx = get_connection_index(codec, cap1, pin);
4958 if (idx < 0 && cap2)
4959 idx = get_connection_index(codec, cap2, pin);
4961 imux->items[imux->num_items].label =
4962 auto_pin_cfg_labels[i];
4963 imux->items[imux->num_items].index = idx;
4970 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4971 const struct auto_pin_cfg *cfg)
4973 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4976 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4977 unsigned int pin_type)
4979 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4982 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4986 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4987 hda_nid_t nid, int pin_type,
4990 alc_set_pin_output(codec, nid, pin_type);
4991 /* need the manual connection? */
4992 if (alc880_is_multi_pin(nid)) {
4993 struct alc_spec *spec = codec->spec;
4994 int idx = alc880_multi_pin_idx(nid);
4995 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4996 AC_VERB_SET_CONNECT_SEL,
4997 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5001 static int get_pin_type(int line_out_type)
5003 if (line_out_type == AUTO_PIN_HP_OUT)
5009 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5011 struct alc_spec *spec = codec->spec;
5014 for (i = 0; i < spec->autocfg.line_outs; i++) {
5015 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5016 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5017 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5021 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5023 struct alc_spec *spec = codec->spec;
5026 pin = spec->autocfg.speaker_pins[0];
5027 if (pin) /* connect to front */
5028 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5029 pin = spec->autocfg.hp_pins[0];
5030 if (pin) /* connect to front */
5031 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5034 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5036 struct alc_spec *spec = codec->spec;
5039 for (i = 0; i < AUTO_PIN_LAST; i++) {
5040 hda_nid_t nid = spec->autocfg.input_pins[i];
5041 if (alc_is_input_pin(codec, nid)) {
5042 alc_set_input_pin(codec, nid, i);
5043 if (nid != ALC880_PIN_CD_NID &&
5044 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5045 snd_hda_codec_write(codec, nid, 0,
5046 AC_VERB_SET_AMP_GAIN_MUTE,
5052 static void alc880_auto_init_input_src(struct hda_codec *codec)
5054 struct alc_spec *spec = codec->spec;
5057 for (c = 0; c < spec->num_adc_nids; c++) {
5058 unsigned int mux_idx;
5059 const struct hda_input_mux *imux;
5060 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5061 imux = &spec->input_mux[mux_idx];
5062 if (!imux->num_items && mux_idx > 0)
5063 imux = &spec->input_mux[0];
5065 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5066 AC_VERB_SET_CONNECT_SEL,
5067 imux->items[0].index);
5071 /* parse the BIOS configuration and set up the alc_spec */
5072 /* return 1 if successful, 0 if the proper config is not found,
5073 * or a negative error code
5075 static int alc880_parse_auto_config(struct hda_codec *codec)
5077 struct alc_spec *spec = codec->spec;
5079 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5081 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5085 if (!spec->autocfg.line_outs)
5086 return 0; /* can't find valid BIOS pin config */
5088 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5091 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5094 err = alc880_auto_create_extra_out(spec,
5095 spec->autocfg.speaker_pins[0],
5099 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5103 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5107 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5109 alc_auto_parse_digital(codec);
5111 if (spec->kctls.list)
5112 add_mixer(spec, spec->kctls.list);
5114 add_verb(spec, alc880_volume_init_verbs);
5116 spec->num_mux_defs = 1;
5117 spec->input_mux = &spec->private_imux[0];
5119 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5124 /* additional initialization for auto-configuration model */
5125 static void alc880_auto_init(struct hda_codec *codec)
5127 struct alc_spec *spec = codec->spec;
5128 alc880_auto_init_multi_out(codec);
5129 alc880_auto_init_extra_out(codec);
5130 alc880_auto_init_analog_input(codec);
5131 alc880_auto_init_input_src(codec);
5132 alc_auto_init_digital(codec);
5133 if (spec->unsol_event)
5134 alc_inithook(codec);
5137 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5138 * one of two digital mic pins, e.g. on ALC272
5140 static void fixup_automic_adc(struct hda_codec *codec)
5142 struct alc_spec *spec = codec->spec;
5145 for (i = 0; i < spec->num_adc_nids; i++) {
5146 hda_nid_t cap = spec->capsrc_nids ?
5147 spec->capsrc_nids[i] : spec->adc_nids[i];
5150 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5153 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5156 spec->int_mic.mux_idx = iidx;
5157 spec->ext_mic.mux_idx = eidx;
5158 if (spec->capsrc_nids)
5159 spec->capsrc_nids += i;
5160 spec->adc_nids += i;
5161 spec->num_adc_nids = 1;
5164 snd_printd(KERN_INFO "hda_codec: %s: "
5165 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5166 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5167 spec->auto_mic = 0; /* disable auto-mic to be sure */
5170 /* select or unmute the given capsrc route */
5171 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5174 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5175 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5178 snd_hda_codec_write_cache(codec, cap, 0,
5179 AC_VERB_SET_CONNECT_SEL, idx);
5183 /* set the default connection to that pin */
5184 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5186 struct alc_spec *spec = codec->spec;
5189 for (i = 0; i < spec->num_adc_nids; i++) {
5190 hda_nid_t cap = spec->capsrc_nids ?
5191 spec->capsrc_nids[i] : spec->adc_nids[i];
5194 idx = get_connection_index(codec, cap, pin);
5197 select_or_unmute_capsrc(codec, cap, idx);
5198 return i; /* return the found index */
5200 return -1; /* not found */
5203 /* choose the ADC/MUX containing the input pin and initialize the setup */
5204 static void fixup_single_adc(struct hda_codec *codec)
5206 struct alc_spec *spec = codec->spec;
5210 /* search for the input pin; there must be only one */
5211 for (i = 0; i < AUTO_PIN_LAST; i++) {
5212 if (spec->autocfg.input_pins[i]) {
5213 pin = spec->autocfg.input_pins[i];
5219 i = init_capsrc_for_pin(codec, pin);
5221 /* use only this ADC */
5222 if (spec->capsrc_nids)
5223 spec->capsrc_nids += i;
5224 spec->adc_nids += i;
5225 spec->num_adc_nids = 1;
5229 /* initialize dual adcs */
5230 static void fixup_dual_adc_switch(struct hda_codec *codec)
5232 struct alc_spec *spec = codec->spec;
5233 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5234 init_capsrc_for_pin(codec, spec->int_mic.pin);
5237 static void set_capture_mixer(struct hda_codec *codec)
5239 struct alc_spec *spec = codec->spec;
5240 static struct snd_kcontrol_new *caps[2][3] = {
5241 { alc_capture_mixer_nosrc1,
5242 alc_capture_mixer_nosrc2,
5243 alc_capture_mixer_nosrc3 },
5244 { alc_capture_mixer1,
5246 alc_capture_mixer3 },
5248 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5250 int num_adcs = spec->num_adc_nids;
5251 if (spec->dual_adc_switch)
5252 fixup_dual_adc_switch(codec);
5253 else if (spec->auto_mic)
5254 fixup_automic_adc(codec);
5255 else if (spec->input_mux) {
5256 if (spec->input_mux->num_items > 1)
5258 else if (spec->input_mux->num_items == 1)
5259 fixup_single_adc(codec);
5261 if (spec->dual_adc_switch)
5263 spec->cap_mixer = caps[mux][num_adcs - 1];
5267 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5268 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5271 struct alc_spec *spec = codec->spec;
5273 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5275 for (n = 0; n < num_nids; n++) {
5277 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5281 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5284 nconns = snd_hda_get_connections(codec, cap, conn,
5288 nconns = snd_hda_get_connections(codec, cap, conn,
5293 if (!fallback_adc) {
5297 for (i = 0; i < AUTO_PIN_LAST; i++) {
5298 hda_nid_t nid = spec->autocfg.input_pins[i];
5301 for (j = 0; j < nconns; j++) {
5308 if (i >= AUTO_PIN_LAST) {
5309 int num_adcs = spec->num_adc_nids;
5310 spec->private_adc_nids[num_adcs] = adc;
5311 spec->private_capsrc_nids[num_adcs] = cap;
5312 spec->num_adc_nids++;
5313 spec->adc_nids = spec->private_adc_nids;
5315 spec->capsrc_nids = spec->private_capsrc_nids;
5318 if (!spec->num_adc_nids) {
5319 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5320 " using fallback 0x%x\n",
5321 codec->chip_name, fallback_adc);
5322 spec->private_adc_nids[0] = fallback_adc;
5323 spec->adc_nids = spec->private_adc_nids;
5324 if (fallback_adc != fallback_cap) {
5325 spec->private_capsrc_nids[0] = fallback_cap;
5326 spec->capsrc_nids = spec->private_adc_nids;
5331 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5332 #define set_beep_amp(spec, nid, idx, dir) \
5333 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5335 static struct snd_pci_quirk beep_white_list[] = {
5336 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5337 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5341 static inline int has_cdefine_beep(struct hda_codec *codec)
5343 struct alc_spec *spec = codec->spec;
5344 const struct snd_pci_quirk *q;
5345 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5348 return spec->cdefine.enable_pcbeep;
5351 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5352 #define has_cdefine_beep(codec) 0
5356 * OK, here we have finally the patch for ALC880
5359 static int patch_alc880(struct hda_codec *codec)
5361 struct alc_spec *spec;
5365 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5371 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5374 if (board_config < 0) {
5375 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5377 board_config = ALC880_AUTO;
5380 if (board_config == ALC880_AUTO) {
5381 /* automatic parse from the BIOS config */
5382 err = alc880_parse_auto_config(codec);
5388 "hda_codec: Cannot set up configuration "
5389 "from BIOS. Using 3-stack mode...\n");
5390 board_config = ALC880_3ST;
5394 err = snd_hda_attach_beep_device(codec, 0x1);
5400 if (board_config != ALC880_AUTO)
5401 setup_preset(codec, &alc880_presets[board_config]);
5403 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5404 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5405 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5407 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5408 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5410 if (!spec->adc_nids && spec->input_mux) {
5411 /* check whether NID 0x07 is valid */
5412 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5414 wcap = get_wcaps_type(wcap);
5415 if (wcap != AC_WID_AUD_IN) {
5416 spec->adc_nids = alc880_adc_nids_alt;
5417 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5419 spec->adc_nids = alc880_adc_nids;
5420 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5423 set_capture_mixer(codec);
5424 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5426 spec->vmaster_nid = 0x0c;
5428 codec->patch_ops = alc_patch_ops;
5429 if (board_config == ALC880_AUTO)
5430 spec->init_hook = alc880_auto_init;
5431 #ifdef CONFIG_SND_HDA_POWER_SAVE
5432 if (!spec->loopback.amplist)
5433 spec->loopback.amplist = alc880_loopbacks;
5444 static hda_nid_t alc260_dac_nids[1] = {
5449 static hda_nid_t alc260_adc_nids[1] = {
5454 static hda_nid_t alc260_adc_nids_alt[1] = {
5459 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5460 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5462 static hda_nid_t alc260_dual_adc_nids[2] = {
5467 #define ALC260_DIGOUT_NID 0x03
5468 #define ALC260_DIGIN_NID 0x06
5470 static struct hda_input_mux alc260_capture_source = {
5474 { "Front Mic", 0x1 },
5480 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5481 * headphone jack and the internal CD lines since these are the only pins at
5482 * which audio can appear. For flexibility, also allow the option of
5483 * recording the mixer output on the second ADC (ADC0 doesn't have a
5484 * connection to the mixer output).
5486 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5490 { "Mic/Line", 0x0 },
5492 { "Headphone", 0x2 },
5498 { "Mic/Line", 0x0 },
5500 { "Headphone", 0x2 },
5507 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5508 * the Fujitsu S702x, but jacks are marked differently.
5510 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5517 { "Headphone", 0x5 },
5526 { "Headphone", 0x6 },
5532 /* Maxdata Favorit 100XS */
5533 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5537 { "Line/Mic", 0x0 },
5544 { "Line/Mic", 0x0 },
5552 * This is just place-holder, so there's something for alc_build_pcms to look
5553 * at when it calculates the maximum number of channels. ALC260 has no mixer
5554 * element which allows changing the channel mode, so the verb list is
5557 static struct hda_channel_mode alc260_modes[1] = {
5562 /* Mixer combinations
5564 * basic: base_output + input + pc_beep + capture
5565 * HP: base_output + input + capture_alt
5566 * HP_3013: hp_3013 + input + capture
5567 * fujitsu: fujitsu + capture
5568 * acer: acer + capture
5571 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5572 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5573 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5574 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5575 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5576 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5577 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5581 static struct snd_kcontrol_new alc260_input_mixer[] = {
5582 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5583 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5584 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5585 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5587 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5588 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5589 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5593 /* update HP, line and mono out pins according to the master switch */
5594 static void alc260_hp_master_update(struct hda_codec *codec,
5595 hda_nid_t hp, hda_nid_t line,
5598 struct alc_spec *spec = codec->spec;
5599 unsigned int val = spec->master_sw ? PIN_HP : 0;
5600 /* change HP and line-out pins */
5601 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5603 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5605 /* mono (speaker) depending on the HP jack sense */
5606 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5607 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5611 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5612 struct snd_ctl_elem_value *ucontrol)
5614 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5615 struct alc_spec *spec = codec->spec;
5616 *ucontrol->value.integer.value = spec->master_sw;
5620 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5621 struct snd_ctl_elem_value *ucontrol)
5623 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5624 struct alc_spec *spec = codec->spec;
5625 int val = !!*ucontrol->value.integer.value;
5626 hda_nid_t hp, line, mono;
5628 if (val == spec->master_sw)
5630 spec->master_sw = val;
5631 hp = (kcontrol->private_value >> 16) & 0xff;
5632 line = (kcontrol->private_value >> 8) & 0xff;
5633 mono = kcontrol->private_value & 0xff;
5634 alc260_hp_master_update(codec, hp, line, mono);
5638 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5640 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5641 .name = "Master Playback Switch",
5642 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5643 .info = snd_ctl_boolean_mono_info,
5644 .get = alc260_hp_master_sw_get,
5645 .put = alc260_hp_master_sw_put,
5646 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5648 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5649 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5650 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5651 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5652 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5654 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5658 static struct hda_verb alc260_hp_unsol_verbs[] = {
5659 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5663 static void alc260_hp_automute(struct hda_codec *codec)
5665 struct alc_spec *spec = codec->spec;
5667 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5668 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5671 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5673 if ((res >> 26) == ALC880_HP_EVENT)
5674 alc260_hp_automute(codec);
5677 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5679 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5680 .name = "Master Playback Switch",
5681 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5682 .info = snd_ctl_boolean_mono_info,
5683 .get = alc260_hp_master_sw_get,
5684 .put = alc260_hp_master_sw_put,
5685 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5687 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5688 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5689 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5690 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5691 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5693 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5694 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5698 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5699 .ops = &snd_hda_bind_vol,
5701 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5702 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5703 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5708 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5709 .ops = &snd_hda_bind_sw,
5711 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5712 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5717 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5718 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5719 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5720 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5725 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5726 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5730 static void alc260_hp_3013_automute(struct hda_codec *codec)
5732 struct alc_spec *spec = codec->spec;
5734 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5735 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5738 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5741 if ((res >> 26) == ALC880_HP_EVENT)
5742 alc260_hp_3013_automute(codec);
5745 static void alc260_hp_3012_automute(struct hda_codec *codec)
5747 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5749 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5751 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5753 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5757 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5760 if ((res >> 26) == ALC880_HP_EVENT)
5761 alc260_hp_3012_automute(codec);
5764 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5765 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5767 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5768 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5769 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5770 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5771 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5772 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5773 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5774 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5775 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5776 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5777 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5781 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5782 * versions of the ALC260 don't act on requests to enable mic bias from NID
5783 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5784 * datasheet doesn't mention this restriction. At this stage it's not clear
5785 * whether this behaviour is intentional or is a hardware bug in chip
5786 * revisions available in early 2006. Therefore for now allow the
5787 * "Headphone Jack Mode" control to span all choices, but if it turns out
5788 * that the lack of mic bias for this NID is intentional we could change the
5789 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5791 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5792 * don't appear to make the mic bias available from the "line" jack, even
5793 * though the NID used for this jack (0x14) can supply it. The theory is
5794 * that perhaps Acer have included blocking capacitors between the ALC260
5795 * and the output jack. If this turns out to be the case for all such
5796 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5797 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5799 * The C20x Tablet series have a mono internal speaker which is controlled
5800 * via the chip's Mono sum widget and pin complex, so include the necessary
5801 * controls for such models. On models without a "mono speaker" the control
5802 * won't do anything.
5804 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5805 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5806 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5807 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5808 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5810 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5812 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5813 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5815 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5816 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5817 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5818 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5819 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5823 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5825 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5826 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5827 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5828 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5829 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5830 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5831 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5835 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5836 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5838 static struct snd_kcontrol_new alc260_will_mixer[] = {
5839 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5840 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5842 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5843 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5844 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5845 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5846 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5847 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5848 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5852 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5853 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5855 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5856 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5857 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5859 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5860 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5861 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5862 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5863 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5864 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5865 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5870 * initialization verbs
5872 static struct hda_verb alc260_init_verbs[] = {
5873 /* Line In pin widget for input */
5874 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5875 /* CD pin widget for input */
5876 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5877 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5878 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5879 /* Mic2 (front panel) pin widget for input and vref at 80% */
5880 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5881 /* LINE-2 is used for line-out in rear */
5882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5883 /* select line-out */
5884 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5886 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5888 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5890 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5891 /* mute capture amp left and right */
5892 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5893 /* set connection select to line in (default select for this ADC) */
5894 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5895 /* mute capture amp left and right */
5896 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5897 /* set connection select to line in (default select for this ADC) */
5898 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5899 /* set vol=0 Line-Out mixer amp left and right */
5900 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5901 /* unmute pin widget amp left and right (no gain on this amp) */
5902 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5903 /* set vol=0 HP mixer amp left and right */
5904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5905 /* unmute pin widget amp left and right (no gain on this amp) */
5906 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5907 /* set vol=0 Mono mixer amp left and right */
5908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5909 /* unmute pin widget amp left and right (no gain on this amp) */
5910 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5911 /* unmute LINE-2 out pin */
5912 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5913 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5916 /* mute analog inputs */
5917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5921 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5922 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5923 /* mute Front out path */
5924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5925 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5926 /* mute Headphone out path */
5927 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5928 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5929 /* mute Mono out path */
5930 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5931 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5935 #if 0 /* should be identical with alc260_init_verbs? */
5936 static struct hda_verb alc260_hp_init_verbs[] = {
5937 /* Headphone and output */
5938 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5940 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5941 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5942 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5943 /* Mic2 (front panel) pin widget for input and vref at 80% */
5944 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5945 /* Line In pin widget for input */
5946 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5947 /* Line-2 pin widget for output */
5948 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5949 /* CD pin widget for input */
5950 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5951 /* unmute amp left and right */
5952 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5953 /* set connection select to line in (default select for this ADC) */
5954 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5955 /* unmute Line-Out mixer amp left and right (volume = 0) */
5956 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5957 /* mute pin widget amp left and right (no gain on this amp) */
5958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5959 /* unmute HP mixer amp left and right (volume = 0) */
5960 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5961 /* mute pin widget amp left and right (no gain on this amp) */
5962 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5963 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5966 /* mute analog inputs */
5967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5972 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5973 /* Unmute Front out path */
5974 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5976 /* Unmute Headphone out path */
5977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5978 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5979 /* Unmute Mono out path */
5980 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5981 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5986 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5987 /* Line out and output */
5988 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5990 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5991 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5992 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5993 /* Mic2 (front panel) pin widget for input and vref at 80% */
5994 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5995 /* Line In pin widget for input */
5996 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5997 /* Headphone pin widget for output */
5998 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5999 /* CD pin widget for input */
6000 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6001 /* unmute amp left and right */
6002 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6003 /* set connection select to line in (default select for this ADC) */
6004 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6005 /* unmute Line-Out mixer amp left and right (volume = 0) */
6006 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6007 /* mute pin widget amp left and right (no gain on this amp) */
6008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6009 /* unmute HP mixer amp left and right (volume = 0) */
6010 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6011 /* mute pin widget amp left and right (no gain on this amp) */
6012 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6013 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6016 /* mute analog inputs */
6017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6018 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6022 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6023 /* Unmute Front out path */
6024 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6025 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6026 /* Unmute Headphone out path */
6027 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6028 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6029 /* Unmute Mono out path */
6030 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6031 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6035 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6036 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6037 * audio = 0x16, internal speaker = 0x10.
6039 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6040 /* Disable all GPIOs */
6041 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6042 /* Internal speaker is connected to headphone pin */
6043 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6044 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6045 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6046 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6047 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6048 /* Ensure all other unused pins are disabled and muted. */
6049 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6051 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6052 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6053 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6054 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6055 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6058 /* Disable digital (SPDIF) pins */
6059 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6060 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6062 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6063 * when acting as an output.
6065 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6067 /* Start with output sum widgets muted and their output gains at min */
6068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6074 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6078 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6079 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6080 /* Unmute Line1 pin widget output buffer since it starts as an output.
6081 * If the pin mode is changed by the user the pin mode control will
6082 * take care of enabling the pin's input/output buffers as needed.
6083 * Therefore there's no need to enable the input buffer at this
6086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6087 /* Unmute input buffer of pin widget used for Line-in (no equiv
6090 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6092 /* Mute capture amp left and right */
6093 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6094 /* Set ADC connection select to match default mixer setting - line
6097 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6099 /* Do the same for the second ADC: mute capture input amp and
6100 * set ADC connection to line in (on mic1 pin)
6102 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6103 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6105 /* Mute all inputs to mixer widget (even unconnected ones) */
6106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6118 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6119 * similar laptops (adapted from Fujitsu init verbs).
6121 static struct hda_verb alc260_acer_init_verbs[] = {
6122 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6123 * the headphone jack. Turn this on and rely on the standard mute
6124 * methods whenever the user wants to turn these outputs off.
6126 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6127 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6128 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6129 /* Internal speaker/Headphone jack is connected to Line-out pin */
6130 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6131 /* Internal microphone/Mic jack is connected to Mic1 pin */
6132 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6133 /* Line In jack is connected to Line1 pin */
6134 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6135 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6136 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6137 /* Ensure all other unused pins are disabled and muted. */
6138 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6139 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6140 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6141 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6144 /* Disable digital (SPDIF) pins */
6145 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6146 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6148 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6149 * bus when acting as outputs.
6151 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6152 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6154 /* Start with output sum widgets muted and their output gains at min */
6155 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6156 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6157 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6158 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6159 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6160 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6161 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6162 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6163 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6165 /* Unmute Line-out pin widget amp left and right
6166 * (no equiv mixer ctrl)
6168 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6169 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6170 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6171 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6172 * inputs. If the pin mode is changed by the user the pin mode control
6173 * will take care of enabling the pin's input/output buffers as needed.
6174 * Therefore there's no need to enable the input buffer at this
6177 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6178 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6180 /* Mute capture amp left and right */
6181 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6182 /* Set ADC connection select to match default mixer setting - mic
6185 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6187 /* Do similar with the second ADC: mute capture input amp and
6188 * set ADC connection to mic to match ALSA's default state.
6190 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6191 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6193 /* Mute all inputs to mixer widget (even unconnected ones) */
6194 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6196 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6201 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6206 /* Initialisation sequence for Maxdata Favorit 100XS
6207 * (adapted from Acer init verbs).
6209 static struct hda_verb alc260_favorit100_init_verbs[] = {
6210 /* GPIO 0 enables the output jack.
6211 * Turn this on and rely on the standard mute
6212 * methods whenever the user wants to turn these outputs off.
6214 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6215 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6216 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6217 /* Line/Mic input jack is connected to Mic1 pin */
6218 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6219 /* Ensure all other unused pins are disabled and muted. */
6220 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6221 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6222 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6223 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6224 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6225 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6226 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6227 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6228 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6230 /* Disable digital (SPDIF) pins */
6231 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6232 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6234 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6235 * bus when acting as outputs.
6237 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6238 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6240 /* Start with output sum widgets muted and their output gains at min */
6241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6243 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6246 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6247 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6248 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6249 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6251 /* Unmute Line-out pin widget amp left and right
6252 * (no equiv mixer ctrl)
6254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6255 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6256 * inputs. If the pin mode is changed by the user the pin mode control
6257 * will take care of enabling the pin's input/output buffers as needed.
6258 * Therefore there's no need to enable the input buffer at this
6261 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6263 /* Mute capture amp left and right */
6264 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6265 /* Set ADC connection select to match default mixer setting - mic
6268 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6270 /* Do similar with the second ADC: mute capture input amp and
6271 * set ADC connection to mic to match ALSA's default state.
6273 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6274 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6276 /* Mute all inputs to mixer widget (even unconnected ones) */
6277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6281 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6283 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6284 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6289 static struct hda_verb alc260_will_verbs[] = {
6290 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6291 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6292 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6293 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6294 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6295 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6299 static struct hda_verb alc260_replacer_672v_verbs[] = {
6300 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6301 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6302 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6304 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6305 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6306 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6308 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6312 /* toggle speaker-output according to the hp-jack state */
6313 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6315 unsigned int present;
6317 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6318 present = snd_hda_jack_detect(codec, 0x0f);
6320 snd_hda_codec_write_cache(codec, 0x01, 0,
6321 AC_VERB_SET_GPIO_DATA, 1);
6322 snd_hda_codec_write_cache(codec, 0x0f, 0,
6323 AC_VERB_SET_PIN_WIDGET_CONTROL,
6326 snd_hda_codec_write_cache(codec, 0x01, 0,
6327 AC_VERB_SET_GPIO_DATA, 0);
6328 snd_hda_codec_write_cache(codec, 0x0f, 0,
6329 AC_VERB_SET_PIN_WIDGET_CONTROL,
6334 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6337 if ((res >> 26) == ALC880_HP_EVENT)
6338 alc260_replacer_672v_automute(codec);
6341 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6342 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6344 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6345 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6346 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6347 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6348 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6349 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6350 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6351 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6355 /* Test configuration for debugging, modelled after the ALC880 test
6358 #ifdef CONFIG_SND_DEBUG
6359 static hda_nid_t alc260_test_dac_nids[1] = {
6362 static hda_nid_t alc260_test_adc_nids[2] = {
6365 /* For testing the ALC260, each input MUX needs its own definition since
6366 * the signal assignments are different. This assumes that the first ADC
6369 static struct hda_input_mux alc260_test_capture_sources[2] = {
6373 { "MIC1 pin", 0x0 },
6374 { "MIC2 pin", 0x1 },
6375 { "LINE1 pin", 0x2 },
6376 { "LINE2 pin", 0x3 },
6378 { "LINE-OUT pin", 0x5 },
6379 { "HP-OUT pin", 0x6 },
6385 { "MIC1 pin", 0x0 },
6386 { "MIC2 pin", 0x1 },
6387 { "LINE1 pin", 0x2 },
6388 { "LINE2 pin", 0x3 },
6391 { "LINE-OUT pin", 0x6 },
6392 { "HP-OUT pin", 0x7 },
6396 static struct snd_kcontrol_new alc260_test_mixer[] = {
6397 /* Output driver widgets */
6398 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6399 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6400 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6401 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6402 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6403 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6405 /* Modes for retasking pin widgets
6406 * Note: the ALC260 doesn't seem to act on requests to enable mic
6407 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6408 * mention this restriction. At this stage it's not clear whether
6409 * this behaviour is intentional or is a hardware bug in chip
6410 * revisions available at least up until early 2006. Therefore for
6411 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6412 * choices, but if it turns out that the lack of mic bias for these
6413 * NIDs is intentional we could change their modes from
6414 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6416 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6417 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6418 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6419 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6420 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6421 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6423 /* Loopback mixer controls */
6424 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6425 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6426 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6427 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6428 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6429 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6430 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6431 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6432 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6433 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6434 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6435 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6436 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6437 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6439 /* Controls for GPIO pins, assuming they are configured as outputs */
6440 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6441 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6442 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6443 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6445 /* Switches to allow the digital IO pins to be enabled. The datasheet
6446 * is ambigious as to which NID is which; testing on laptops which
6447 * make this output available should provide clarification.
6449 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6450 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6452 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6453 * this output to turn on an external amplifier.
6455 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6456 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6460 static struct hda_verb alc260_test_init_verbs[] = {
6461 /* Enable all GPIOs as outputs with an initial value of 0 */
6462 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6463 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6464 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6466 /* Enable retasking pins as output, initially without power amp */
6467 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6468 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6471 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6474 /* Disable digital (SPDIF) pins initially, but users can enable
6475 * them via a mixer switch. In the case of SPDIF-out, this initverb
6476 * payload also sets the generation to 0, output to be in "consumer"
6477 * PCM format, copyright asserted, no pre-emphasis and no validity
6480 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6481 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6483 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6484 * OUT1 sum bus when acting as an output.
6486 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6487 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6488 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6489 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6491 /* Start with output sum widgets muted and their output gains at min */
6492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6499 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6500 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6502 /* Unmute retasking pin widget output buffers since the default
6503 * state appears to be output. As the pin mode is changed by the
6504 * user the pin mode control will take care of enabling the pin's
6505 * input/output buffers as needed.
6507 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6508 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6511 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6512 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6513 /* Also unmute the mono-out pin widget */
6514 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6516 /* Mute capture amp left and right */
6517 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6518 /* Set ADC connection select to match default mixer setting (mic1
6521 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6523 /* Do the same for the second ADC: mute capture input amp and
6524 * set ADC connection to mic1 pin
6526 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6527 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6529 /* Mute all inputs to mixer widget (even unconnected ones) */
6530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6536 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6537 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6543 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6544 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6546 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6547 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6550 * for BIOS auto-configuration
6553 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6554 const char *pfx, int *vol_bits)
6557 unsigned long vol_val, sw_val;
6560 if (nid >= 0x0f && nid < 0x11) {
6561 nid_vol = nid - 0x7;
6562 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6563 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6564 } else if (nid == 0x11) {
6565 nid_vol = nid - 0x7;
6566 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6567 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6568 } else if (nid >= 0x12 && nid <= 0x15) {
6570 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6571 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6575 if (!(*vol_bits & (1 << nid_vol))) {
6576 /* first control for the volume widget */
6577 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6580 *vol_bits |= (1 << nid_vol);
6582 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6588 /* add playback controls from the parsed DAC table */
6589 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6590 const struct auto_pin_cfg *cfg)
6596 spec->multiout.num_dacs = 1;
6597 spec->multiout.dac_nids = spec->private_dac_nids;
6598 spec->multiout.dac_nids[0] = 0x02;
6600 nid = cfg->line_out_pins[0];
6603 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6605 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6609 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6614 nid = cfg->speaker_pins[0];
6616 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6621 nid = cfg->hp_pins[0];
6623 err = alc260_add_playback_controls(spec, nid, "Headphone",
6631 /* create playback/capture controls for input pins */
6632 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6633 const struct auto_pin_cfg *cfg)
6635 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6638 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6639 hda_nid_t nid, int pin_type,
6642 alc_set_pin_output(codec, nid, pin_type);
6643 /* need the manual connection? */
6645 int idx = nid - 0x12;
6646 snd_hda_codec_write(codec, idx + 0x0b, 0,
6647 AC_VERB_SET_CONNECT_SEL, sel_idx);
6651 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6653 struct alc_spec *spec = codec->spec;
6656 nid = spec->autocfg.line_out_pins[0];
6658 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6659 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6662 nid = spec->autocfg.speaker_pins[0];
6664 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6666 nid = spec->autocfg.hp_pins[0];
6668 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6671 #define ALC260_PIN_CD_NID 0x16
6672 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6674 struct alc_spec *spec = codec->spec;
6677 for (i = 0; i < AUTO_PIN_LAST; i++) {
6678 hda_nid_t nid = spec->autocfg.input_pins[i];
6680 alc_set_input_pin(codec, nid, i);
6681 if (nid != ALC260_PIN_CD_NID &&
6682 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6683 snd_hda_codec_write(codec, nid, 0,
6684 AC_VERB_SET_AMP_GAIN_MUTE,
6690 #define alc260_auto_init_input_src alc880_auto_init_input_src
6693 * generic initialization of ADC, input mixers and output mixers
6695 static struct hda_verb alc260_volume_init_verbs[] = {
6697 * Unmute ADC0-1 and set the default input to mic-in
6699 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6700 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6701 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6702 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6704 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6706 * Note: PASD motherboards uses the Line In 2 as the input for
6707 * front panel mic (mic 2)
6709 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6710 /* mute analog inputs */
6711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6718 * Set up output mixers (0x08 - 0x0a)
6720 /* set vol=0 to output mixers */
6721 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6722 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6723 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6724 /* set up input amps for analog loopback */
6725 /* Amp Indices: DAC = 0, mixer = 1 */
6726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6727 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6728 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6730 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6731 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6736 static int alc260_parse_auto_config(struct hda_codec *codec)
6738 struct alc_spec *spec = codec->spec;
6740 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6742 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6746 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6749 if (!spec->kctls.list)
6750 return 0; /* can't find valid BIOS pin config */
6751 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6755 spec->multiout.max_channels = 2;
6757 if (spec->autocfg.dig_outs)
6758 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6759 if (spec->kctls.list)
6760 add_mixer(spec, spec->kctls.list);
6762 add_verb(spec, alc260_volume_init_verbs);
6764 spec->num_mux_defs = 1;
6765 spec->input_mux = &spec->private_imux[0];
6767 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6772 /* additional initialization for auto-configuration model */
6773 static void alc260_auto_init(struct hda_codec *codec)
6775 struct alc_spec *spec = codec->spec;
6776 alc260_auto_init_multi_out(codec);
6777 alc260_auto_init_analog_input(codec);
6778 alc260_auto_init_input_src(codec);
6779 alc_auto_init_digital(codec);
6780 if (spec->unsol_event)
6781 alc_inithook(codec);
6784 #ifdef CONFIG_SND_HDA_POWER_SAVE
6785 static struct hda_amp_list alc260_loopbacks[] = {
6786 { 0x07, HDA_INPUT, 0 },
6787 { 0x07, HDA_INPUT, 1 },
6788 { 0x07, HDA_INPUT, 2 },
6789 { 0x07, HDA_INPUT, 3 },
6790 { 0x07, HDA_INPUT, 4 },
6802 static const struct alc_fixup alc260_fixups[] = {
6803 [PINFIX_HP_DC5750] = {
6804 .pins = (const struct alc_pincfg[]) {
6805 { 0x11, 0x90130110 }, /* speaker */
6811 static struct snd_pci_quirk alc260_fixup_tbl[] = {
6812 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
6817 * ALC260 configurations
6819 static const char *alc260_models[ALC260_MODEL_LAST] = {
6820 [ALC260_BASIC] = "basic",
6822 [ALC260_HP_3013] = "hp-3013",
6823 [ALC260_HP_DC7600] = "hp-dc7600",
6824 [ALC260_FUJITSU_S702X] = "fujitsu",
6825 [ALC260_ACER] = "acer",
6826 [ALC260_WILL] = "will",
6827 [ALC260_REPLACER_672V] = "replacer",
6828 [ALC260_FAVORIT100] = "favorit100",
6829 #ifdef CONFIG_SND_DEBUG
6830 [ALC260_TEST] = "test",
6832 [ALC260_AUTO] = "auto",
6835 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6836 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6837 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6838 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6839 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6840 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6841 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6842 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6843 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6844 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6845 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6846 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6847 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6848 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6849 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6850 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6851 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6852 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6853 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6854 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6855 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6859 static struct alc_config_preset alc260_presets[] = {
6861 .mixers = { alc260_base_output_mixer,
6862 alc260_input_mixer },
6863 .init_verbs = { alc260_init_verbs },
6864 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6865 .dac_nids = alc260_dac_nids,
6866 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6867 .adc_nids = alc260_dual_adc_nids,
6868 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6869 .channel_mode = alc260_modes,
6870 .input_mux = &alc260_capture_source,
6873 .mixers = { alc260_hp_output_mixer,
6874 alc260_input_mixer },
6875 .init_verbs = { alc260_init_verbs,
6876 alc260_hp_unsol_verbs },
6877 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6878 .dac_nids = alc260_dac_nids,
6879 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6880 .adc_nids = alc260_adc_nids_alt,
6881 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6882 .channel_mode = alc260_modes,
6883 .input_mux = &alc260_capture_source,
6884 .unsol_event = alc260_hp_unsol_event,
6885 .init_hook = alc260_hp_automute,
6887 [ALC260_HP_DC7600] = {
6888 .mixers = { alc260_hp_dc7600_mixer,
6889 alc260_input_mixer },
6890 .init_verbs = { alc260_init_verbs,
6891 alc260_hp_dc7600_verbs },
6892 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6893 .dac_nids = alc260_dac_nids,
6894 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6895 .adc_nids = alc260_adc_nids_alt,
6896 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6897 .channel_mode = alc260_modes,
6898 .input_mux = &alc260_capture_source,
6899 .unsol_event = alc260_hp_3012_unsol_event,
6900 .init_hook = alc260_hp_3012_automute,
6902 [ALC260_HP_3013] = {
6903 .mixers = { alc260_hp_3013_mixer,
6904 alc260_input_mixer },
6905 .init_verbs = { alc260_hp_3013_init_verbs,
6906 alc260_hp_3013_unsol_verbs },
6907 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6908 .dac_nids = alc260_dac_nids,
6909 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6910 .adc_nids = alc260_adc_nids_alt,
6911 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6912 .channel_mode = alc260_modes,
6913 .input_mux = &alc260_capture_source,
6914 .unsol_event = alc260_hp_3013_unsol_event,
6915 .init_hook = alc260_hp_3013_automute,
6917 [ALC260_FUJITSU_S702X] = {
6918 .mixers = { alc260_fujitsu_mixer },
6919 .init_verbs = { alc260_fujitsu_init_verbs },
6920 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6921 .dac_nids = alc260_dac_nids,
6922 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6923 .adc_nids = alc260_dual_adc_nids,
6924 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6925 .channel_mode = alc260_modes,
6926 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6927 .input_mux = alc260_fujitsu_capture_sources,
6930 .mixers = { alc260_acer_mixer },
6931 .init_verbs = { alc260_acer_init_verbs },
6932 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6933 .dac_nids = alc260_dac_nids,
6934 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6935 .adc_nids = alc260_dual_adc_nids,
6936 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6937 .channel_mode = alc260_modes,
6938 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6939 .input_mux = alc260_acer_capture_sources,
6941 [ALC260_FAVORIT100] = {
6942 .mixers = { alc260_favorit100_mixer },
6943 .init_verbs = { alc260_favorit100_init_verbs },
6944 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6945 .dac_nids = alc260_dac_nids,
6946 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6947 .adc_nids = alc260_dual_adc_nids,
6948 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6949 .channel_mode = alc260_modes,
6950 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6951 .input_mux = alc260_favorit100_capture_sources,
6954 .mixers = { alc260_will_mixer },
6955 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6956 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6957 .dac_nids = alc260_dac_nids,
6958 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6959 .adc_nids = alc260_adc_nids,
6960 .dig_out_nid = ALC260_DIGOUT_NID,
6961 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6962 .channel_mode = alc260_modes,
6963 .input_mux = &alc260_capture_source,
6965 [ALC260_REPLACER_672V] = {
6966 .mixers = { alc260_replacer_672v_mixer },
6967 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6968 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6969 .dac_nids = alc260_dac_nids,
6970 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6971 .adc_nids = alc260_adc_nids,
6972 .dig_out_nid = ALC260_DIGOUT_NID,
6973 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6974 .channel_mode = alc260_modes,
6975 .input_mux = &alc260_capture_source,
6976 .unsol_event = alc260_replacer_672v_unsol_event,
6977 .init_hook = alc260_replacer_672v_automute,
6979 #ifdef CONFIG_SND_DEBUG
6981 .mixers = { alc260_test_mixer },
6982 .init_verbs = { alc260_test_init_verbs },
6983 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6984 .dac_nids = alc260_test_dac_nids,
6985 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6986 .adc_nids = alc260_test_adc_nids,
6987 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6988 .channel_mode = alc260_modes,
6989 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6990 .input_mux = alc260_test_capture_sources,
6995 static int patch_alc260(struct hda_codec *codec)
6997 struct alc_spec *spec;
6998 int err, board_config;
7000 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7006 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7009 if (board_config < 0) {
7010 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7012 board_config = ALC260_AUTO;
7015 if (board_config == ALC260_AUTO)
7016 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7018 if (board_config == ALC260_AUTO) {
7019 /* automatic parse from the BIOS config */
7020 err = alc260_parse_auto_config(codec);
7026 "hda_codec: Cannot set up configuration "
7027 "from BIOS. Using base mode...\n");
7028 board_config = ALC260_BASIC;
7032 err = snd_hda_attach_beep_device(codec, 0x1);
7038 if (board_config != ALC260_AUTO)
7039 setup_preset(codec, &alc260_presets[board_config]);
7041 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7042 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7043 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7045 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7046 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7048 if (!spec->adc_nids && spec->input_mux) {
7049 /* check whether NID 0x04 is valid */
7050 unsigned int wcap = get_wcaps(codec, 0x04);
7051 wcap = get_wcaps_type(wcap);
7053 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7054 spec->adc_nids = alc260_adc_nids_alt;
7055 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7057 spec->adc_nids = alc260_adc_nids;
7058 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7061 set_capture_mixer(codec);
7062 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7064 if (board_config == ALC260_AUTO)
7065 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7067 spec->vmaster_nid = 0x08;
7069 codec->patch_ops = alc_patch_ops;
7070 if (board_config == ALC260_AUTO)
7071 spec->init_hook = alc260_auto_init;
7072 #ifdef CONFIG_SND_HDA_POWER_SAVE
7073 if (!spec->loopback.amplist)
7074 spec->loopback.amplist = alc260_loopbacks;
7082 * ALC882/883/885/888/889 support
7084 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7085 * configuration. Each pin widget can choose any input DACs and a mixer.
7086 * Each ADC is connected from a mixer of all inputs. This makes possible
7087 * 6-channel independent captures.
7089 * In addition, an independent DAC for the multi-playback (not used in this
7092 #define ALC882_DIGOUT_NID 0x06
7093 #define ALC882_DIGIN_NID 0x0a
7094 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7095 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7096 #define ALC1200_DIGOUT_NID 0x10
7099 static struct hda_channel_mode alc882_ch_modes[1] = {
7104 static hda_nid_t alc882_dac_nids[4] = {
7105 /* front, rear, clfe, rear_surr */
7106 0x02, 0x03, 0x04, 0x05
7108 #define alc883_dac_nids alc882_dac_nids
7111 #define alc882_adc_nids alc880_adc_nids
7112 #define alc882_adc_nids_alt alc880_adc_nids_alt
7113 #define alc883_adc_nids alc882_adc_nids_alt
7114 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7115 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7116 #define alc889_adc_nids alc880_adc_nids
7118 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7119 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7120 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7121 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7122 #define alc889_capsrc_nids alc882_capsrc_nids
7125 /* FIXME: should be a matrix-type input source selection */
7127 static struct hda_input_mux alc882_capture_source = {
7131 { "Front Mic", 0x1 },
7137 #define alc883_capture_source alc882_capture_source
7139 static struct hda_input_mux alc889_capture_source = {
7142 { "Front Mic", 0x0 },
7148 static struct hda_input_mux mb5_capture_source = {
7157 static struct hda_input_mux macmini3_capture_source = {
7165 static struct hda_input_mux alc883_3stack_6ch_intel = {
7169 { "Front Mic", 0x0 },
7175 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7183 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7193 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7201 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7205 { "Front Mic", 0x1 },
7210 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7218 static struct hda_input_mux alc889A_mb31_capture_source = {
7222 /* Front Mic (0x01) unused */
7224 /* Line 2 (0x03) unused */
7225 /* CD (0x04) unused? */
7229 static struct hda_input_mux alc889A_imac91_capture_source = {
7233 { "Line", 0x2 }, /* Not sure! */
7240 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7247 static struct hda_verb alc882_3ST_ch2_init[] = {
7248 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7249 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7250 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7251 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7258 static struct hda_verb alc882_3ST_ch4_init[] = {
7259 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7260 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7261 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7262 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7263 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7270 static struct hda_verb alc882_3ST_ch6_init[] = {
7271 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7272 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7273 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7274 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7275 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7276 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7280 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7281 { 2, alc882_3ST_ch2_init },
7282 { 4, alc882_3ST_ch4_init },
7283 { 6, alc882_3ST_ch6_init },
7286 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7291 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7292 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7293 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7294 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7295 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7296 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7303 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7304 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7305 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7306 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7307 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7308 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7309 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7316 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7317 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7318 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7319 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7320 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7321 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7322 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7323 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7327 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7328 { 2, alc883_3ST_ch2_clevo_init },
7329 { 4, alc883_3ST_ch4_clevo_init },
7330 { 6, alc883_3ST_ch6_clevo_init },
7337 static struct hda_verb alc882_sixstack_ch6_init[] = {
7338 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7339 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7340 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7341 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7348 static struct hda_verb alc882_sixstack_ch8_init[] = {
7349 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7350 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7351 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7352 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7356 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7357 { 6, alc882_sixstack_ch6_init },
7358 { 8, alc882_sixstack_ch8_init },
7362 /* Macbook Air 2,1 */
7364 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7369 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7375 static struct hda_verb alc885_mbp_ch2_init[] = {
7376 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7377 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7378 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7385 static struct hda_verb alc885_mbp_ch4_init[] = {
7386 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7387 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7388 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7389 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7390 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7394 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7395 { 2, alc885_mbp_ch2_init },
7396 { 4, alc885_mbp_ch4_init },
7401 * Speakers/Woofer/HP = Front
7404 static struct hda_verb alc885_mb5_ch2_init[] = {
7405 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7406 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7412 * Speakers/HP = Front
7416 static struct hda_verb alc885_mb5_ch6_init[] = {
7417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7419 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7423 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7424 { 2, alc885_mb5_ch2_init },
7425 { 6, alc885_mb5_ch6_init },
7428 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7433 static struct hda_verb alc883_4ST_ch2_init[] = {
7434 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7435 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7436 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7437 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7438 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7439 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7446 static struct hda_verb alc883_4ST_ch4_init[] = {
7447 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7448 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7451 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7452 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7453 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7460 static struct hda_verb alc883_4ST_ch6_init[] = {
7461 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7462 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7463 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7464 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7465 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7466 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7467 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7468 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7475 static struct hda_verb alc883_4ST_ch8_init[] = {
7476 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7477 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7478 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7479 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7480 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7481 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7482 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7483 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7484 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7488 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7489 { 2, alc883_4ST_ch2_init },
7490 { 4, alc883_4ST_ch4_init },
7491 { 6, alc883_4ST_ch6_init },
7492 { 8, alc883_4ST_ch8_init },
7499 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7500 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7501 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7502 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7503 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7510 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7511 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7512 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7513 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7514 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7515 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7522 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7523 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7524 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7525 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7526 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7527 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7528 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7532 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7533 { 2, alc883_3ST_ch2_intel_init },
7534 { 4, alc883_3ST_ch4_intel_init },
7535 { 6, alc883_3ST_ch6_intel_init },
7541 static struct hda_verb alc889_ch2_intel_init[] = {
7542 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7543 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7544 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7545 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7546 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7547 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7554 static struct hda_verb alc889_ch6_intel_init[] = {
7555 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7556 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7557 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7558 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7559 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7560 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7567 static struct hda_verb alc889_ch8_intel_init[] = {
7568 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7569 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7570 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7571 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7572 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7573 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7574 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7578 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7579 { 2, alc889_ch2_intel_init },
7580 { 6, alc889_ch6_intel_init },
7581 { 8, alc889_ch8_intel_init },
7587 static struct hda_verb alc883_sixstack_ch6_init[] = {
7588 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7589 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7590 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7591 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7598 static struct hda_verb alc883_sixstack_ch8_init[] = {
7599 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7600 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7601 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7602 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7606 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7607 { 6, alc883_sixstack_ch6_init },
7608 { 8, alc883_sixstack_ch8_init },
7612 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7613 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7615 static struct snd_kcontrol_new alc882_base_mixer[] = {
7616 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7617 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7618 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7619 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7620 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7621 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7622 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7623 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7624 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7625 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7627 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7628 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7630 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7632 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7634 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7635 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7636 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7640 /* Macbook Air 2,1 same control for HP and internal Speaker */
7642 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7643 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7644 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7649 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7650 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7651 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7652 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7653 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7654 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7656 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7658 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7659 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7660 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7664 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7665 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7666 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7667 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7668 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7669 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7670 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7672 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7673 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7674 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7676 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7677 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7678 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7682 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7683 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7684 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7686 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7687 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7688 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7690 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7691 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7692 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7693 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7697 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7698 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7699 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7704 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7705 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7706 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7707 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7708 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7709 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7710 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7717 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7718 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7719 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7720 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7721 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7722 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7724 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7727 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7728 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7729 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7730 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7734 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7735 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7737 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7738 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7739 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7741 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7742 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7743 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7744 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7745 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7746 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7747 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7750 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7754 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7755 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7756 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7757 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7758 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7759 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7761 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7763 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7768 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7770 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7771 .name = "Channel Mode",
7772 .info = alc_ch_mode_info,
7773 .get = alc_ch_mode_get,
7774 .put = alc_ch_mode_put,
7779 static struct hda_verb alc882_base_init_verbs[] = {
7780 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7781 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7784 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7785 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7787 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7788 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7790 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7791 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7793 /* Front Pin: output 0 (0x0c) */
7794 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7795 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7796 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7797 /* Rear Pin: output 1 (0x0d) */
7798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7801 /* CLFE Pin: output 2 (0x0e) */
7802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7804 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7805 /* Side Pin: output 3 (0x0f) */
7806 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7808 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7809 /* Mic (rear) pin: input vref at 80% */
7810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7812 /* Front Mic pin: input vref at 80% */
7813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7815 /* Line In pin: input */
7816 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7817 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7818 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7819 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7820 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7821 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7822 /* CD pin widget for input */
7823 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7825 /* FIXME: use matrix-type input source selection */
7826 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7828 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7831 /* ADC2: mute amp left and right */
7832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7833 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7834 /* ADC3: mute amp left and right */
7835 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7836 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7841 static struct hda_verb alc882_adc1_init_verbs[] = {
7842 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7843 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7844 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7847 /* ADC1: mute amp left and right */
7848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7849 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7853 static struct hda_verb alc882_eapd_verbs[] = {
7854 /* change to EAPD mode */
7855 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7856 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7860 static struct hda_verb alc889_eapd_verbs[] = {
7861 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7862 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7866 static struct hda_verb alc_hp15_unsol_verbs[] = {
7867 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7872 static struct hda_verb alc885_init_verbs[] = {
7873 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7884 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7886 /* Front HP Pin: output 0 (0x0c) */
7887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7889 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7890 /* Front Pin: output 0 (0x0c) */
7891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7893 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7894 /* Rear Pin: output 1 (0x0d) */
7895 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7896 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7897 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7898 /* CLFE Pin: output 2 (0x0e) */
7899 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7900 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7901 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7902 /* Side Pin: output 3 (0x0f) */
7903 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7904 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7905 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7906 /* Mic (rear) pin: input vref at 80% */
7907 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7908 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7909 /* Front Mic pin: input vref at 80% */
7910 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7911 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7912 /* Line In pin: input */
7913 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7914 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7916 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7918 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7923 /* ADC2: mute amp left and right */
7924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7925 /* ADC3: mute amp left and right */
7926 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7931 static struct hda_verb alc885_init_input_verbs[] = {
7932 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7933 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7934 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7939 /* Unmute Selector 24h and set the default input to front mic */
7940 static struct hda_verb alc889_init_input_verbs[] = {
7941 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7942 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7947 #define alc883_init_verbs alc882_base_init_verbs
7950 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7951 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7952 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7953 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7954 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7955 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7956 /* FIXME: this looks suspicious...
7957 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7958 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7963 static struct hda_verb alc882_macpro_init_verbs[] = {
7964 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7968 /* Front Pin: output 0 (0x0c) */
7969 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7970 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7971 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7972 /* Front Mic pin: input vref at 80% */
7973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7975 /* Speaker: output */
7976 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7978 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7979 /* Headphone output (output 0 - 0x0c) */
7980 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7981 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7982 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7984 /* FIXME: use matrix-type input source selection */
7985 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7986 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7988 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7989 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7990 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7997 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7998 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7999 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8001 /* ADC1: mute amp left and right */
8002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8003 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8004 /* ADC2: mute amp left and right */
8005 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8006 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8007 /* ADC3: mute amp left and right */
8008 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8009 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8015 static struct hda_verb alc885_mb5_init_verbs[] = {
8017 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8018 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8019 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8020 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8025 /* Surround mixer */
8026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8030 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8036 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8037 /* Front Pin (0x0c) */
8038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8040 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8041 /* LFE Pin (0x0e) */
8042 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8044 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8048 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8049 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8050 /* Front Mic pin: input vref at 80% */
8051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8052 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8054 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8055 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8064 static struct hda_verb alc885_macmini3_init_verbs[] = {
8066 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8067 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8068 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8069 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8071 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8073 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8074 /* Surround mixer */
8075 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8076 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8085 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8086 /* Front Pin (0x0c) */
8087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8088 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8089 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8090 /* LFE Pin (0x0e) */
8091 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8092 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8093 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8097 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8098 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8100 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8101 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8103 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8104 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8105 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8111 static struct hda_verb alc885_mba21_init_verbs[] = {
8112 /*Internal and HP Speaker Mixer*/
8113 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8114 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8116 /*Internal Speaker Pin (0x0c)*/
8117 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8118 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8119 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8120 /* HP Pin: output 0 (0x0e) */
8121 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8122 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8123 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8124 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8125 /* Line in (is hp when jack connected)*/
8126 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8127 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8133 /* Macbook Pro rev3 */
8134 static struct hda_verb alc885_mbp3_init_verbs[] = {
8135 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8140 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8141 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8142 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8147 /* Front Pin: output 0 (0x0c) */
8148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8150 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8151 /* HP Pin: output 0 (0x0e) */
8152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8153 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8155 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8156 /* Mic (rear) pin: input vref at 80% */
8157 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8158 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8159 /* Front Mic pin: input vref at 80% */
8160 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8161 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8162 /* Line In pin: use output 1 when in LineOut mode */
8163 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8164 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8165 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8167 /* FIXME: use matrix-type input source selection */
8168 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8169 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8171 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8173 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8176 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8178 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8181 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8184 /* ADC1: mute amp left and right */
8185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8186 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8187 /* ADC2: mute amp left and right */
8188 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8189 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8190 /* ADC3: mute amp left and right */
8191 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8192 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8198 static struct hda_verb alc885_imac91_init_verbs[] = {
8199 /* Internal Speaker Pin (0x0c) */
8200 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8201 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8202 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8203 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8204 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8205 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8209 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8210 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8214 /* Front Mic pin: input vref at 80% */
8215 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8216 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8218 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8219 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8220 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8221 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8222 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8223 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8224 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8225 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8226 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8227 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8228 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8229 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8230 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8231 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8232 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8235 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8240 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8242 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8243 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8244 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8245 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8246 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8247 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8248 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8252 /* iMac 24 mixer. */
8253 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8254 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8255 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8259 /* iMac 24 init verbs. */
8260 static struct hda_verb alc885_imac24_init_verbs[] = {
8261 /* Internal speakers: output 0 (0x0c) */
8262 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8263 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8264 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8265 /* Internal speakers: output 0 (0x0c) */
8266 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8268 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8269 /* Headphone: output 0 (0x0c) */
8270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8272 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8273 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8274 /* Front Mic: input vref at 80% */
8275 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8276 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8280 /* Toggle speaker-output according to the hp-jack state */
8281 static void alc885_imac24_setup(struct hda_codec *codec)
8283 struct alc_spec *spec = codec->spec;
8285 spec->autocfg.hp_pins[0] = 0x14;
8286 spec->autocfg.speaker_pins[0] = 0x18;
8287 spec->autocfg.speaker_pins[1] = 0x1a;
8290 #define alc885_mb5_setup alc885_imac24_setup
8291 #define alc885_macmini3_setup alc885_imac24_setup
8293 /* Macbook Air 2,1 */
8294 static void alc885_mba21_setup(struct hda_codec *codec)
8296 struct alc_spec *spec = codec->spec;
8298 spec->autocfg.hp_pins[0] = 0x14;
8299 spec->autocfg.speaker_pins[0] = 0x18;
8304 static void alc885_mbp3_setup(struct hda_codec *codec)
8306 struct alc_spec *spec = codec->spec;
8308 spec->autocfg.hp_pins[0] = 0x15;
8309 spec->autocfg.speaker_pins[0] = 0x14;
8312 static void alc885_imac91_setup(struct hda_codec *codec)
8314 struct alc_spec *spec = codec->spec;
8316 spec->autocfg.hp_pins[0] = 0x14;
8317 spec->autocfg.speaker_pins[0] = 0x18;
8318 spec->autocfg.speaker_pins[1] = 0x1a;
8321 static struct hda_verb alc882_targa_verbs[] = {
8322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8326 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8328 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8329 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8330 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8332 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8336 /* toggle speaker-output according to the hp-jack state */
8337 static void alc882_targa_automute(struct hda_codec *codec)
8339 struct alc_spec *spec = codec->spec;
8340 alc_automute_amp(codec);
8341 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8342 spec->jack_present ? 1 : 3);
8345 static void alc882_targa_setup(struct hda_codec *codec)
8347 struct alc_spec *spec = codec->spec;
8349 spec->autocfg.hp_pins[0] = 0x14;
8350 spec->autocfg.speaker_pins[0] = 0x1b;
8353 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8355 if ((res >> 26) == ALC880_HP_EVENT)
8356 alc882_targa_automute(codec);
8359 static struct hda_verb alc882_asus_a7j_verbs[] = {
8360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8367 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8369 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8371 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8372 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8373 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8377 static struct hda_verb alc882_asus_a7m_verbs[] = {
8378 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8381 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8382 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8383 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8385 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8387 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8389 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8390 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8391 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8395 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8397 unsigned int gpiostate, gpiomask, gpiodir;
8399 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8400 AC_VERB_GET_GPIO_DATA, 0);
8403 gpiostate |= (1 << pin);
8405 gpiostate &= ~(1 << pin);
8407 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8408 AC_VERB_GET_GPIO_MASK, 0);
8409 gpiomask |= (1 << pin);
8411 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8412 AC_VERB_GET_GPIO_DIRECTION, 0);
8413 gpiodir |= (1 << pin);
8416 snd_hda_codec_write(codec, codec->afg, 0,
8417 AC_VERB_SET_GPIO_MASK, gpiomask);
8418 snd_hda_codec_write(codec, codec->afg, 0,
8419 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8423 snd_hda_codec_write(codec, codec->afg, 0,
8424 AC_VERB_SET_GPIO_DATA, gpiostate);
8427 /* set up GPIO at initialization */
8428 static void alc885_macpro_init_hook(struct hda_codec *codec)
8430 alc882_gpio_mute(codec, 0, 0);
8431 alc882_gpio_mute(codec, 1, 0);
8434 /* set up GPIO and update auto-muting at initialization */
8435 static void alc885_imac24_init_hook(struct hda_codec *codec)
8437 alc885_macpro_init_hook(codec);
8438 alc_automute_amp(codec);
8442 * generic initialization of ADC, input mixers and output mixers
8444 static struct hda_verb alc883_auto_init_verbs[] = {
8446 * Unmute ADC0-2 and set the default input to mic-in
8448 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8450 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8454 * Set up output mixers (0x0c - 0x0f)
8456 /* set vol=0 to output mixers */
8457 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8460 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8461 /* set up input amps for analog loopback */
8462 /* Amp Indices: DAC = 0, mixer = 1 */
8463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8469 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8471 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8472 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8474 /* FIXME: use matrix-type input source selection */
8475 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8483 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8484 static struct hda_verb alc889A_mb31_ch2_init[] = {
8485 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8486 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8487 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8488 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8492 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8493 static struct hda_verb alc889A_mb31_ch4_init[] = {
8494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8495 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8496 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8497 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8501 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8502 static struct hda_verb alc889A_mb31_ch5_init[] = {
8503 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8504 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8510 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8511 static struct hda_verb alc889A_mb31_ch6_init[] = {
8512 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8513 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8519 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8520 { 2, alc889A_mb31_ch2_init },
8521 { 4, alc889A_mb31_ch4_init },
8522 { 5, alc889A_mb31_ch5_init },
8523 { 6, alc889A_mb31_ch6_init },
8526 static struct hda_verb alc883_medion_eapd_verbs[] = {
8527 /* eanable EAPD on medion laptop */
8528 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8529 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8533 #define alc883_base_mixer alc882_base_mixer
8535 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8536 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8537 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8538 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8539 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8540 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8541 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8544 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8545 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8546 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8547 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8552 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8553 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8554 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8556 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8557 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8558 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8559 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8560 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8561 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8562 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8566 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8567 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8568 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8569 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8570 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, 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("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8575 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8576 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8580 static struct snd_kcontrol_new alc883_3ST_2ch_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_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8584 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8585 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8586 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8587 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8589 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8591 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8592 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8593 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8597 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8598 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8599 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8600 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8601 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8602 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8603 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8604 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8605 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8606 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8607 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8608 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8609 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8610 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8611 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8612 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8614 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8615 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8620 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8622 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8623 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8624 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8625 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8627 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8628 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8629 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8630 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8631 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8632 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8633 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8634 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8636 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8638 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8639 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8640 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8644 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8645 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8646 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8647 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8648 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8649 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8651 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8652 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8653 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8654 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8655 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8656 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8657 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8658 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8660 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8661 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8662 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8663 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8664 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8668 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8669 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8670 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8671 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8672 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8673 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8674 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8675 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8676 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8680 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8681 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8685 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8686 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8687 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8691 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8692 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8693 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8694 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8695 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8696 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8697 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8698 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8699 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8700 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8701 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8702 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8703 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8707 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8712 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8713 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8716 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8717 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8718 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8720 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8721 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8722 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8723 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8724 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8728 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8729 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8730 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8731 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8732 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8733 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8737 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8738 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8739 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8740 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8741 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8742 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8744 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8745 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8749 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8750 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8751 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8753 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8754 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8756 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8757 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8758 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8762 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8763 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8764 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8765 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8766 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8767 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8769 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8775 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8776 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8777 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8778 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8780 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8781 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8785 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8786 /* Unmute front mixer */
8787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8790 /* Set speaker pin to front mixer */
8791 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 /* Init headphone pin */
8794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8796 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8797 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8802 /* toggle speaker-output according to the hp-jack state */
8803 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8805 struct alc_spec *spec = codec->spec;
8807 spec->autocfg.hp_pins[0] = 0x1a;
8808 spec->autocfg.speaker_pins[0] = 0x15;
8811 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8812 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8813 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8815 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8816 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8818 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8823 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8824 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8825 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8826 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8827 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8828 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8829 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8830 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8831 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8836 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8837 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8838 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8839 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8840 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8841 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8842 0x0d, 1, 0x0, HDA_OUTPUT),
8843 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8844 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8845 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8846 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8847 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8848 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8849 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8853 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8855 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8856 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8857 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8861 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8864 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8866 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8867 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8869 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8870 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8871 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8872 /* Output switches */
8873 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8874 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8875 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8878 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8882 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8883 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8887 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8888 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8889 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8890 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8897 static struct hda_bind_ctls alc883_bind_cap_vol = {
8898 .ops = &snd_hda_bind_vol,
8900 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8901 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8906 static struct hda_bind_ctls alc883_bind_cap_switch = {
8907 .ops = &snd_hda_bind_sw,
8909 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8910 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8915 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8916 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8917 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8919 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8920 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8921 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8922 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8923 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8927 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8928 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8929 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8932 /* .name = "Capture Source", */
8933 .name = "Input Source",
8935 .info = alc_mux_enum_info,
8936 .get = alc_mux_enum_get,
8937 .put = alc_mux_enum_put,
8942 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8944 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8945 .name = "Channel Mode",
8946 .info = alc_ch_mode_info,
8947 .get = alc_ch_mode_get,
8948 .put = alc_ch_mode_put,
8953 /* toggle speaker-output according to the hp-jack state */
8954 static void alc883_mitac_setup(struct hda_codec *codec)
8956 struct alc_spec *spec = codec->spec;
8958 spec->autocfg.hp_pins[0] = 0x15;
8959 spec->autocfg.speaker_pins[0] = 0x14;
8960 spec->autocfg.speaker_pins[1] = 0x17;
8963 /* auto-toggle front mic */
8965 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8967 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8969 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8973 static struct hda_verb alc883_mitac_verbs[] = {
8975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8978 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8979 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8981 /* enable unsolicited event */
8982 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8983 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8988 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8990 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8993 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8995 /* enable unsolicited event */
8997 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8998 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9004 static struct hda_verb alc883_clevo_m720_verbs[] = {
9006 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9009 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9010 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9012 /* enable unsolicited event */
9013 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9014 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9019 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9021 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9024 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9027 /* enable unsolicited event */
9028 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9033 static struct hda_verb alc883_targa_verbs[] = {
9034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9038 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9040 /* Connect Line-Out side jack (SPDIF) to Side */
9041 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9042 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9043 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9044 /* Connect Mic jack to CLFE */
9045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9046 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9047 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9048 /* Connect Line-in jack to Surround */
9049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9050 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9051 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9052 /* Connect HP out jack to Front */
9053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9054 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9055 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9057 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9062 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9063 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9064 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9065 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9069 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9070 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9072 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9073 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9077 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9080 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9081 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9086 static struct hda_verb alc883_haier_w66_verbs[] = {
9087 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9090 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9092 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9093 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9094 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9095 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9099 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9102 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9104 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9105 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9106 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9107 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9111 static struct hda_verb alc888_6st_dell_verbs[] = {
9112 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9116 static struct hda_verb alc883_vaiott_verbs[] = {
9118 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9121 /* enable unsolicited event */
9122 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9127 static void alc888_3st_hp_setup(struct hda_codec *codec)
9129 struct alc_spec *spec = codec->spec;
9131 spec->autocfg.hp_pins[0] = 0x1b;
9132 spec->autocfg.speaker_pins[0] = 0x14;
9133 spec->autocfg.speaker_pins[1] = 0x16;
9134 spec->autocfg.speaker_pins[2] = 0x18;
9137 static struct hda_verb alc888_3st_hp_verbs[] = {
9138 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9139 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9140 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9141 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9148 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9149 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9150 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9151 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9152 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9159 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9160 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9161 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9162 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9163 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9164 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9171 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9172 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9173 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9174 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9175 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9176 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9177 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9181 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9182 { 2, alc888_3st_hp_2ch_init },
9183 { 4, alc888_3st_hp_4ch_init },
9184 { 6, alc888_3st_hp_6ch_init },
9187 /* toggle front-jack and RCA according to the hp-jack state */
9188 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9190 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9192 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9193 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9194 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9195 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9198 /* toggle RCA according to the front-jack state */
9199 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9201 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9203 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9204 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9207 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9210 if ((res >> 26) == ALC880_HP_EVENT)
9211 alc888_lenovo_ms7195_front_automute(codec);
9212 if ((res >> 26) == ALC880_FRONT_EVENT)
9213 alc888_lenovo_ms7195_rca_automute(codec);
9216 static struct hda_verb alc883_medion_md2_verbs[] = {
9217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9222 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9226 /* toggle speaker-output according to the hp-jack state */
9227 static void alc883_medion_md2_setup(struct hda_codec *codec)
9229 struct alc_spec *spec = codec->spec;
9231 spec->autocfg.hp_pins[0] = 0x14;
9232 spec->autocfg.speaker_pins[0] = 0x15;
9235 /* toggle speaker-output according to the hp-jack state */
9236 #define alc883_targa_init_hook alc882_targa_init_hook
9237 #define alc883_targa_unsol_event alc882_targa_unsol_event
9239 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9241 unsigned int present;
9243 present = snd_hda_jack_detect(codec, 0x18);
9244 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9245 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9248 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9250 struct alc_spec *spec = codec->spec;
9252 spec->autocfg.hp_pins[0] = 0x15;
9253 spec->autocfg.speaker_pins[0] = 0x14;
9256 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9258 alc_automute_amp(codec);
9259 alc883_clevo_m720_mic_automute(codec);
9262 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9265 switch (res >> 26) {
9266 case ALC880_MIC_EVENT:
9267 alc883_clevo_m720_mic_automute(codec);
9270 alc_automute_amp_unsol_event(codec, res);
9275 /* toggle speaker-output according to the hp-jack state */
9276 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9278 struct alc_spec *spec = codec->spec;
9280 spec->autocfg.hp_pins[0] = 0x14;
9281 spec->autocfg.speaker_pins[0] = 0x15;
9284 static void alc883_haier_w66_setup(struct hda_codec *codec)
9286 struct alc_spec *spec = codec->spec;
9288 spec->autocfg.hp_pins[0] = 0x1b;
9289 spec->autocfg.speaker_pins[0] = 0x14;
9292 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9294 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9296 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9297 HDA_AMP_MUTE, bits);
9300 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9302 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9304 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9305 HDA_AMP_MUTE, bits);
9306 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9307 HDA_AMP_MUTE, bits);
9310 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9313 if ((res >> 26) == ALC880_HP_EVENT)
9314 alc883_lenovo_101e_all_automute(codec);
9315 if ((res >> 26) == ALC880_FRONT_EVENT)
9316 alc883_lenovo_101e_ispeaker_automute(codec);
9319 /* toggle speaker-output according to the hp-jack state */
9320 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9322 struct alc_spec *spec = codec->spec;
9324 spec->autocfg.hp_pins[0] = 0x14;
9325 spec->autocfg.speaker_pins[0] = 0x15;
9326 spec->autocfg.speaker_pins[1] = 0x16;
9329 static struct hda_verb alc883_acer_eapd_verbs[] = {
9330 /* HP Pin: output 0 (0x0c) */
9331 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9332 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9333 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9334 /* Front Pin: output 0 (0x0c) */
9335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9337 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9338 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9339 /* eanable EAPD on medion laptop */
9340 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9341 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9342 /* enable unsolicited event */
9343 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9347 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9348 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9349 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9350 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9354 static void alc888_6st_dell_setup(struct hda_codec *codec)
9356 struct alc_spec *spec = codec->spec;
9358 spec->autocfg.hp_pins[0] = 0x1b;
9359 spec->autocfg.speaker_pins[0] = 0x14;
9360 spec->autocfg.speaker_pins[1] = 0x15;
9361 spec->autocfg.speaker_pins[2] = 0x16;
9362 spec->autocfg.speaker_pins[3] = 0x17;
9365 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9367 struct alc_spec *spec = codec->spec;
9369 spec->autocfg.hp_pins[0] = 0x1b;
9370 spec->autocfg.speaker_pins[0] = 0x14;
9371 spec->autocfg.speaker_pins[1] = 0x15;
9372 spec->autocfg.speaker_pins[2] = 0x16;
9373 spec->autocfg.speaker_pins[3] = 0x17;
9374 spec->autocfg.speaker_pins[4] = 0x1a;
9377 static void alc883_vaiott_setup(struct hda_codec *codec)
9379 struct alc_spec *spec = codec->spec;
9381 spec->autocfg.hp_pins[0] = 0x15;
9382 spec->autocfg.speaker_pins[0] = 0x14;
9383 spec->autocfg.speaker_pins[1] = 0x17;
9386 static struct hda_verb alc888_asus_m90v_verbs[] = {
9387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9390 /* enable unsolicited event */
9391 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9392 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9396 static void alc883_mode2_setup(struct hda_codec *codec)
9398 struct alc_spec *spec = codec->spec;
9400 spec->autocfg.hp_pins[0] = 0x1b;
9401 spec->autocfg.speaker_pins[0] = 0x14;
9402 spec->autocfg.speaker_pins[1] = 0x15;
9403 spec->autocfg.speaker_pins[2] = 0x16;
9404 spec->ext_mic.pin = 0x18;
9405 spec->int_mic.pin = 0x19;
9406 spec->ext_mic.mux_idx = 0;
9407 spec->int_mic.mux_idx = 1;
9411 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9413 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9416 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9417 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9418 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9419 /* enable unsolicited event */
9420 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9424 static void alc883_eee1601_inithook(struct hda_codec *codec)
9426 struct alc_spec *spec = codec->spec;
9428 spec->autocfg.hp_pins[0] = 0x14;
9429 spec->autocfg.speaker_pins[0] = 0x1b;
9430 alc_automute_pin(codec);
9433 static struct hda_verb alc889A_mb31_verbs[] = {
9434 /* Init rear pin (used as headphone output) */
9435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9436 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9437 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9438 /* Init line pin (used as output in 4ch and 6ch mode) */
9439 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9440 /* Init line 2 pin (used as headphone out by default) */
9441 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9442 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9446 /* Mute speakers according to the headphone jack state */
9447 static void alc889A_mb31_automute(struct hda_codec *codec)
9449 unsigned int present;
9451 /* Mute only in 2ch or 4ch mode */
9452 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9454 present = snd_hda_jack_detect(codec, 0x15);
9455 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9456 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9457 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9458 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9462 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9464 if ((res >> 26) == ALC880_HP_EVENT)
9465 alc889A_mb31_automute(codec);
9469 #ifdef CONFIG_SND_HDA_POWER_SAVE
9470 #define alc882_loopbacks alc880_loopbacks
9473 /* pcm configuration: identical with ALC880 */
9474 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9475 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9476 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9477 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9479 static hda_nid_t alc883_slave_dig_outs[] = {
9480 ALC1200_DIGOUT_NID, 0,
9483 static hda_nid_t alc1200_slave_dig_outs[] = {
9484 ALC883_DIGOUT_NID, 0,
9488 * configuration and preset
9490 static const char *alc882_models[ALC882_MODEL_LAST] = {
9491 [ALC882_3ST_DIG] = "3stack-dig",
9492 [ALC882_6ST_DIG] = "6stack-dig",
9493 [ALC882_ARIMA] = "arima",
9494 [ALC882_W2JC] = "w2jc",
9495 [ALC882_TARGA] = "targa",
9496 [ALC882_ASUS_A7J] = "asus-a7j",
9497 [ALC882_ASUS_A7M] = "asus-a7m",
9498 [ALC885_MACPRO] = "macpro",
9499 [ALC885_MB5] = "mb5",
9500 [ALC885_MACMINI3] = "macmini3",
9501 [ALC885_MBA21] = "mba21",
9502 [ALC885_MBP3] = "mbp3",
9503 [ALC885_IMAC24] = "imac24",
9504 [ALC885_IMAC91] = "imac91",
9505 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9506 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9507 [ALC883_3ST_6ch] = "3stack-6ch",
9508 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9509 [ALC883_TARGA_DIG] = "targa-dig",
9510 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9511 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9512 [ALC883_ACER] = "acer",
9513 [ALC883_ACER_ASPIRE] = "acer-aspire",
9514 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9515 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9516 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9517 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9518 [ALC883_MEDION] = "medion",
9519 [ALC883_MEDION_MD2] = "medion-md2",
9520 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9521 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9522 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9523 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9524 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9525 [ALC888_LENOVO_SKY] = "lenovo-sky",
9526 [ALC883_HAIER_W66] = "haier-w66",
9527 [ALC888_3ST_HP] = "3stack-hp",
9528 [ALC888_6ST_DELL] = "6stack-dell",
9529 [ALC883_MITAC] = "mitac",
9530 [ALC883_CLEVO_M540R] = "clevo-m540r",
9531 [ALC883_CLEVO_M720] = "clevo-m720",
9532 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9533 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9534 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9535 [ALC889A_INTEL] = "intel-alc889a",
9536 [ALC889_INTEL] = "intel-x58",
9537 [ALC1200_ASUS_P5Q] = "asus-p5q",
9538 [ALC889A_MB31] = "mb31",
9539 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9540 [ALC882_AUTO] = "auto",
9543 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9544 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9546 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9547 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9548 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9549 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9550 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9551 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9552 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9553 ALC888_ACER_ASPIRE_4930G),
9554 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9555 ALC888_ACER_ASPIRE_4930G),
9556 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9557 ALC888_ACER_ASPIRE_8930G),
9558 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9559 ALC888_ACER_ASPIRE_8930G),
9560 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9561 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9562 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9563 ALC888_ACER_ASPIRE_6530G),
9564 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9565 ALC888_ACER_ASPIRE_6530G),
9566 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9567 ALC888_ACER_ASPIRE_7730G),
9568 /* default Acer -- disabled as it causes more problems.
9569 * model=auto should work fine now
9571 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9573 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9575 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9576 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9577 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9578 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9579 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9580 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9582 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9583 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9584 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9585 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9586 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9587 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9588 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9589 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9590 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9591 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9592 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9594 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9595 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9596 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9597 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9598 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9599 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9600 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9601 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9602 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9604 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9605 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9606 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9607 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9608 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9609 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9610 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9611 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9612 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9613 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9614 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9615 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9616 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9617 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9618 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9619 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9620 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9621 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9622 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9623 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9624 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9625 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9626 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9627 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9628 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9629 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9630 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9631 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9632 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9633 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9634 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9636 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9637 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9638 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9639 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9640 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9641 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9642 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9643 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9644 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9645 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9646 ALC883_FUJITSU_PI2515),
9647 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9648 ALC888_FUJITSU_XA3530),
9649 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9650 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9651 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9652 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9653 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9654 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9655 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9656 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9657 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9659 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9660 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9661 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9662 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9663 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9664 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9665 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9670 /* codec SSID table for Intel Mac */
9671 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9672 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9673 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9674 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9675 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9676 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9677 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9678 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9679 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9680 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9681 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9682 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9683 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9684 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9685 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9686 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9687 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9688 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9689 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9690 * so apparently no perfect solution yet
9692 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9693 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9694 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9698 static struct alc_config_preset alc882_presets[] = {
9699 [ALC882_3ST_DIG] = {
9700 .mixers = { alc882_base_mixer },
9701 .init_verbs = { alc882_base_init_verbs,
9702 alc882_adc1_init_verbs },
9703 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9704 .dac_nids = alc882_dac_nids,
9705 .dig_out_nid = ALC882_DIGOUT_NID,
9706 .dig_in_nid = ALC882_DIGIN_NID,
9707 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9708 .channel_mode = alc882_ch_modes,
9710 .input_mux = &alc882_capture_source,
9712 [ALC882_6ST_DIG] = {
9713 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9714 .init_verbs = { alc882_base_init_verbs,
9715 alc882_adc1_init_verbs },
9716 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9717 .dac_nids = alc882_dac_nids,
9718 .dig_out_nid = ALC882_DIGOUT_NID,
9719 .dig_in_nid = ALC882_DIGIN_NID,
9720 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9721 .channel_mode = alc882_sixstack_modes,
9722 .input_mux = &alc882_capture_source,
9725 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9726 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9727 alc882_eapd_verbs },
9728 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9729 .dac_nids = alc882_dac_nids,
9730 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9731 .channel_mode = alc882_sixstack_modes,
9732 .input_mux = &alc882_capture_source,
9735 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9736 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9737 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9738 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9739 .dac_nids = alc882_dac_nids,
9740 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9741 .channel_mode = alc880_threestack_modes,
9743 .input_mux = &alc882_capture_source,
9744 .dig_out_nid = ALC882_DIGOUT_NID,
9747 .mixers = { alc885_mba21_mixer },
9748 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9750 .dac_nids = alc882_dac_nids,
9751 .channel_mode = alc885_mba21_ch_modes,
9752 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9753 .input_mux = &alc882_capture_source,
9754 .unsol_event = alc_automute_amp_unsol_event,
9755 .setup = alc885_mba21_setup,
9756 .init_hook = alc_automute_amp,
9759 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9760 .init_verbs = { alc885_mbp3_init_verbs,
9761 alc880_gpio1_init_verbs },
9763 .dac_nids = alc882_dac_nids,
9765 .channel_mode = alc885_mbp_4ch_modes,
9766 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9767 .input_mux = &alc882_capture_source,
9768 .dig_out_nid = ALC882_DIGOUT_NID,
9769 .dig_in_nid = ALC882_DIGIN_NID,
9770 .unsol_event = alc_automute_amp_unsol_event,
9771 .setup = alc885_mbp3_setup,
9772 .init_hook = alc_automute_amp,
9775 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9776 .init_verbs = { alc885_mb5_init_verbs,
9777 alc880_gpio1_init_verbs },
9778 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9779 .dac_nids = alc882_dac_nids,
9780 .channel_mode = alc885_mb5_6ch_modes,
9781 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9782 .input_mux = &mb5_capture_source,
9783 .dig_out_nid = ALC882_DIGOUT_NID,
9784 .dig_in_nid = ALC882_DIGIN_NID,
9785 .unsol_event = alc_automute_amp_unsol_event,
9786 .setup = alc885_mb5_setup,
9787 .init_hook = alc_automute_amp,
9789 [ALC885_MACMINI3] = {
9790 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9791 .init_verbs = { alc885_macmini3_init_verbs,
9792 alc880_gpio1_init_verbs },
9793 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9794 .dac_nids = alc882_dac_nids,
9795 .channel_mode = alc885_macmini3_6ch_modes,
9796 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9797 .input_mux = &macmini3_capture_source,
9798 .dig_out_nid = ALC882_DIGOUT_NID,
9799 .dig_in_nid = ALC882_DIGIN_NID,
9800 .unsol_event = alc_automute_amp_unsol_event,
9801 .setup = alc885_macmini3_setup,
9802 .init_hook = alc_automute_amp,
9805 .mixers = { alc882_macpro_mixer },
9806 .init_verbs = { alc882_macpro_init_verbs },
9807 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9808 .dac_nids = alc882_dac_nids,
9809 .dig_out_nid = ALC882_DIGOUT_NID,
9810 .dig_in_nid = ALC882_DIGIN_NID,
9811 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9812 .channel_mode = alc882_ch_modes,
9813 .input_mux = &alc882_capture_source,
9814 .init_hook = alc885_macpro_init_hook,
9817 .mixers = { alc885_imac24_mixer },
9818 .init_verbs = { alc885_imac24_init_verbs },
9819 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9820 .dac_nids = alc882_dac_nids,
9821 .dig_out_nid = ALC882_DIGOUT_NID,
9822 .dig_in_nid = ALC882_DIGIN_NID,
9823 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9824 .channel_mode = alc882_ch_modes,
9825 .input_mux = &alc882_capture_source,
9826 .unsol_event = alc_automute_amp_unsol_event,
9827 .setup = alc885_imac24_setup,
9828 .init_hook = alc885_imac24_init_hook,
9831 .mixers = {alc885_imac91_mixer},
9832 .init_verbs = { alc885_imac91_init_verbs,
9833 alc880_gpio1_init_verbs },
9834 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9835 .dac_nids = alc882_dac_nids,
9836 .channel_mode = alc885_mba21_ch_modes,
9837 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9838 .input_mux = &alc889A_imac91_capture_source,
9839 .dig_out_nid = ALC882_DIGOUT_NID,
9840 .dig_in_nid = ALC882_DIGIN_NID,
9841 .unsol_event = alc_automute_amp_unsol_event,
9842 .setup = alc885_imac91_setup,
9843 .init_hook = alc_automute_amp,
9846 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9847 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9848 alc880_gpio3_init_verbs, alc882_targa_verbs},
9849 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9850 .dac_nids = alc882_dac_nids,
9851 .dig_out_nid = ALC882_DIGOUT_NID,
9852 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9853 .adc_nids = alc882_adc_nids,
9854 .capsrc_nids = alc882_capsrc_nids,
9855 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9856 .channel_mode = alc882_3ST_6ch_modes,
9858 .input_mux = &alc882_capture_source,
9859 .unsol_event = alc882_targa_unsol_event,
9860 .setup = alc882_targa_setup,
9861 .init_hook = alc882_targa_automute,
9863 [ALC882_ASUS_A7J] = {
9864 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9865 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9866 alc882_asus_a7j_verbs},
9867 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9868 .dac_nids = alc882_dac_nids,
9869 .dig_out_nid = ALC882_DIGOUT_NID,
9870 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9871 .adc_nids = alc882_adc_nids,
9872 .capsrc_nids = alc882_capsrc_nids,
9873 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9874 .channel_mode = alc882_3ST_6ch_modes,
9876 .input_mux = &alc882_capture_source,
9878 [ALC882_ASUS_A7M] = {
9879 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9880 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9881 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9882 alc882_asus_a7m_verbs },
9883 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9884 .dac_nids = alc882_dac_nids,
9885 .dig_out_nid = ALC882_DIGOUT_NID,
9886 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9887 .channel_mode = alc880_threestack_modes,
9889 .input_mux = &alc882_capture_source,
9891 [ALC883_3ST_2ch_DIG] = {
9892 .mixers = { alc883_3ST_2ch_mixer },
9893 .init_verbs = { alc883_init_verbs },
9894 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9895 .dac_nids = alc883_dac_nids,
9896 .dig_out_nid = ALC883_DIGOUT_NID,
9897 .dig_in_nid = ALC883_DIGIN_NID,
9898 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9899 .channel_mode = alc883_3ST_2ch_modes,
9900 .input_mux = &alc883_capture_source,
9902 [ALC883_3ST_6ch_DIG] = {
9903 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9904 .init_verbs = { alc883_init_verbs },
9905 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9906 .dac_nids = alc883_dac_nids,
9907 .dig_out_nid = ALC883_DIGOUT_NID,
9908 .dig_in_nid = ALC883_DIGIN_NID,
9909 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9910 .channel_mode = alc883_3ST_6ch_modes,
9912 .input_mux = &alc883_capture_source,
9914 [ALC883_3ST_6ch] = {
9915 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9916 .init_verbs = { alc883_init_verbs },
9917 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9918 .dac_nids = alc883_dac_nids,
9919 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9920 .channel_mode = alc883_3ST_6ch_modes,
9922 .input_mux = &alc883_capture_source,
9924 [ALC883_3ST_6ch_INTEL] = {
9925 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9926 .init_verbs = { alc883_init_verbs },
9927 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9928 .dac_nids = alc883_dac_nids,
9929 .dig_out_nid = ALC883_DIGOUT_NID,
9930 .dig_in_nid = ALC883_DIGIN_NID,
9931 .slave_dig_outs = alc883_slave_dig_outs,
9932 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9933 .channel_mode = alc883_3ST_6ch_intel_modes,
9935 .input_mux = &alc883_3stack_6ch_intel,
9938 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9939 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9940 alc_hp15_unsol_verbs },
9941 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9942 .dac_nids = alc883_dac_nids,
9943 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9944 .adc_nids = alc889_adc_nids,
9945 .dig_out_nid = ALC883_DIGOUT_NID,
9946 .dig_in_nid = ALC883_DIGIN_NID,
9947 .slave_dig_outs = alc883_slave_dig_outs,
9948 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9949 .channel_mode = alc889_8ch_intel_modes,
9950 .capsrc_nids = alc889_capsrc_nids,
9951 .input_mux = &alc889_capture_source,
9952 .setup = alc889_automute_setup,
9953 .init_hook = alc_automute_amp,
9954 .unsol_event = alc_automute_amp_unsol_event,
9958 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9959 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9960 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9961 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9962 .dac_nids = alc883_dac_nids,
9963 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9964 .adc_nids = alc889_adc_nids,
9965 .dig_out_nid = ALC883_DIGOUT_NID,
9966 .dig_in_nid = ALC883_DIGIN_NID,
9967 .slave_dig_outs = alc883_slave_dig_outs,
9968 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9969 .channel_mode = alc889_8ch_intel_modes,
9970 .capsrc_nids = alc889_capsrc_nids,
9971 .input_mux = &alc889_capture_source,
9972 .setup = alc889_automute_setup,
9973 .init_hook = alc889_intel_init_hook,
9974 .unsol_event = alc_automute_amp_unsol_event,
9977 [ALC883_6ST_DIG] = {
9978 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9979 .init_verbs = { alc883_init_verbs },
9980 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9981 .dac_nids = alc883_dac_nids,
9982 .dig_out_nid = ALC883_DIGOUT_NID,
9983 .dig_in_nid = ALC883_DIGIN_NID,
9984 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9985 .channel_mode = alc883_sixstack_modes,
9986 .input_mux = &alc883_capture_source,
9988 [ALC883_TARGA_DIG] = {
9989 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9990 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9991 alc883_targa_verbs},
9992 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9993 .dac_nids = alc883_dac_nids,
9994 .dig_out_nid = ALC883_DIGOUT_NID,
9995 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9996 .channel_mode = alc883_3ST_6ch_modes,
9998 .input_mux = &alc883_capture_source,
9999 .unsol_event = alc883_targa_unsol_event,
10000 .setup = alc882_targa_setup,
10001 .init_hook = alc882_targa_automute,
10003 [ALC883_TARGA_2ch_DIG] = {
10004 .mixers = { alc883_targa_2ch_mixer},
10005 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10006 alc883_targa_verbs},
10007 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10008 .dac_nids = alc883_dac_nids,
10009 .adc_nids = alc883_adc_nids_alt,
10010 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10011 .capsrc_nids = alc883_capsrc_nids,
10012 .dig_out_nid = ALC883_DIGOUT_NID,
10013 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10014 .channel_mode = alc883_3ST_2ch_modes,
10015 .input_mux = &alc883_capture_source,
10016 .unsol_event = alc883_targa_unsol_event,
10017 .setup = alc882_targa_setup,
10018 .init_hook = alc882_targa_automute,
10020 [ALC883_TARGA_8ch_DIG] = {
10021 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10022 alc883_chmode_mixer },
10023 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10024 alc883_targa_verbs },
10025 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10026 .dac_nids = alc883_dac_nids,
10027 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10028 .adc_nids = alc883_adc_nids_rev,
10029 .capsrc_nids = alc883_capsrc_nids_rev,
10030 .dig_out_nid = ALC883_DIGOUT_NID,
10031 .dig_in_nid = ALC883_DIGIN_NID,
10032 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10033 .channel_mode = alc883_4ST_8ch_modes,
10035 .input_mux = &alc883_capture_source,
10036 .unsol_event = alc883_targa_unsol_event,
10037 .setup = alc882_targa_setup,
10038 .init_hook = alc882_targa_automute,
10041 .mixers = { alc883_base_mixer },
10042 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10043 * and the headphone jack. Turn this on and rely on the
10044 * standard mute methods whenever the user wants to turn
10045 * these outputs off.
10047 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10048 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10049 .dac_nids = alc883_dac_nids,
10050 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10051 .channel_mode = alc883_3ST_2ch_modes,
10052 .input_mux = &alc883_capture_source,
10054 [ALC883_ACER_ASPIRE] = {
10055 .mixers = { alc883_acer_aspire_mixer },
10056 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10057 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10058 .dac_nids = alc883_dac_nids,
10059 .dig_out_nid = ALC883_DIGOUT_NID,
10060 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10061 .channel_mode = alc883_3ST_2ch_modes,
10062 .input_mux = &alc883_capture_source,
10063 .unsol_event = alc_automute_amp_unsol_event,
10064 .setup = alc883_acer_aspire_setup,
10065 .init_hook = alc_automute_amp,
10067 [ALC888_ACER_ASPIRE_4930G] = {
10068 .mixers = { alc888_base_mixer,
10069 alc883_chmode_mixer },
10070 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10071 alc888_acer_aspire_4930g_verbs },
10072 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10073 .dac_nids = alc883_dac_nids,
10074 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10075 .adc_nids = alc883_adc_nids_rev,
10076 .capsrc_nids = alc883_capsrc_nids_rev,
10077 .dig_out_nid = ALC883_DIGOUT_NID,
10078 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10079 .channel_mode = alc883_3ST_6ch_modes,
10081 .const_channel_count = 6,
10083 ARRAY_SIZE(alc888_2_capture_sources),
10084 .input_mux = alc888_2_capture_sources,
10085 .unsol_event = alc_automute_amp_unsol_event,
10086 .setup = alc888_acer_aspire_4930g_setup,
10087 .init_hook = alc_automute_amp,
10089 [ALC888_ACER_ASPIRE_6530G] = {
10090 .mixers = { alc888_acer_aspire_6530_mixer },
10091 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10092 alc888_acer_aspire_6530g_verbs },
10093 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10094 .dac_nids = alc883_dac_nids,
10095 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10096 .adc_nids = alc883_adc_nids_rev,
10097 .capsrc_nids = alc883_capsrc_nids_rev,
10098 .dig_out_nid = ALC883_DIGOUT_NID,
10099 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10100 .channel_mode = alc883_3ST_2ch_modes,
10102 ARRAY_SIZE(alc888_2_capture_sources),
10103 .input_mux = alc888_acer_aspire_6530_sources,
10104 .unsol_event = alc_automute_amp_unsol_event,
10105 .setup = alc888_acer_aspire_6530g_setup,
10106 .init_hook = alc_automute_amp,
10108 [ALC888_ACER_ASPIRE_8930G] = {
10109 .mixers = { alc889_acer_aspire_8930g_mixer,
10110 alc883_chmode_mixer },
10111 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10112 alc889_acer_aspire_8930g_verbs,
10113 alc889_eapd_verbs},
10114 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10115 .dac_nids = alc883_dac_nids,
10116 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10117 .adc_nids = alc889_adc_nids,
10118 .capsrc_nids = alc889_capsrc_nids,
10119 .dig_out_nid = ALC883_DIGOUT_NID,
10120 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10121 .channel_mode = alc883_3ST_6ch_modes,
10123 .const_channel_count = 6,
10125 ARRAY_SIZE(alc889_capture_sources),
10126 .input_mux = alc889_capture_sources,
10127 .unsol_event = alc_automute_amp_unsol_event,
10128 .setup = alc889_acer_aspire_8930g_setup,
10129 .init_hook = alc_automute_amp,
10130 #ifdef CONFIG_SND_HDA_POWER_SAVE
10131 .power_hook = alc_power_eapd,
10134 [ALC888_ACER_ASPIRE_7730G] = {
10135 .mixers = { alc883_3ST_6ch_mixer,
10136 alc883_chmode_mixer },
10137 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10138 alc888_acer_aspire_7730G_verbs },
10139 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10140 .dac_nids = alc883_dac_nids,
10141 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10142 .adc_nids = alc883_adc_nids_rev,
10143 .capsrc_nids = alc883_capsrc_nids_rev,
10144 .dig_out_nid = ALC883_DIGOUT_NID,
10145 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10146 .channel_mode = alc883_3ST_6ch_modes,
10148 .const_channel_count = 6,
10149 .input_mux = &alc883_capture_source,
10150 .unsol_event = alc_automute_amp_unsol_event,
10151 .setup = alc888_acer_aspire_6530g_setup,
10152 .init_hook = alc_automute_amp,
10154 [ALC883_MEDION] = {
10155 .mixers = { alc883_fivestack_mixer,
10156 alc883_chmode_mixer },
10157 .init_verbs = { alc883_init_verbs,
10158 alc883_medion_eapd_verbs },
10159 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10160 .dac_nids = alc883_dac_nids,
10161 .adc_nids = alc883_adc_nids_alt,
10162 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10163 .capsrc_nids = alc883_capsrc_nids,
10164 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10165 .channel_mode = alc883_sixstack_modes,
10166 .input_mux = &alc883_capture_source,
10168 [ALC883_MEDION_MD2] = {
10169 .mixers = { alc883_medion_md2_mixer},
10170 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10171 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10172 .dac_nids = alc883_dac_nids,
10173 .dig_out_nid = ALC883_DIGOUT_NID,
10174 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10175 .channel_mode = alc883_3ST_2ch_modes,
10176 .input_mux = &alc883_capture_source,
10177 .unsol_event = alc_automute_amp_unsol_event,
10178 .setup = alc883_medion_md2_setup,
10179 .init_hook = alc_automute_amp,
10181 [ALC883_MEDION_WIM2160] = {
10182 .mixers = { alc883_medion_wim2160_mixer },
10183 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10184 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10185 .dac_nids = alc883_dac_nids,
10186 .dig_out_nid = ALC883_DIGOUT_NID,
10187 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10188 .adc_nids = alc883_adc_nids,
10189 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10190 .channel_mode = alc883_3ST_2ch_modes,
10191 .input_mux = &alc883_capture_source,
10192 .unsol_event = alc_automute_amp_unsol_event,
10193 .setup = alc883_medion_wim2160_setup,
10194 .init_hook = alc_automute_amp,
10196 [ALC883_LAPTOP_EAPD] = {
10197 .mixers = { alc883_base_mixer },
10198 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10199 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10200 .dac_nids = alc883_dac_nids,
10201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10202 .channel_mode = alc883_3ST_2ch_modes,
10203 .input_mux = &alc883_capture_source,
10205 [ALC883_CLEVO_M540R] = {
10206 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10207 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10208 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10209 .dac_nids = alc883_dac_nids,
10210 .dig_out_nid = ALC883_DIGOUT_NID,
10211 .dig_in_nid = ALC883_DIGIN_NID,
10212 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10213 .channel_mode = alc883_3ST_6ch_clevo_modes,
10215 .input_mux = &alc883_capture_source,
10216 /* This machine has the hardware HP auto-muting, thus
10217 * we need no software mute via unsol event
10220 [ALC883_CLEVO_M720] = {
10221 .mixers = { alc883_clevo_m720_mixer },
10222 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_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_2ch_modes),
10227 .channel_mode = alc883_3ST_2ch_modes,
10228 .input_mux = &alc883_capture_source,
10229 .unsol_event = alc883_clevo_m720_unsol_event,
10230 .setup = alc883_clevo_m720_setup,
10231 .init_hook = alc883_clevo_m720_init_hook,
10233 [ALC883_LENOVO_101E_2ch] = {
10234 .mixers = { alc883_lenovo_101e_2ch_mixer},
10235 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10237 .dac_nids = alc883_dac_nids,
10238 .adc_nids = alc883_adc_nids_alt,
10239 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10240 .capsrc_nids = alc883_capsrc_nids,
10241 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10242 .channel_mode = alc883_3ST_2ch_modes,
10243 .input_mux = &alc883_lenovo_101e_capture_source,
10244 .unsol_event = alc883_lenovo_101e_unsol_event,
10245 .init_hook = alc883_lenovo_101e_all_automute,
10247 [ALC883_LENOVO_NB0763] = {
10248 .mixers = { alc883_lenovo_nb0763_mixer },
10249 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10250 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10251 .dac_nids = alc883_dac_nids,
10252 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10253 .channel_mode = alc883_3ST_2ch_modes,
10255 .input_mux = &alc883_lenovo_nb0763_capture_source,
10256 .unsol_event = alc_automute_amp_unsol_event,
10257 .setup = alc883_medion_md2_setup,
10258 .init_hook = alc_automute_amp,
10260 [ALC888_LENOVO_MS7195_DIG] = {
10261 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10262 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10263 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10264 .dac_nids = alc883_dac_nids,
10265 .dig_out_nid = ALC883_DIGOUT_NID,
10266 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10267 .channel_mode = alc883_3ST_6ch_modes,
10269 .input_mux = &alc883_capture_source,
10270 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10271 .init_hook = alc888_lenovo_ms7195_front_automute,
10273 [ALC883_HAIER_W66] = {
10274 .mixers = { alc883_targa_2ch_mixer},
10275 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10276 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10277 .dac_nids = alc883_dac_nids,
10278 .dig_out_nid = ALC883_DIGOUT_NID,
10279 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10280 .channel_mode = alc883_3ST_2ch_modes,
10281 .input_mux = &alc883_capture_source,
10282 .unsol_event = alc_automute_amp_unsol_event,
10283 .setup = alc883_haier_w66_setup,
10284 .init_hook = alc_automute_amp,
10286 [ALC888_3ST_HP] = {
10287 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10288 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10289 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10290 .dac_nids = alc883_dac_nids,
10291 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10292 .channel_mode = alc888_3st_hp_modes,
10294 .input_mux = &alc883_capture_source,
10295 .unsol_event = alc_automute_amp_unsol_event,
10296 .setup = alc888_3st_hp_setup,
10297 .init_hook = alc_automute_amp,
10299 [ALC888_6ST_DELL] = {
10300 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10301 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10302 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10303 .dac_nids = alc883_dac_nids,
10304 .dig_out_nid = ALC883_DIGOUT_NID,
10305 .dig_in_nid = ALC883_DIGIN_NID,
10306 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10307 .channel_mode = alc883_sixstack_modes,
10308 .input_mux = &alc883_capture_source,
10309 .unsol_event = alc_automute_amp_unsol_event,
10310 .setup = alc888_6st_dell_setup,
10311 .init_hook = alc_automute_amp,
10314 .mixers = { alc883_mitac_mixer },
10315 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10316 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10317 .dac_nids = alc883_dac_nids,
10318 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10319 .channel_mode = alc883_3ST_2ch_modes,
10320 .input_mux = &alc883_capture_source,
10321 .unsol_event = alc_automute_amp_unsol_event,
10322 .setup = alc883_mitac_setup,
10323 .init_hook = alc_automute_amp,
10325 [ALC883_FUJITSU_PI2515] = {
10326 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10327 .init_verbs = { alc883_init_verbs,
10328 alc883_2ch_fujitsu_pi2515_verbs},
10329 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10330 .dac_nids = alc883_dac_nids,
10331 .dig_out_nid = ALC883_DIGOUT_NID,
10332 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10333 .channel_mode = alc883_3ST_2ch_modes,
10334 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10335 .unsol_event = alc_automute_amp_unsol_event,
10336 .setup = alc883_2ch_fujitsu_pi2515_setup,
10337 .init_hook = alc_automute_amp,
10339 [ALC888_FUJITSU_XA3530] = {
10340 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10341 .init_verbs = { alc883_init_verbs,
10342 alc888_fujitsu_xa3530_verbs },
10343 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10344 .dac_nids = alc883_dac_nids,
10345 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10346 .adc_nids = alc883_adc_nids_rev,
10347 .capsrc_nids = alc883_capsrc_nids_rev,
10348 .dig_out_nid = ALC883_DIGOUT_NID,
10349 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10350 .channel_mode = alc888_4ST_8ch_intel_modes,
10352 ARRAY_SIZE(alc888_2_capture_sources),
10353 .input_mux = alc888_2_capture_sources,
10354 .unsol_event = alc_automute_amp_unsol_event,
10355 .setup = alc888_fujitsu_xa3530_setup,
10356 .init_hook = alc_automute_amp,
10358 [ALC888_LENOVO_SKY] = {
10359 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10360 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10361 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10362 .dac_nids = alc883_dac_nids,
10363 .dig_out_nid = ALC883_DIGOUT_NID,
10364 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10365 .channel_mode = alc883_sixstack_modes,
10367 .input_mux = &alc883_lenovo_sky_capture_source,
10368 .unsol_event = alc_automute_amp_unsol_event,
10369 .setup = alc888_lenovo_sky_setup,
10370 .init_hook = alc_automute_amp,
10372 [ALC888_ASUS_M90V] = {
10373 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10374 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10375 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10376 .dac_nids = alc883_dac_nids,
10377 .dig_out_nid = ALC883_DIGOUT_NID,
10378 .dig_in_nid = ALC883_DIGIN_NID,
10379 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10380 .channel_mode = alc883_3ST_6ch_modes,
10382 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10383 .unsol_event = alc_sku_unsol_event,
10384 .setup = alc883_mode2_setup,
10385 .init_hook = alc_inithook,
10387 [ALC888_ASUS_EEE1601] = {
10388 .mixers = { alc883_asus_eee1601_mixer },
10389 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10390 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10391 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10392 .dac_nids = alc883_dac_nids,
10393 .dig_out_nid = ALC883_DIGOUT_NID,
10394 .dig_in_nid = ALC883_DIGIN_NID,
10395 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10396 .channel_mode = alc883_3ST_2ch_modes,
10398 .input_mux = &alc883_asus_eee1601_capture_source,
10399 .unsol_event = alc_sku_unsol_event,
10400 .init_hook = alc883_eee1601_inithook,
10402 [ALC1200_ASUS_P5Q] = {
10403 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10404 .init_verbs = { alc883_init_verbs },
10405 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10406 .dac_nids = alc883_dac_nids,
10407 .dig_out_nid = ALC1200_DIGOUT_NID,
10408 .dig_in_nid = ALC883_DIGIN_NID,
10409 .slave_dig_outs = alc1200_slave_dig_outs,
10410 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10411 .channel_mode = alc883_sixstack_modes,
10412 .input_mux = &alc883_capture_source,
10415 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10416 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10417 alc880_gpio1_init_verbs },
10418 .adc_nids = alc883_adc_nids,
10419 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10420 .capsrc_nids = alc883_capsrc_nids,
10421 .dac_nids = alc883_dac_nids,
10422 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10423 .channel_mode = alc889A_mb31_6ch_modes,
10424 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10425 .input_mux = &alc889A_mb31_capture_source,
10426 .dig_out_nid = ALC883_DIGOUT_NID,
10427 .unsol_event = alc889A_mb31_unsol_event,
10428 .init_hook = alc889A_mb31_automute,
10430 [ALC883_SONY_VAIO_TT] = {
10431 .mixers = { alc883_vaiott_mixer },
10432 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10434 .dac_nids = alc883_dac_nids,
10435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10436 .channel_mode = alc883_3ST_2ch_modes,
10437 .input_mux = &alc883_capture_source,
10438 .unsol_event = alc_automute_amp_unsol_event,
10439 .setup = alc883_vaiott_setup,
10440 .init_hook = alc_automute_amp,
10449 PINFIX_ABIT_AW9D_MAX,
10453 static const struct alc_fixup alc882_fixups[] = {
10454 [PINFIX_ABIT_AW9D_MAX] = {
10455 .pins = (const struct alc_pincfg[]) {
10456 { 0x15, 0x01080104 }, /* side */
10457 { 0x16, 0x01011012 }, /* rear */
10458 { 0x17, 0x01016011 }, /* clfe */
10462 [PINFIX_PB_M5210] = {
10463 .verbs = (const struct hda_verb[]) {
10464 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10470 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10471 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10472 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10477 * BIOS auto configuration
10479 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10480 const struct auto_pin_cfg *cfg)
10482 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10485 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10486 hda_nid_t nid, int pin_type,
10491 /* set as output */
10492 alc_set_pin_output(codec, nid, pin_type);
10496 else if (dac >= 0x02 && dac <= 0x05)
10500 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10503 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10505 struct alc_spec *spec = codec->spec;
10508 for (i = 0; i <= HDA_SIDE; i++) {
10509 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10510 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10512 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10513 spec->multiout.dac_nids[i]);
10517 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10519 struct alc_spec *spec = codec->spec;
10520 hda_nid_t pin, dac;
10522 pin = spec->autocfg.hp_pins[0];
10524 dac = spec->multiout.hp_nid;
10526 dac = spec->multiout.dac_nids[0]; /* to front */
10527 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10529 pin = spec->autocfg.speaker_pins[0];
10531 dac = spec->multiout.extra_out_nid[0];
10533 dac = spec->multiout.dac_nids[0]; /* to front */
10534 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10538 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10540 struct alc_spec *spec = codec->spec;
10543 for (i = 0; i < AUTO_PIN_LAST; i++) {
10544 hda_nid_t nid = spec->autocfg.input_pins[i];
10547 alc_set_input_pin(codec, nid, i);
10548 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10549 snd_hda_codec_write(codec, nid, 0,
10550 AC_VERB_SET_AMP_GAIN_MUTE,
10555 static void alc882_auto_init_input_src(struct hda_codec *codec)
10557 struct alc_spec *spec = codec->spec;
10560 for (c = 0; c < spec->num_adc_nids; c++) {
10561 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10562 hda_nid_t nid = spec->capsrc_nids[c];
10563 unsigned int mux_idx;
10564 const struct hda_input_mux *imux;
10565 int conns, mute, idx, item;
10567 conns = snd_hda_get_connections(codec, nid, conn_list,
10568 ARRAY_SIZE(conn_list));
10571 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10572 imux = &spec->input_mux[mux_idx];
10573 if (!imux->num_items && mux_idx > 0)
10574 imux = &spec->input_mux[0];
10575 for (idx = 0; idx < conns; idx++) {
10576 /* if the current connection is the selected one,
10577 * unmute it as default - otherwise mute it
10579 mute = AMP_IN_MUTE(idx);
10580 for (item = 0; item < imux->num_items; item++) {
10581 if (imux->items[item].index == idx) {
10582 if (spec->cur_mux[c] == item)
10583 mute = AMP_IN_UNMUTE(idx);
10587 /* check if we have a selector or mixer
10588 * we could check for the widget type instead, but
10589 * just check for Amp-In presence (in case of mixer
10590 * without amp-in there is something wrong, this
10591 * function shouldn't be used or capsrc nid is wrong)
10593 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10594 snd_hda_codec_write(codec, nid, 0,
10595 AC_VERB_SET_AMP_GAIN_MUTE,
10597 else if (mute != AMP_IN_MUTE(idx))
10598 snd_hda_codec_write(codec, nid, 0,
10599 AC_VERB_SET_CONNECT_SEL,
10605 /* add mic boosts if needed */
10606 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10608 struct alc_spec *spec = codec->spec;
10612 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10613 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10614 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10616 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10620 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10621 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10622 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10624 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10631 /* almost identical with ALC880 parser... */
10632 static int alc882_parse_auto_config(struct hda_codec *codec)
10634 struct alc_spec *spec = codec->spec;
10635 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10638 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10642 if (!spec->autocfg.line_outs)
10643 return 0; /* can't find valid BIOS pin config */
10645 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10648 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10651 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10655 err = alc880_auto_create_extra_out(spec,
10656 spec->autocfg.speaker_pins[0],
10660 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10664 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10666 alc_auto_parse_digital(codec);
10668 if (spec->kctls.list)
10669 add_mixer(spec, spec->kctls.list);
10671 add_verb(spec, alc883_auto_init_verbs);
10672 /* if ADC 0x07 is available, initialize it, too */
10673 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10674 add_verb(spec, alc882_adc1_init_verbs);
10676 spec->num_mux_defs = 1;
10677 spec->input_mux = &spec->private_imux[0];
10679 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10681 err = alc_auto_add_mic_boost(codec);
10685 return 1; /* config found */
10688 /* additional initialization for auto-configuration model */
10689 static void alc882_auto_init(struct hda_codec *codec)
10691 struct alc_spec *spec = codec->spec;
10692 alc882_auto_init_multi_out(codec);
10693 alc882_auto_init_hp_out(codec);
10694 alc882_auto_init_analog_input(codec);
10695 alc882_auto_init_input_src(codec);
10696 alc_auto_init_digital(codec);
10697 if (spec->unsol_event)
10698 alc_inithook(codec);
10701 static int patch_alc882(struct hda_codec *codec)
10703 struct alc_spec *spec;
10704 int err, board_config;
10706 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10710 codec->spec = spec;
10712 alc_auto_parse_customize_define(codec);
10714 switch (codec->vendor_id) {
10719 /* ALC883 and variants */
10720 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10724 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10728 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10729 board_config = snd_hda_check_board_codec_sid_config(codec,
10730 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10732 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10733 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10735 board_config = ALC882_AUTO;
10738 if (board_config == ALC882_AUTO)
10739 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10741 if (board_config == ALC882_AUTO) {
10742 /* automatic parse from the BIOS config */
10743 err = alc882_parse_auto_config(codec);
10749 "hda_codec: Cannot set up configuration "
10750 "from BIOS. Using base mode...\n");
10751 board_config = ALC882_3ST_DIG;
10755 if (has_cdefine_beep(codec)) {
10756 err = snd_hda_attach_beep_device(codec, 0x1);
10763 if (board_config != ALC882_AUTO)
10764 setup_preset(codec, &alc882_presets[board_config]);
10766 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10767 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10768 /* FIXME: setup DAC5 */
10769 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10770 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10772 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10773 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10775 if (!spec->adc_nids && spec->input_mux) {
10777 spec->num_adc_nids = 0;
10778 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10779 const struct hda_input_mux *imux = spec->input_mux;
10781 hda_nid_t items[16];
10782 hda_nid_t nid = alc882_adc_nids[i];
10783 unsigned int wcap = get_wcaps(codec, nid);
10785 wcap = get_wcaps_type(wcap);
10786 if (wcap != AC_WID_AUD_IN)
10788 spec->private_adc_nids[spec->num_adc_nids] = nid;
10789 err = snd_hda_get_connections(codec, nid, &cap, 1);
10792 err = snd_hda_get_connections(codec, cap, items,
10793 ARRAY_SIZE(items));
10796 for (j = 0; j < imux->num_items; j++)
10797 if (imux->items[j].index >= err)
10799 if (j < imux->num_items)
10801 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10802 spec->num_adc_nids++;
10804 spec->adc_nids = spec->private_adc_nids;
10805 spec->capsrc_nids = spec->private_capsrc_nids;
10808 set_capture_mixer(codec);
10810 if (has_cdefine_beep(codec))
10811 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10813 if (board_config == ALC882_AUTO)
10814 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10816 spec->vmaster_nid = 0x0c;
10818 codec->patch_ops = alc_patch_ops;
10819 if (board_config == ALC882_AUTO)
10820 spec->init_hook = alc882_auto_init;
10821 #ifdef CONFIG_SND_HDA_POWER_SAVE
10822 if (!spec->loopback.amplist)
10823 spec->loopback.amplist = alc882_loopbacks;
10834 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10835 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10837 #define alc262_dac_nids alc260_dac_nids
10838 #define alc262_adc_nids alc882_adc_nids
10839 #define alc262_adc_nids_alt alc882_adc_nids_alt
10840 #define alc262_capsrc_nids alc882_capsrc_nids
10841 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10843 #define alc262_modes alc260_modes
10844 #define alc262_capture_source alc882_capture_source
10846 static hda_nid_t alc262_dmic_adc_nids[1] = {
10851 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10853 static struct snd_kcontrol_new alc262_base_mixer[] = {
10854 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10855 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10858 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10859 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10860 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10861 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10863 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10864 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10865 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10866 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10867 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10868 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10869 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10873 /* update HP, line and mono-out pins according to the master switch */
10874 static void alc262_hp_master_update(struct hda_codec *codec)
10876 struct alc_spec *spec = codec->spec;
10877 int val = spec->master_sw;
10879 /* HP & line-out */
10880 snd_hda_codec_write_cache(codec, 0x1b, 0,
10881 AC_VERB_SET_PIN_WIDGET_CONTROL,
10883 snd_hda_codec_write_cache(codec, 0x15, 0,
10884 AC_VERB_SET_PIN_WIDGET_CONTROL,
10886 /* mono (speaker) depending on the HP jack sense */
10887 val = val && !spec->jack_present;
10888 snd_hda_codec_write_cache(codec, 0x16, 0,
10889 AC_VERB_SET_PIN_WIDGET_CONTROL,
10890 val ? PIN_OUT : 0);
10893 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10895 struct alc_spec *spec = codec->spec;
10897 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10898 alc262_hp_master_update(codec);
10901 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10903 if ((res >> 26) != ALC880_HP_EVENT)
10905 alc262_hp_bpc_automute(codec);
10908 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10910 struct alc_spec *spec = codec->spec;
10912 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10913 alc262_hp_master_update(codec);
10916 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10919 if ((res >> 26) != ALC880_HP_EVENT)
10921 alc262_hp_wildwest_automute(codec);
10924 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10926 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10927 struct snd_ctl_elem_value *ucontrol)
10929 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10930 struct alc_spec *spec = codec->spec;
10931 int val = !!*ucontrol->value.integer.value;
10933 if (val == spec->master_sw)
10935 spec->master_sw = val;
10936 alc262_hp_master_update(codec);
10940 #define ALC262_HP_MASTER_SWITCH \
10942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10943 .name = "Master Playback Switch", \
10944 .info = snd_ctl_boolean_mono_info, \
10945 .get = alc262_hp_master_sw_get, \
10946 .put = alc262_hp_master_sw_put, \
10949 .iface = NID_MAPPING, \
10950 .name = "Master Playback Switch", \
10951 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10955 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10956 ALC262_HP_MASTER_SWITCH,
10957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10958 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10960 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10962 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10965 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10966 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10967 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10968 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10969 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10971 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10974 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10975 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10979 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10980 ALC262_HP_MASTER_SWITCH,
10981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10982 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10983 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10984 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10985 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10987 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10989 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10990 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10991 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10992 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10993 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10994 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10995 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10999 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11000 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11001 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11002 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11006 /* mute/unmute internal speaker according to the hp jack and mute state */
11007 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11009 struct alc_spec *spec = codec->spec;
11011 spec->autocfg.hp_pins[0] = 0x15;
11012 spec->autocfg.speaker_pins[0] = 0x14;
11015 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11016 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11017 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11018 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11021 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11026 static struct hda_verb alc262_hp_t5735_verbs[] = {
11027 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11030 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11034 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11035 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11037 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11038 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11039 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11040 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11044 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11045 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11047 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11049 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11050 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11052 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11054 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11058 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11065 /* bind hp and internal speaker mute (with plug check) as master switch */
11066 static void alc262_hippo_master_update(struct hda_codec *codec)
11068 struct alc_spec *spec = codec->spec;
11069 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11070 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11071 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11075 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11076 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11077 HDA_AMP_MUTE, mute);
11078 /* mute internal speaker per jack sense */
11079 if (spec->jack_present)
11080 mute = HDA_AMP_MUTE;
11082 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11083 HDA_AMP_MUTE, mute);
11084 if (speaker_nid && speaker_nid != line_nid)
11085 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11086 HDA_AMP_MUTE, mute);
11089 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11091 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11092 struct snd_ctl_elem_value *ucontrol)
11094 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11095 struct alc_spec *spec = codec->spec;
11096 int val = !!*ucontrol->value.integer.value;
11098 if (val == spec->master_sw)
11100 spec->master_sw = val;
11101 alc262_hippo_master_update(codec);
11105 #define ALC262_HIPPO_MASTER_SWITCH \
11107 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11108 .name = "Master Playback Switch", \
11109 .info = snd_ctl_boolean_mono_info, \
11110 .get = alc262_hippo_master_sw_get, \
11111 .put = alc262_hippo_master_sw_put, \
11114 .iface = NID_MAPPING, \
11115 .name = "Master Playback Switch", \
11116 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11117 (SUBDEV_SPEAKER(0) << 16), \
11120 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11121 ALC262_HIPPO_MASTER_SWITCH,
11122 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11123 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11124 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11129 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11130 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11131 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11132 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11133 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11137 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11138 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11139 ALC262_HIPPO_MASTER_SWITCH,
11140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
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("Mic Boost", 0x18, 0, HDA_INPUT),
11147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11149 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11153 /* mute/unmute internal speaker according to the hp jack and mute state */
11154 static void alc262_hippo_automute(struct hda_codec *codec)
11156 struct alc_spec *spec = codec->spec;
11157 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11159 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11160 alc262_hippo_master_update(codec);
11163 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11165 if ((res >> 26) != ALC880_HP_EVENT)
11167 alc262_hippo_automute(codec);
11170 static void alc262_hippo_setup(struct hda_codec *codec)
11172 struct alc_spec *spec = codec->spec;
11174 spec->autocfg.hp_pins[0] = 0x15;
11175 spec->autocfg.speaker_pins[0] = 0x14;
11178 static void alc262_hippo1_setup(struct hda_codec *codec)
11180 struct alc_spec *spec = codec->spec;
11182 spec->autocfg.hp_pins[0] = 0x1b;
11183 spec->autocfg.speaker_pins[0] = 0x14;
11187 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11188 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11189 ALC262_HIPPO_MASTER_SWITCH,
11190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11192 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11193 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11197 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11198 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11199 ALC262_HIPPO_MASTER_SWITCH,
11200 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11203 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11204 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11208 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11209 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11210 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11211 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11212 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11217 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11218 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11219 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11220 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11224 static struct hda_verb alc262_tyan_verbs[] = {
11225 /* Headphone automute */
11226 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11227 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11228 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11230 /* P11 AUX_IN, white 4-pin connector */
11231 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11232 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11233 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11234 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11239 /* unsolicited event for HP jack sensing */
11240 static void alc262_tyan_setup(struct hda_codec *codec)
11242 struct alc_spec *spec = codec->spec;
11244 spec->autocfg.hp_pins[0] = 0x1b;
11245 spec->autocfg.speaker_pins[0] = 0x15;
11249 #define alc262_capture_mixer alc882_capture_mixer
11250 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11253 * generic initialization of ADC, input mixers and output mixers
11255 static struct hda_verb alc262_init_verbs[] = {
11257 * Unmute ADC0-2 and set the default input to mic-in
11259 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11260 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11261 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11263 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11266 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11268 * Note: PASD motherboards uses the Line In 2 as the input for
11269 * front panel mic (mic 2)
11271 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11272 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11279 * Set up output mixers (0x0c - 0x0e)
11281 /* set vol=0 to output mixers */
11282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11283 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11285 /* set up input amps for analog loopback */
11286 /* Amp Indices: DAC = 0, mixer = 1 */
11287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11289 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11296 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11298 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11299 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11303 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11304 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11307 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11308 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11310 /* FIXME: use matrix-type input source selection */
11311 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11312 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11318 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11319 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11320 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11321 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11323 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11324 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11325 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11326 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11331 static struct hda_verb alc262_eapd_verbs[] = {
11332 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11333 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11337 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11338 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11339 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11340 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11342 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11343 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11347 static struct hda_verb alc262_sony_unsol_verbs[] = {
11348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11349 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11350 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11353 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11357 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11358 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11359 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11366 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11367 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11368 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11370 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11371 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11373 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11374 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11378 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11380 struct alc_spec *spec = codec->spec;
11382 spec->autocfg.hp_pins[0] = 0x15;
11383 spec->autocfg.speaker_pins[0] = 0x14;
11384 spec->ext_mic.pin = 0x18;
11385 spec->ext_mic.mux_idx = 0;
11386 spec->int_mic.pin = 0x12;
11387 spec->int_mic.mux_idx = 9;
11388 spec->auto_mic = 1;
11394 * 0x16 = internal speaker
11395 * 0x18 = external mic
11398 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11399 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11400 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11404 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11406 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11407 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11411 static struct hda_verb alc262_nec_verbs[] = {
11412 /* Unmute Speaker */
11413 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11416 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11419 /* External mic to headphone */
11420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11421 /* External mic to speaker */
11422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11428 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11429 * 0x1b = port replicator headphone out
11432 #define ALC_HP_EVENT 0x37
11434 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11435 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11437 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11438 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11442 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11443 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11444 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11448 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11449 /* Front Mic pin: input vref at 50% */
11450 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11451 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11455 static struct hda_input_mux alc262_fujitsu_capture_source = {
11459 { "Int Mic", 0x1 },
11464 static struct hda_input_mux alc262_HP_capture_source = {
11468 { "Front Mic", 0x1 },
11475 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11479 { "Front Mic", 0x2 },
11485 /* mute/unmute internal speaker according to the hp jacks and mute state */
11486 static void alc262_fujitsu_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, 0x14) ||
11493 snd_hda_jack_detect(codec, 0x1b);
11494 spec->sense_updated = 1;
11496 /* unmute internal speaker only if both HPs are unplugged and
11497 * master switch is on
11499 if (spec->jack_present)
11500 mute = HDA_AMP_MUTE;
11502 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11503 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11504 HDA_AMP_MUTE, mute);
11507 /* unsolicited event for HP jack sensing */
11508 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11511 if ((res >> 26) != ALC_HP_EVENT)
11513 alc262_fujitsu_automute(codec, 1);
11516 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11518 alc262_fujitsu_automute(codec, 1);
11521 /* bind volumes of both NID 0x0c and 0x0d */
11522 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11523 .ops = &snd_hda_bind_vol,
11525 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11526 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11531 /* mute/unmute internal speaker according to the hp jack and mute state */
11532 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11534 struct alc_spec *spec = codec->spec;
11537 if (force || !spec->sense_updated) {
11538 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11539 spec->sense_updated = 1;
11541 if (spec->jack_present) {
11542 /* mute internal speaker */
11543 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11544 HDA_AMP_MUTE, HDA_AMP_MUTE);
11545 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11546 HDA_AMP_MUTE, HDA_AMP_MUTE);
11548 /* unmute internal speaker if necessary */
11549 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11550 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11551 HDA_AMP_MUTE, mute);
11552 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11553 HDA_AMP_MUTE, mute);
11557 /* unsolicited event for HP jack sensing */
11558 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11561 if ((res >> 26) != ALC_HP_EVENT)
11563 alc262_lenovo_3000_automute(codec, 1);
11566 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11567 int dir, int idx, long *valp)
11571 for (i = 0; i < 2; i++, valp++)
11572 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11574 *valp ? 0 : HDA_AMP_MUTE);
11578 /* bind hp and internal speaker mute (with plug check) */
11579 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11580 struct snd_ctl_elem_value *ucontrol)
11582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11583 long *valp = ucontrol->value.integer.value;
11586 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11587 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11589 alc262_fujitsu_automute(codec, 0);
11593 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11594 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11596 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11597 .name = "Master Playback Switch",
11598 .subdevice = HDA_SUBDEV_AMP_FLAG,
11599 .info = snd_hda_mixer_amp_switch_info,
11600 .get = snd_hda_mixer_amp_switch_get,
11601 .put = alc262_fujitsu_master_sw_put,
11602 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11605 .iface = NID_MAPPING,
11606 .name = "Master Playback Switch",
11607 .private_value = 0x1b,
11609 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11610 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11611 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11614 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11615 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11616 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11620 /* bind hp and internal speaker mute (with plug check) */
11621 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11622 struct snd_ctl_elem_value *ucontrol)
11624 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11625 long *valp = ucontrol->value.integer.value;
11628 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11630 alc262_lenovo_3000_automute(codec, 0);
11634 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11635 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11637 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11638 .name = "Master Playback Switch",
11639 .subdevice = HDA_SUBDEV_AMP_FLAG,
11640 .info = snd_hda_mixer_amp_switch_info,
11641 .get = snd_hda_mixer_amp_switch_get,
11642 .put = alc262_lenovo_3000_master_sw_put,
11643 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11645 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11646 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11647 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11648 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11650 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11651 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11652 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11656 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11657 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11658 ALC262_HIPPO_MASTER_SWITCH,
11659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11661 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11662 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11664 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11668 /* additional init verbs for Benq laptops */
11669 static struct hda_verb alc262_EAPD_verbs[] = {
11670 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11671 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11675 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11677 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11679 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11680 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11684 /* Samsung Q1 Ultra Vista model setup */
11685 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11686 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11687 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11690 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11691 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11695 static struct hda_verb alc262_ultra_verbs[] = {
11697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11701 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11702 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11704 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11709 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11710 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11712 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11714 /* ADC, choose mic */
11715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11716 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11718 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11720 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11721 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11722 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11723 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11724 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11728 /* mute/unmute internal speaker according to the hp jack and mute state */
11729 static void alc262_ultra_automute(struct hda_codec *codec)
11731 struct alc_spec *spec = codec->spec;
11735 /* auto-mute only when HP is used as HP */
11736 if (!spec->cur_mux[0]) {
11737 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11738 if (spec->jack_present)
11739 mute = HDA_AMP_MUTE;
11741 /* mute/unmute internal speaker */
11742 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11743 HDA_AMP_MUTE, mute);
11744 /* mute/unmute HP */
11745 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11746 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11749 /* unsolicited event for HP jack sensing */
11750 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11753 if ((res >> 26) != ALC880_HP_EVENT)
11755 alc262_ultra_automute(codec);
11758 static struct hda_input_mux alc262_ultra_capture_source = {
11762 { "Headphone", 0x7 },
11766 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11767 struct snd_ctl_elem_value *ucontrol)
11769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11770 struct alc_spec *spec = codec->spec;
11773 ret = alc_mux_enum_put(kcontrol, ucontrol);
11776 /* reprogram the HP pin as mic or HP according to the input source */
11777 snd_hda_codec_write_cache(codec, 0x15, 0,
11778 AC_VERB_SET_PIN_WIDGET_CONTROL,
11779 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11780 alc262_ultra_automute(codec); /* mute/unmute HP */
11784 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11785 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11786 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11788 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11789 .name = "Capture Source",
11790 .info = alc_mux_enum_info,
11791 .get = alc_mux_enum_get,
11792 .put = alc262_ultra_mux_enum_put,
11795 .iface = NID_MAPPING,
11796 .name = "Capture Source",
11797 .private_value = 0x15,
11802 /* We use two mixers depending on the output pin; 0x16 is a mono output
11803 * and thus it's bound with a different mixer.
11804 * This function returns which mixer amp should be used.
11806 static int alc262_check_volbit(hda_nid_t nid)
11810 else if (nid == 0x16)
11816 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11817 const char *pfx, int *vbits)
11822 vbit = alc262_check_volbit(nid);
11825 if (*vbits & vbit) /* a volume control for this mixer already there */
11829 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11831 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11832 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11835 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11843 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11845 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11846 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11849 /* add playback controls from the parsed DAC table */
11850 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11851 const struct auto_pin_cfg *cfg)
11857 spec->multiout.num_dacs = 1; /* only use one dac */
11858 spec->multiout.dac_nids = spec->private_dac_nids;
11859 spec->multiout.dac_nids[0] = 2;
11861 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11863 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11867 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11870 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11873 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11877 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11878 alc262_check_volbit(cfg->speaker_pins[0]) |
11879 alc262_check_volbit(cfg->hp_pins[0]);
11880 if (vbits == 1 || vbits == 2)
11881 pfx = "Master"; /* only one mixer is used */
11882 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11887 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11890 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11894 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11901 #define alc262_auto_create_input_ctls \
11902 alc882_auto_create_input_ctls
11905 * generic initialization of ADC, input mixers and output mixers
11907 static struct hda_verb alc262_volume_init_verbs[] = {
11909 * Unmute ADC0-2 and set the default input to mic-in
11911 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11912 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11913 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11914 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11915 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11916 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11918 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11920 * Note: PASD motherboards uses the Line In 2 as the input for
11921 * front panel mic (mic 2)
11923 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11931 * Set up output mixers (0x0c - 0x0f)
11933 /* set vol=0 to output mixers */
11934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11935 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11938 /* set up input amps for analog loopback */
11939 /* Amp Indices: DAC = 0, mixer = 1 */
11940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11943 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11944 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11947 /* FIXME: use matrix-type input source selection */
11948 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11949 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11956 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11957 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11962 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11963 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11968 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11970 * Unmute ADC0-2 and set the default input to mic-in
11972 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11974 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11976 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11977 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11979 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11981 * Note: PASD motherboards uses the Line In 2 as the input for
11982 * front panel mic (mic 2)
11984 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11985 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11994 * Set up output mixers (0x0c - 0x0e)
11996 /* set vol=0 to output mixers */
11997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11998 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11999 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12001 /* set up input amps for analog loopback */
12002 /* Amp Indices: DAC = 0, mixer = 1 */
12003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12004 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12005 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12006 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12007 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12008 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12010 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12012 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12015 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12017 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12021 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12022 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12024 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12026 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12027 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12030 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12031 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12034 /* FIXME: use matrix-type input source selection */
12035 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12036 /* Input mixer1: only unmute Mic */
12037 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12038 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12039 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12041 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12047 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12048 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12049 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12050 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12052 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12055 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12065 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12067 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12072 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12074 * Unmute ADC0-2 and set the default input to mic-in
12076 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12077 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12078 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12080 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12083 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12085 * Note: PASD motherboards uses the Line In 2 as the input for front
12086 * panel mic (mic 2)
12088 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12092 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12094 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12098 * Set up output mixers (0x0c - 0x0e)
12100 /* set vol=0 to output mixers */
12101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12102 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12105 /* set up input amps for analog loopback */
12106 /* Amp Indices: DAC = 0, mixer = 1 */
12107 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12109 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12110 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12112 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12115 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12116 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12117 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12118 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12119 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12120 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12121 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12123 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12126 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12127 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12129 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12131 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12132 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12133 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12134 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12136 /* FIXME: use matrix-type input source selection */
12137 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12138 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12139 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12140 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12141 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12142 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12143 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12144 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12147 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12148 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12149 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12152 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12153 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12158 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12160 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12161 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12163 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12168 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12171 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12172 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12174 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12175 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12176 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12177 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12179 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12180 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12181 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12186 #ifdef CONFIG_SND_HDA_POWER_SAVE
12187 #define alc262_loopbacks alc880_loopbacks
12190 /* pcm configuration: identical with ALC880 */
12191 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12192 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12193 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12194 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12197 * BIOS auto configuration
12199 static int alc262_parse_auto_config(struct hda_codec *codec)
12201 struct alc_spec *spec = codec->spec;
12203 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12205 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12209 if (!spec->autocfg.line_outs) {
12210 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12211 spec->multiout.max_channels = 2;
12212 spec->no_analog = 1;
12215 return 0; /* can't find valid BIOS pin config */
12217 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12220 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12224 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12227 alc_auto_parse_digital(codec);
12229 if (spec->kctls.list)
12230 add_mixer(spec, spec->kctls.list);
12232 add_verb(spec, alc262_volume_init_verbs);
12233 spec->num_mux_defs = 1;
12234 spec->input_mux = &spec->private_imux[0];
12236 err = alc_auto_add_mic_boost(codec);
12240 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12245 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12246 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12247 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12248 #define alc262_auto_init_input_src alc882_auto_init_input_src
12251 /* init callback for auto-configuration model -- overriding the default init */
12252 static void alc262_auto_init(struct hda_codec *codec)
12254 struct alc_spec *spec = codec->spec;
12255 alc262_auto_init_multi_out(codec);
12256 alc262_auto_init_hp_out(codec);
12257 alc262_auto_init_analog_input(codec);
12258 alc262_auto_init_input_src(codec);
12259 alc_auto_init_digital(codec);
12260 if (spec->unsol_event)
12261 alc_inithook(codec);
12265 * configuration and preset
12267 static const char *alc262_models[ALC262_MODEL_LAST] = {
12268 [ALC262_BASIC] = "basic",
12269 [ALC262_HIPPO] = "hippo",
12270 [ALC262_HIPPO_1] = "hippo_1",
12271 [ALC262_FUJITSU] = "fujitsu",
12272 [ALC262_HP_BPC] = "hp-bpc",
12273 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12274 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12275 [ALC262_HP_RP5700] = "hp-rp5700",
12276 [ALC262_BENQ_ED8] = "benq",
12277 [ALC262_BENQ_T31] = "benq-t31",
12278 [ALC262_SONY_ASSAMD] = "sony-assamd",
12279 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12280 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12281 [ALC262_ULTRA] = "ultra",
12282 [ALC262_LENOVO_3000] = "lenovo-3000",
12283 [ALC262_NEC] = "nec",
12284 [ALC262_TYAN] = "tyan",
12285 [ALC262_AUTO] = "auto",
12288 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12289 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12290 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12291 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12293 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12295 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12297 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12298 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12299 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12300 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12301 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12302 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12303 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12304 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12305 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12306 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12307 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12308 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12309 ALC262_HP_TC_T5735),
12310 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12311 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12312 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12313 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12314 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12315 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12316 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12317 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12318 #if 0 /* disable the quirk since model=auto works better in recent versions */
12319 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12320 ALC262_SONY_ASSAMD),
12322 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12323 ALC262_TOSHIBA_RX1),
12324 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12325 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12326 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12327 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12328 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12330 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12331 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12332 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12333 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12334 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12338 static struct alc_config_preset alc262_presets[] = {
12340 .mixers = { alc262_base_mixer },
12341 .init_verbs = { alc262_init_verbs },
12342 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12343 .dac_nids = alc262_dac_nids,
12345 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12346 .channel_mode = alc262_modes,
12347 .input_mux = &alc262_capture_source,
12350 .mixers = { alc262_hippo_mixer },
12351 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12352 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12353 .dac_nids = alc262_dac_nids,
12355 .dig_out_nid = ALC262_DIGOUT_NID,
12356 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12357 .channel_mode = alc262_modes,
12358 .input_mux = &alc262_capture_source,
12359 .unsol_event = alc262_hippo_unsol_event,
12360 .setup = alc262_hippo_setup,
12361 .init_hook = alc262_hippo_automute,
12363 [ALC262_HIPPO_1] = {
12364 .mixers = { alc262_hippo1_mixer },
12365 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12366 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12367 .dac_nids = alc262_dac_nids,
12369 .dig_out_nid = ALC262_DIGOUT_NID,
12370 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12371 .channel_mode = alc262_modes,
12372 .input_mux = &alc262_capture_source,
12373 .unsol_event = alc262_hippo_unsol_event,
12374 .setup = alc262_hippo1_setup,
12375 .init_hook = alc262_hippo_automute,
12377 [ALC262_FUJITSU] = {
12378 .mixers = { alc262_fujitsu_mixer },
12379 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12380 alc262_fujitsu_unsol_verbs },
12381 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12382 .dac_nids = alc262_dac_nids,
12384 .dig_out_nid = ALC262_DIGOUT_NID,
12385 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12386 .channel_mode = alc262_modes,
12387 .input_mux = &alc262_fujitsu_capture_source,
12388 .unsol_event = alc262_fujitsu_unsol_event,
12389 .init_hook = alc262_fujitsu_init_hook,
12391 [ALC262_HP_BPC] = {
12392 .mixers = { alc262_HP_BPC_mixer },
12393 .init_verbs = { alc262_HP_BPC_init_verbs },
12394 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12395 .dac_nids = alc262_dac_nids,
12397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12398 .channel_mode = alc262_modes,
12399 .input_mux = &alc262_HP_capture_source,
12400 .unsol_event = alc262_hp_bpc_unsol_event,
12401 .init_hook = alc262_hp_bpc_automute,
12403 [ALC262_HP_BPC_D7000_WF] = {
12404 .mixers = { alc262_HP_BPC_WildWest_mixer },
12405 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12406 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12407 .dac_nids = alc262_dac_nids,
12409 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12410 .channel_mode = alc262_modes,
12411 .input_mux = &alc262_HP_D7000_capture_source,
12412 .unsol_event = alc262_hp_wildwest_unsol_event,
12413 .init_hook = alc262_hp_wildwest_automute,
12415 [ALC262_HP_BPC_D7000_WL] = {
12416 .mixers = { alc262_HP_BPC_WildWest_mixer,
12417 alc262_HP_BPC_WildWest_option_mixer },
12418 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12419 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12420 .dac_nids = alc262_dac_nids,
12422 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12423 .channel_mode = alc262_modes,
12424 .input_mux = &alc262_HP_D7000_capture_source,
12425 .unsol_event = alc262_hp_wildwest_unsol_event,
12426 .init_hook = alc262_hp_wildwest_automute,
12428 [ALC262_HP_TC_T5735] = {
12429 .mixers = { alc262_hp_t5735_mixer },
12430 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_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 = alc_sku_unsol_event,
12438 .setup = alc262_hp_t5735_setup,
12439 .init_hook = alc_inithook,
12441 [ALC262_HP_RP5700] = {
12442 .mixers = { alc262_hp_rp5700_mixer },
12443 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12444 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12445 .dac_nids = alc262_dac_nids,
12446 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12447 .channel_mode = alc262_modes,
12448 .input_mux = &alc262_hp_rp5700_capture_source,
12450 [ALC262_BENQ_ED8] = {
12451 .mixers = { alc262_base_mixer },
12452 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12453 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12454 .dac_nids = alc262_dac_nids,
12456 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12457 .channel_mode = alc262_modes,
12458 .input_mux = &alc262_capture_source,
12460 [ALC262_SONY_ASSAMD] = {
12461 .mixers = { alc262_sony_mixer },
12462 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12463 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12464 .dac_nids = alc262_dac_nids,
12466 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12467 .channel_mode = alc262_modes,
12468 .input_mux = &alc262_capture_source,
12469 .unsol_event = alc262_hippo_unsol_event,
12470 .setup = alc262_hippo_setup,
12471 .init_hook = alc262_hippo_automute,
12473 [ALC262_BENQ_T31] = {
12474 .mixers = { alc262_benq_t31_mixer },
12475 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12476 alc_hp15_unsol_verbs },
12477 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12478 .dac_nids = alc262_dac_nids,
12480 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12481 .channel_mode = alc262_modes,
12482 .input_mux = &alc262_capture_source,
12483 .unsol_event = alc262_hippo_unsol_event,
12484 .setup = alc262_hippo_setup,
12485 .init_hook = alc262_hippo_automute,
12488 .mixers = { alc262_ultra_mixer },
12489 .cap_mixer = alc262_ultra_capture_mixer,
12490 .init_verbs = { alc262_ultra_verbs },
12491 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12492 .dac_nids = alc262_dac_nids,
12493 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12494 .channel_mode = alc262_modes,
12495 .input_mux = &alc262_ultra_capture_source,
12496 .adc_nids = alc262_adc_nids, /* ADC0 */
12497 .capsrc_nids = alc262_capsrc_nids,
12498 .num_adc_nids = 1, /* single ADC */
12499 .unsol_event = alc262_ultra_unsol_event,
12500 .init_hook = alc262_ultra_automute,
12502 [ALC262_LENOVO_3000] = {
12503 .mixers = { alc262_lenovo_3000_mixer },
12504 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12505 alc262_lenovo_3000_unsol_verbs,
12506 alc262_lenovo_3000_init_verbs },
12507 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12508 .dac_nids = alc262_dac_nids,
12510 .dig_out_nid = ALC262_DIGOUT_NID,
12511 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12512 .channel_mode = alc262_modes,
12513 .input_mux = &alc262_fujitsu_capture_source,
12514 .unsol_event = alc262_lenovo_3000_unsol_event,
12517 .mixers = { alc262_nec_mixer },
12518 .init_verbs = { alc262_nec_verbs },
12519 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12520 .dac_nids = alc262_dac_nids,
12522 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12523 .channel_mode = alc262_modes,
12524 .input_mux = &alc262_capture_source,
12526 [ALC262_TOSHIBA_S06] = {
12527 .mixers = { alc262_toshiba_s06_mixer },
12528 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12529 alc262_eapd_verbs },
12530 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12531 .capsrc_nids = alc262_dmic_capsrc_nids,
12532 .dac_nids = alc262_dac_nids,
12533 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12534 .num_adc_nids = 1, /* single ADC */
12535 .dig_out_nid = ALC262_DIGOUT_NID,
12536 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12537 .channel_mode = alc262_modes,
12538 .unsol_event = alc_sku_unsol_event,
12539 .setup = alc262_toshiba_s06_setup,
12540 .init_hook = alc_inithook,
12542 [ALC262_TOSHIBA_RX1] = {
12543 .mixers = { alc262_toshiba_rx1_mixer },
12544 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12545 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12546 .dac_nids = alc262_dac_nids,
12548 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12549 .channel_mode = alc262_modes,
12550 .input_mux = &alc262_capture_source,
12551 .unsol_event = alc262_hippo_unsol_event,
12552 .setup = alc262_hippo_setup,
12553 .init_hook = alc262_hippo_automute,
12556 .mixers = { alc262_tyan_mixer },
12557 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12558 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12559 .dac_nids = alc262_dac_nids,
12561 .dig_out_nid = ALC262_DIGOUT_NID,
12562 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12563 .channel_mode = alc262_modes,
12564 .input_mux = &alc262_capture_source,
12565 .unsol_event = alc_automute_amp_unsol_event,
12566 .setup = alc262_tyan_setup,
12567 .init_hook = alc_automute_amp,
12571 static int patch_alc262(struct hda_codec *codec)
12573 struct alc_spec *spec;
12577 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12581 codec->spec = spec;
12583 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12588 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12589 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12590 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12591 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12594 alc_auto_parse_customize_define(codec);
12596 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12598 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12602 if (board_config < 0) {
12603 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12605 board_config = ALC262_AUTO;
12608 if (board_config == ALC262_AUTO) {
12609 /* automatic parse from the BIOS config */
12610 err = alc262_parse_auto_config(codec);
12616 "hda_codec: Cannot set up configuration "
12617 "from BIOS. Using base mode...\n");
12618 board_config = ALC262_BASIC;
12622 if (!spec->no_analog && has_cdefine_beep(codec)) {
12623 err = snd_hda_attach_beep_device(codec, 0x1);
12630 if (board_config != ALC262_AUTO)
12631 setup_preset(codec, &alc262_presets[board_config]);
12633 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12634 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12636 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12637 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12639 if (!spec->adc_nids && spec->input_mux) {
12641 /* check whether the digital-mic has to be supported */
12642 for (i = 0; i < spec->input_mux->num_items; i++) {
12643 if (spec->input_mux->items[i].index >= 9)
12646 if (i < spec->input_mux->num_items) {
12647 /* use only ADC0 */
12648 spec->adc_nids = alc262_dmic_adc_nids;
12649 spec->num_adc_nids = 1;
12650 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12652 /* all analog inputs */
12653 /* check whether NID 0x07 is valid */
12654 unsigned int wcap = get_wcaps(codec, 0x07);
12657 wcap = get_wcaps_type(wcap);
12658 if (wcap != AC_WID_AUD_IN) {
12659 spec->adc_nids = alc262_adc_nids_alt;
12660 spec->num_adc_nids =
12661 ARRAY_SIZE(alc262_adc_nids_alt);
12662 spec->capsrc_nids = alc262_capsrc_nids_alt;
12664 spec->adc_nids = alc262_adc_nids;
12665 spec->num_adc_nids =
12666 ARRAY_SIZE(alc262_adc_nids);
12667 spec->capsrc_nids = alc262_capsrc_nids;
12671 if (!spec->cap_mixer && !spec->no_analog)
12672 set_capture_mixer(codec);
12673 if (!spec->no_analog && has_cdefine_beep(codec))
12674 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12676 spec->vmaster_nid = 0x0c;
12678 codec->patch_ops = alc_patch_ops;
12679 if (board_config == ALC262_AUTO)
12680 spec->init_hook = alc262_auto_init;
12681 #ifdef CONFIG_SND_HDA_POWER_SAVE
12682 if (!spec->loopback.amplist)
12683 spec->loopback.amplist = alc262_loopbacks;
12690 * ALC268 channel source setting (2 channel)
12692 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12693 #define alc268_modes alc260_modes
12695 static hda_nid_t alc268_dac_nids[2] = {
12700 static hda_nid_t alc268_adc_nids[2] = {
12705 static hda_nid_t alc268_adc_nids_alt[1] = {
12710 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12712 static struct snd_kcontrol_new alc268_base_mixer[] = {
12713 /* output mixer control */
12714 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12715 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12716 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12717 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12719 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12720 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12724 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12725 /* output mixer control */
12726 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12728 ALC262_HIPPO_MASTER_SWITCH,
12729 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12730 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12731 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12735 /* bind Beep switches of both NID 0x0f and 0x10 */
12736 static struct hda_bind_ctls alc268_bind_beep_sw = {
12737 .ops = &snd_hda_bind_sw,
12739 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12740 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12745 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12746 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12747 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12751 static struct hda_verb alc268_eapd_verbs[] = {
12752 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12753 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12757 /* Toshiba specific */
12758 static struct hda_verb alc268_toshiba_verbs[] = {
12759 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12763 /* Acer specific */
12764 /* bind volumes of both NID 0x02 and 0x03 */
12765 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12766 .ops = &snd_hda_bind_vol,
12768 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12769 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12774 /* mute/unmute internal speaker according to the hp jack and mute state */
12775 static void alc268_acer_automute(struct hda_codec *codec, int force)
12777 struct alc_spec *spec = codec->spec;
12780 if (force || !spec->sense_updated) {
12781 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12782 spec->sense_updated = 1;
12784 if (spec->jack_present)
12785 mute = HDA_AMP_MUTE; /* mute internal speaker */
12786 else /* unmute internal speaker if necessary */
12787 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12788 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12789 HDA_AMP_MUTE, mute);
12793 /* bind hp and internal speaker mute (with plug check) */
12794 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12795 struct snd_ctl_elem_value *ucontrol)
12797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12798 long *valp = ucontrol->value.integer.value;
12801 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12803 alc268_acer_automute(codec, 0);
12807 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12808 /* output mixer control */
12809 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12811 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12812 .name = "Master Playback Switch",
12813 .subdevice = HDA_SUBDEV_AMP_FLAG,
12814 .info = snd_hda_mixer_amp_switch_info,
12815 .get = snd_hda_mixer_amp_switch_get,
12816 .put = alc268_acer_master_sw_put,
12817 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12819 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12823 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12824 /* output mixer control */
12825 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12827 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12828 .name = "Master Playback Switch",
12829 .subdevice = HDA_SUBDEV_AMP_FLAG,
12830 .info = snd_hda_mixer_amp_switch_info,
12831 .get = snd_hda_mixer_amp_switch_get,
12832 .put = alc268_acer_master_sw_put,
12833 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12835 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12836 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12837 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12841 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12842 /* output mixer control */
12843 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12845 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12846 .name = "Master Playback Switch",
12847 .subdevice = HDA_SUBDEV_AMP_FLAG,
12848 .info = snd_hda_mixer_amp_switch_info,
12849 .get = snd_hda_mixer_amp_switch_get,
12850 .put = alc268_acer_master_sw_put,
12851 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12853 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12854 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12858 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12859 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12860 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12861 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12862 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12863 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12868 static struct hda_verb alc268_acer_verbs[] = {
12869 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12870 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12871 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12873 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12875 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12879 /* unsolicited event for HP jack sensing */
12880 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12881 #define alc268_toshiba_setup alc262_hippo_setup
12882 #define alc268_toshiba_automute alc262_hippo_automute
12884 static void alc268_acer_unsol_event(struct hda_codec *codec,
12887 if ((res >> 26) != ALC880_HP_EVENT)
12889 alc268_acer_automute(codec, 1);
12892 static void alc268_acer_init_hook(struct hda_codec *codec)
12894 alc268_acer_automute(codec, 1);
12897 /* toggle speaker-output according to the hp-jack state */
12898 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12900 unsigned int present;
12901 unsigned char bits;
12903 present = snd_hda_jack_detect(codec, 0x15);
12904 bits = present ? HDA_AMP_MUTE : 0;
12905 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12906 HDA_AMP_MUTE, bits);
12907 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12908 HDA_AMP_MUTE, bits);
12911 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12914 switch (res >> 26) {
12915 case ALC880_HP_EVENT:
12916 alc268_aspire_one_speaker_automute(codec);
12918 case ALC880_MIC_EVENT:
12919 alc_mic_automute(codec);
12924 static void alc268_acer_lc_setup(struct hda_codec *codec)
12926 struct alc_spec *spec = codec->spec;
12927 spec->ext_mic.pin = 0x18;
12928 spec->ext_mic.mux_idx = 0;
12929 spec->int_mic.pin = 0x12;
12930 spec->int_mic.mux_idx = 6;
12931 spec->auto_mic = 1;
12934 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12936 alc268_aspire_one_speaker_automute(codec);
12937 alc_mic_automute(codec);
12940 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12941 /* output mixer control */
12942 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12943 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12944 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12946 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12947 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12951 static struct hda_verb alc268_dell_verbs[] = {
12952 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12954 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12955 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12959 /* mute/unmute internal speaker according to the hp jack and mute state */
12960 static void alc268_dell_setup(struct hda_codec *codec)
12962 struct alc_spec *spec = codec->spec;
12964 spec->autocfg.hp_pins[0] = 0x15;
12965 spec->autocfg.speaker_pins[0] = 0x14;
12966 spec->ext_mic.pin = 0x18;
12967 spec->ext_mic.mux_idx = 0;
12968 spec->int_mic.pin = 0x19;
12969 spec->int_mic.mux_idx = 1;
12970 spec->auto_mic = 1;
12973 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12974 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12975 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12976 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12978 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12979 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12980 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12981 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12985 static struct hda_verb alc267_quanta_il1_verbs[] = {
12986 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12987 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12991 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12993 struct alc_spec *spec = codec->spec;
12994 spec->autocfg.hp_pins[0] = 0x15;
12995 spec->autocfg.speaker_pins[0] = 0x14;
12996 spec->ext_mic.pin = 0x18;
12997 spec->ext_mic.mux_idx = 0;
12998 spec->int_mic.pin = 0x19;
12999 spec->int_mic.mux_idx = 1;
13000 spec->auto_mic = 1;
13004 * generic initialization of ADC, input mixers and output mixers
13006 static struct hda_verb alc268_base_init_verbs[] = {
13007 /* Unmute DAC0-1 and set vol = 0 */
13008 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13009 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13012 * Set up output mixers (0x0c - 0x0e)
13014 /* set vol=0 to output mixers */
13015 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13016 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13018 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13019 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13021 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13022 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13023 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13025 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13026 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13027 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13028 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13032 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13033 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13034 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13036 /* set PCBEEP vol = 0, mute connections */
13037 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13038 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13039 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13041 /* Unmute Selector 23h,24h and set the default input to mic-in */
13043 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13045 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13052 * generic initialization of ADC, input mixers and output mixers
13054 static struct hda_verb alc268_volume_init_verbs[] = {
13055 /* set output DAC */
13056 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13057 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13059 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13060 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13061 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13062 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13063 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13066 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13067 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13070 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13072 /* set PCBEEP vol = 0, mute connections */
13073 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13074 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13075 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13080 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13081 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13082 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13086 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13087 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13088 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13093 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13094 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13095 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13096 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13097 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13102 static struct hda_input_mux alc268_capture_source = {
13106 { "Front Mic", 0x1 },
13112 static struct hda_input_mux alc268_acer_capture_source = {
13116 { "Internal Mic", 0x1 },
13121 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13125 { "Internal Mic", 0x6 },
13130 #ifdef CONFIG_SND_DEBUG
13131 static struct snd_kcontrol_new alc268_test_mixer[] = {
13132 /* Volume widgets */
13133 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13134 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13135 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13136 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13137 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13138 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13139 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13140 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13141 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13142 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13143 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13144 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13145 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13146 /* The below appears problematic on some hardwares */
13147 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13148 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13149 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13150 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13151 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13153 /* Modes for retasking pin widgets */
13154 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13155 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13156 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13157 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13159 /* Controls for GPIO pins, assuming they are configured as outputs */
13160 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13161 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13162 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13163 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13165 /* Switches to allow the digital SPDIF output pin to be enabled.
13166 * The ALC268 does not have an SPDIF input.
13168 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13170 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13171 * this output to turn on an external amplifier.
13173 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13174 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13180 /* create input playback/capture controls for the given pin */
13181 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13182 const char *ctlname, int idx)
13193 case 0x1a: /* ALC259/269 only */
13194 case 0x1b: /* ALC259/269 only */
13195 case 0x21: /* ALC269vb has this pin, too */
13199 snd_printd(KERN_WARNING "hda_codec: "
13200 "ignoring pin 0x%x as unknown\n", nid);
13203 if (spec->multiout.dac_nids[0] != dac &&
13204 spec->multiout.dac_nids[1] != dac) {
13205 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13206 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13210 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13214 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13215 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13217 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13218 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13224 /* add playback controls from the parsed DAC table */
13225 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13226 const struct auto_pin_cfg *cfg)
13231 spec->multiout.dac_nids = spec->private_dac_nids;
13233 nid = cfg->line_out_pins[0];
13236 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13240 err = alc268_new_analog_output(spec, nid, name, 0);
13245 nid = cfg->speaker_pins[0];
13247 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13248 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13252 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13256 nid = cfg->hp_pins[0];
13258 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13263 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13265 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13266 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13273 /* create playback/capture controls for input pins */
13274 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13275 const struct auto_pin_cfg *cfg)
13277 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13280 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13281 hda_nid_t nid, int pin_type)
13285 alc_set_pin_output(codec, nid, pin_type);
13286 if (nid == 0x14 || nid == 0x16)
13290 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13293 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13295 struct alc_spec *spec = codec->spec;
13296 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13298 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13299 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13303 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13305 struct alc_spec *spec = codec->spec;
13308 pin = spec->autocfg.hp_pins[0];
13310 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13311 pin = spec->autocfg.speaker_pins[0];
13313 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13316 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13318 struct alc_spec *spec = codec->spec;
13319 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13320 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13321 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13322 unsigned int dac_vol1, dac_vol2;
13324 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13325 snd_hda_codec_write(codec, speaker_nid, 0,
13326 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13327 /* mute mixer inputs from 0x1d */
13328 snd_hda_codec_write(codec, 0x0f, 0,
13329 AC_VERB_SET_AMP_GAIN_MUTE,
13331 snd_hda_codec_write(codec, 0x10, 0,
13332 AC_VERB_SET_AMP_GAIN_MUTE,
13335 /* unmute mixer inputs from 0x1d */
13336 snd_hda_codec_write(codec, 0x0f, 0,
13337 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13338 snd_hda_codec_write(codec, 0x10, 0,
13339 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13342 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13343 if (line_nid == 0x14)
13344 dac_vol2 = AMP_OUT_ZERO;
13345 else if (line_nid == 0x15)
13346 dac_vol1 = AMP_OUT_ZERO;
13347 if (hp_nid == 0x14)
13348 dac_vol2 = AMP_OUT_ZERO;
13349 else if (hp_nid == 0x15)
13350 dac_vol1 = AMP_OUT_ZERO;
13351 if (line_nid != 0x16 || hp_nid != 0x16 ||
13352 spec->autocfg.line_out_pins[1] != 0x16 ||
13353 spec->autocfg.line_out_pins[2] != 0x16)
13354 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13356 snd_hda_codec_write(codec, 0x02, 0,
13357 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13358 snd_hda_codec_write(codec, 0x03, 0,
13359 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13362 /* pcm configuration: identical with ALC880 */
13363 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13364 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13365 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13366 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13369 * BIOS auto configuration
13371 static int alc268_parse_auto_config(struct hda_codec *codec)
13373 struct alc_spec *spec = codec->spec;
13375 static hda_nid_t alc268_ignore[] = { 0 };
13377 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13381 if (!spec->autocfg.line_outs) {
13382 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13383 spec->multiout.max_channels = 2;
13384 spec->no_analog = 1;
13387 return 0; /* can't find valid BIOS pin config */
13389 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13392 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13396 spec->multiout.max_channels = 2;
13399 /* digital only support output */
13400 alc_auto_parse_digital(codec);
13401 if (spec->kctls.list)
13402 add_mixer(spec, spec->kctls.list);
13404 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13405 add_mixer(spec, alc268_beep_mixer);
13407 add_verb(spec, alc268_volume_init_verbs);
13408 spec->num_mux_defs = 2;
13409 spec->input_mux = &spec->private_imux[0];
13411 err = alc_auto_add_mic_boost(codec);
13415 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13420 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13422 /* init callback for auto-configuration model -- overriding the default init */
13423 static void alc268_auto_init(struct hda_codec *codec)
13425 struct alc_spec *spec = codec->spec;
13426 alc268_auto_init_multi_out(codec);
13427 alc268_auto_init_hp_out(codec);
13428 alc268_auto_init_mono_speaker_out(codec);
13429 alc268_auto_init_analog_input(codec);
13430 alc_auto_init_digital(codec);
13431 if (spec->unsol_event)
13432 alc_inithook(codec);
13436 * configuration and preset
13438 static const char *alc268_models[ALC268_MODEL_LAST] = {
13439 [ALC267_QUANTA_IL1] = "quanta-il1",
13440 [ALC268_3ST] = "3stack",
13441 [ALC268_TOSHIBA] = "toshiba",
13442 [ALC268_ACER] = "acer",
13443 [ALC268_ACER_DMIC] = "acer-dmic",
13444 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13445 [ALC268_DELL] = "dell",
13446 [ALC268_ZEPTO] = "zepto",
13447 #ifdef CONFIG_SND_DEBUG
13448 [ALC268_TEST] = "test",
13450 [ALC268_AUTO] = "auto",
13453 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13454 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13455 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13456 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13457 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13458 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13459 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13460 ALC268_ACER_ASPIRE_ONE),
13461 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13462 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13463 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13464 /* almost compatible with toshiba but with optional digital outs;
13465 * auto-probing seems working fine
13467 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13469 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13470 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13471 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13472 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13473 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13477 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13478 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13479 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13480 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13481 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13486 static struct alc_config_preset alc268_presets[] = {
13487 [ALC267_QUANTA_IL1] = {
13488 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13489 alc268_capture_nosrc_mixer },
13490 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13491 alc267_quanta_il1_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,
13497 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13498 .channel_mode = alc268_modes,
13499 .unsol_event = alc_sku_unsol_event,
13500 .setup = alc267_quanta_il1_setup,
13501 .init_hook = alc_inithook,
13504 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13505 alc268_beep_mixer },
13506 .init_verbs = { alc268_base_init_verbs },
13507 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13508 .dac_nids = alc268_dac_nids,
13509 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13510 .adc_nids = alc268_adc_nids_alt,
13511 .capsrc_nids = alc268_capsrc_nids,
13513 .dig_out_nid = ALC268_DIGOUT_NID,
13514 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13515 .channel_mode = alc268_modes,
13516 .input_mux = &alc268_capture_source,
13518 [ALC268_TOSHIBA] = {
13519 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13520 alc268_beep_mixer },
13521 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13522 alc268_toshiba_verbs },
13523 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13524 .dac_nids = alc268_dac_nids,
13525 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13526 .adc_nids = alc268_adc_nids_alt,
13527 .capsrc_nids = alc268_capsrc_nids,
13529 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13530 .channel_mode = alc268_modes,
13531 .input_mux = &alc268_capture_source,
13532 .unsol_event = alc268_toshiba_unsol_event,
13533 .setup = alc268_toshiba_setup,
13534 .init_hook = alc268_toshiba_automute,
13537 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13538 alc268_beep_mixer },
13539 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13540 alc268_acer_verbs },
13541 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13542 .dac_nids = alc268_dac_nids,
13543 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13544 .adc_nids = alc268_adc_nids_alt,
13545 .capsrc_nids = alc268_capsrc_nids,
13547 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13548 .channel_mode = alc268_modes,
13549 .input_mux = &alc268_acer_capture_source,
13550 .unsol_event = alc268_acer_unsol_event,
13551 .init_hook = alc268_acer_init_hook,
13553 [ALC268_ACER_DMIC] = {
13554 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13555 alc268_beep_mixer },
13556 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13557 alc268_acer_verbs },
13558 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13559 .dac_nids = alc268_dac_nids,
13560 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13561 .adc_nids = alc268_adc_nids_alt,
13562 .capsrc_nids = alc268_capsrc_nids,
13564 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13565 .channel_mode = alc268_modes,
13566 .input_mux = &alc268_acer_dmic_capture_source,
13567 .unsol_event = alc268_acer_unsol_event,
13568 .init_hook = alc268_acer_init_hook,
13570 [ALC268_ACER_ASPIRE_ONE] = {
13571 .mixers = { alc268_acer_aspire_one_mixer,
13573 alc268_capture_nosrc_mixer },
13574 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13575 alc268_acer_aspire_one_verbs },
13576 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13577 .dac_nids = alc268_dac_nids,
13578 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13579 .adc_nids = alc268_adc_nids_alt,
13580 .capsrc_nids = alc268_capsrc_nids,
13582 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13583 .channel_mode = alc268_modes,
13584 .unsol_event = alc268_acer_lc_unsol_event,
13585 .setup = alc268_acer_lc_setup,
13586 .init_hook = alc268_acer_lc_init_hook,
13589 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13590 alc268_capture_nosrc_mixer },
13591 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13592 alc268_dell_verbs },
13593 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13594 .dac_nids = alc268_dac_nids,
13595 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13596 .adc_nids = alc268_adc_nids_alt,
13597 .capsrc_nids = alc268_capsrc_nids,
13599 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13600 .channel_mode = alc268_modes,
13601 .unsol_event = alc_sku_unsol_event,
13602 .setup = alc268_dell_setup,
13603 .init_hook = alc_inithook,
13606 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13607 alc268_beep_mixer },
13608 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13609 alc268_toshiba_verbs },
13610 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13611 .dac_nids = alc268_dac_nids,
13612 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13613 .adc_nids = alc268_adc_nids_alt,
13614 .capsrc_nids = alc268_capsrc_nids,
13616 .dig_out_nid = ALC268_DIGOUT_NID,
13617 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13618 .channel_mode = alc268_modes,
13619 .input_mux = &alc268_capture_source,
13620 .setup = alc268_toshiba_setup,
13621 .init_hook = alc268_toshiba_automute,
13623 #ifdef CONFIG_SND_DEBUG
13625 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13626 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13627 alc268_volume_init_verbs },
13628 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13629 .dac_nids = alc268_dac_nids,
13630 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13631 .adc_nids = alc268_adc_nids_alt,
13632 .capsrc_nids = alc268_capsrc_nids,
13634 .dig_out_nid = ALC268_DIGOUT_NID,
13635 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13636 .channel_mode = alc268_modes,
13637 .input_mux = &alc268_capture_source,
13642 static int patch_alc268(struct hda_codec *codec)
13644 struct alc_spec *spec;
13646 int i, has_beep, err;
13648 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13652 codec->spec = spec;
13654 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13658 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13659 board_config = snd_hda_check_board_codec_sid_config(codec,
13660 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13662 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13663 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13665 board_config = ALC268_AUTO;
13668 if (board_config == ALC268_AUTO) {
13669 /* automatic parse from the BIOS config */
13670 err = alc268_parse_auto_config(codec);
13676 "hda_codec: Cannot set up configuration "
13677 "from BIOS. Using base mode...\n");
13678 board_config = ALC268_3ST;
13682 if (board_config != ALC268_AUTO)
13683 setup_preset(codec, &alc268_presets[board_config]);
13685 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13686 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13687 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13689 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13692 for (i = 0; i < spec->num_mixers; i++) {
13693 if (spec->mixers[i] == alc268_beep_mixer) {
13700 err = snd_hda_attach_beep_device(codec, 0x1);
13705 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13706 /* override the amp caps for beep generator */
13707 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13708 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13709 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13710 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13711 (0 << AC_AMPCAP_MUTE_SHIFT));
13714 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13715 /* check whether NID 0x07 is valid */
13716 unsigned int wcap = get_wcaps(codec, 0x07);
13719 spec->capsrc_nids = alc268_capsrc_nids;
13721 wcap = get_wcaps_type(wcap);
13722 if (spec->auto_mic ||
13723 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13724 spec->adc_nids = alc268_adc_nids_alt;
13725 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13726 if (spec->auto_mic)
13727 fixup_automic_adc(codec);
13728 if (spec->auto_mic || spec->input_mux->num_items == 1)
13729 add_mixer(spec, alc268_capture_nosrc_mixer);
13731 add_mixer(spec, alc268_capture_alt_mixer);
13733 spec->adc_nids = alc268_adc_nids;
13734 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13735 add_mixer(spec, alc268_capture_mixer);
13737 /* set default input source */
13738 for (i = 0; i < spec->num_adc_nids; i++)
13739 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13740 0, AC_VERB_SET_CONNECT_SEL,
13741 i < spec->num_mux_defs ?
13742 spec->input_mux[i].items[0].index :
13743 spec->input_mux->items[0].index);
13746 spec->vmaster_nid = 0x02;
13748 codec->patch_ops = alc_patch_ops;
13749 if (board_config == ALC268_AUTO)
13750 spec->init_hook = alc268_auto_init;
13756 * ALC269 channel source setting (2 channel)
13758 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13760 #define alc269_dac_nids alc260_dac_nids
13762 static hda_nid_t alc269_adc_nids[1] = {
13767 static hda_nid_t alc269_capsrc_nids[1] = {
13771 static hda_nid_t alc269vb_adc_nids[1] = {
13776 static hda_nid_t alc269vb_capsrc_nids[1] = {
13780 static hda_nid_t alc269_adc_candidates[] = {
13784 #define alc269_modes alc260_modes
13785 #define alc269_capture_source alc880_lg_lw_capture_source
13787 static struct snd_kcontrol_new alc269_base_mixer[] = {
13788 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13789 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13790 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13791 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13795 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13797 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13798 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13799 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13803 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13804 /* output mixer control */
13805 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13808 .name = "Master Playback Switch",
13809 .subdevice = HDA_SUBDEV_AMP_FLAG,
13810 .info = snd_hda_mixer_amp_switch_info,
13811 .get = snd_hda_mixer_amp_switch_get,
13812 .put = alc268_acer_master_sw_put,
13813 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13818 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13819 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13820 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13824 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13825 /* output mixer control */
13826 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13828 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13829 .name = "Master Playback Switch",
13830 .subdevice = HDA_SUBDEV_AMP_FLAG,
13831 .info = snd_hda_mixer_amp_switch_info,
13832 .get = snd_hda_mixer_amp_switch_get,
13833 .put = alc268_acer_master_sw_put,
13834 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13836 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13837 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13839 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13840 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13841 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13842 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13843 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13844 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13848 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13849 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13850 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13851 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13852 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13856 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13857 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13858 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13860 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13864 static struct snd_kcontrol_new alc269_asus_mixer[] = {
13865 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13866 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
13870 /* capture mixer elements */
13871 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13872 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13873 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13874 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13875 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13879 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13880 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13881 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13882 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13886 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13887 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13888 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13890 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13894 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13895 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13896 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13897 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13902 #define alc269_fujitsu_mixer alc269_laptop_mixer
13904 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13905 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13906 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13907 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13908 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13909 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13910 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13914 static struct hda_verb alc269_lifebook_verbs[] = {
13915 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13916 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13917 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13919 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13920 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13921 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13922 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13923 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13924 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13928 /* toggle speaker-output according to the hp-jack state */
13929 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13931 unsigned int present;
13932 unsigned char bits;
13934 present = snd_hda_jack_detect(codec, 0x15);
13935 bits = present ? HDA_AMP_MUTE : 0;
13936 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13937 HDA_AMP_MUTE, bits);
13938 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13939 HDA_AMP_MUTE, bits);
13941 snd_hda_codec_write(codec, 0x20, 0,
13942 AC_VERB_SET_COEF_INDEX, 0x0c);
13943 snd_hda_codec_write(codec, 0x20, 0,
13944 AC_VERB_SET_PROC_COEF, 0x680);
13946 snd_hda_codec_write(codec, 0x20, 0,
13947 AC_VERB_SET_COEF_INDEX, 0x0c);
13948 snd_hda_codec_write(codec, 0x20, 0,
13949 AC_VERB_SET_PROC_COEF, 0x480);
13952 /* toggle speaker-output according to the hp-jacks state */
13953 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13955 unsigned int present;
13956 unsigned char bits;
13958 /* Check laptop headphone socket */
13959 present = snd_hda_jack_detect(codec, 0x15);
13961 /* Check port replicator headphone socket */
13962 present |= snd_hda_jack_detect(codec, 0x1a);
13964 bits = present ? HDA_AMP_MUTE : 0;
13965 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13966 HDA_AMP_MUTE, bits);
13967 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13968 HDA_AMP_MUTE, bits);
13970 snd_hda_codec_write(codec, 0x20, 0,
13971 AC_VERB_SET_COEF_INDEX, 0x0c);
13972 snd_hda_codec_write(codec, 0x20, 0,
13973 AC_VERB_SET_PROC_COEF, 0x680);
13975 snd_hda_codec_write(codec, 0x20, 0,
13976 AC_VERB_SET_COEF_INDEX, 0x0c);
13977 snd_hda_codec_write(codec, 0x20, 0,
13978 AC_VERB_SET_PROC_COEF, 0x480);
13981 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13983 unsigned int present_laptop;
13984 unsigned int present_dock;
13986 present_laptop = snd_hda_jack_detect(codec, 0x18);
13987 present_dock = snd_hda_jack_detect(codec, 0x1b);
13989 /* Laptop mic port overrides dock mic port, design decision */
13991 snd_hda_codec_write(codec, 0x23, 0,
13992 AC_VERB_SET_CONNECT_SEL, 0x3);
13993 if (present_laptop)
13994 snd_hda_codec_write(codec, 0x23, 0,
13995 AC_VERB_SET_CONNECT_SEL, 0x0);
13996 if (!present_dock && !present_laptop)
13997 snd_hda_codec_write(codec, 0x23, 0,
13998 AC_VERB_SET_CONNECT_SEL, 0x1);
14001 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14004 switch (res >> 26) {
14005 case ALC880_HP_EVENT:
14006 alc269_quanta_fl1_speaker_automute(codec);
14008 case ALC880_MIC_EVENT:
14009 alc_mic_automute(codec);
14014 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14017 if ((res >> 26) == ALC880_HP_EVENT)
14018 alc269_lifebook_speaker_automute(codec);
14019 if ((res >> 26) == ALC880_MIC_EVENT)
14020 alc269_lifebook_mic_autoswitch(codec);
14023 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14025 struct alc_spec *spec = codec->spec;
14026 spec->autocfg.hp_pins[0] = 0x15;
14027 spec->autocfg.speaker_pins[0] = 0x14;
14028 spec->ext_mic.pin = 0x18;
14029 spec->ext_mic.mux_idx = 0;
14030 spec->int_mic.pin = 0x19;
14031 spec->int_mic.mux_idx = 1;
14032 spec->auto_mic = 1;
14035 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14037 alc269_quanta_fl1_speaker_automute(codec);
14038 alc_mic_automute(codec);
14041 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14043 alc269_lifebook_speaker_automute(codec);
14044 alc269_lifebook_mic_autoswitch(codec);
14047 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14048 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14049 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14050 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14051 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14052 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14053 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14054 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14058 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14059 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14060 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14061 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14063 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14068 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14069 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14070 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14071 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14073 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14074 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14075 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14079 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14080 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14081 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14082 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14083 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14084 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14085 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14086 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14090 static struct hda_verb alc271_acer_dmic_verbs[] = {
14091 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14092 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14093 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14095 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14096 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14097 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14098 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14099 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14100 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14104 /* toggle speaker-output according to the hp-jack state */
14105 static void alc269_speaker_automute(struct hda_codec *codec)
14107 struct alc_spec *spec = codec->spec;
14108 unsigned int nid = spec->autocfg.hp_pins[0];
14109 unsigned int present;
14110 unsigned char bits;
14112 present = snd_hda_jack_detect(codec, nid);
14113 bits = present ? HDA_AMP_MUTE : 0;
14114 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14115 HDA_AMP_MUTE, bits);
14116 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14117 HDA_AMP_MUTE, bits);
14120 /* unsolicited event for HP jack sensing */
14121 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14124 switch (res >> 26) {
14125 case ALC880_HP_EVENT:
14126 alc269_speaker_automute(codec);
14128 case ALC880_MIC_EVENT:
14129 alc_mic_automute(codec);
14134 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14136 struct alc_spec *spec = codec->spec;
14137 spec->autocfg.hp_pins[0] = 0x15;
14138 spec->autocfg.speaker_pins[0] = 0x14;
14139 spec->ext_mic.pin = 0x18;
14140 spec->ext_mic.mux_idx = 0;
14141 spec->int_mic.pin = 0x19;
14142 spec->int_mic.mux_idx = 1;
14143 spec->auto_mic = 1;
14146 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14148 struct alc_spec *spec = codec->spec;
14149 spec->autocfg.hp_pins[0] = 0x15;
14150 spec->autocfg.speaker_pins[0] = 0x14;
14151 spec->ext_mic.pin = 0x18;
14152 spec->ext_mic.mux_idx = 0;
14153 spec->int_mic.pin = 0x12;
14154 spec->int_mic.mux_idx = 5;
14155 spec->auto_mic = 1;
14158 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14160 struct alc_spec *spec = codec->spec;
14161 spec->autocfg.hp_pins[0] = 0x21;
14162 spec->autocfg.speaker_pins[0] = 0x14;
14163 spec->ext_mic.pin = 0x18;
14164 spec->ext_mic.mux_idx = 0;
14165 spec->int_mic.pin = 0x19;
14166 spec->int_mic.mux_idx = 1;
14167 spec->auto_mic = 1;
14170 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14172 struct alc_spec *spec = codec->spec;
14173 spec->autocfg.hp_pins[0] = 0x21;
14174 spec->autocfg.speaker_pins[0] = 0x14;
14175 spec->ext_mic.pin = 0x18;
14176 spec->ext_mic.mux_idx = 0;
14177 spec->int_mic.pin = 0x12;
14178 spec->int_mic.mux_idx = 6;
14179 spec->auto_mic = 1;
14182 static void alc269_laptop_inithook(struct hda_codec *codec)
14184 alc269_speaker_automute(codec);
14185 alc_mic_automute(codec);
14189 * generic initialization of ADC, input mixers and output mixers
14191 static struct hda_verb alc269_init_verbs[] = {
14193 * Unmute ADC0 and set the default input to mic-in
14195 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14198 * Set up output mixers (0x02 - 0x03)
14200 /* set vol=0 to output mixers */
14201 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14202 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14204 /* set up input amps for analog loopback */
14205 /* Amp Indices: DAC = 0, mixer = 1 */
14206 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14209 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14210 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14215 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14216 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14219 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14224 /* FIXME: use Mux-type input source selection */
14225 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14226 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14227 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14230 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14234 static struct hda_verb alc269vb_init_verbs[] = {
14236 * Unmute ADC0 and set the default input to mic-in
14238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14241 * Set up output mixers (0x02 - 0x03)
14243 /* set vol=0 to output mixers */
14244 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14245 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14247 /* set up input amps for analog loopback */
14248 /* Amp Indices: DAC = 0, mixer = 1 */
14249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14253 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14256 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14257 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14258 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14259 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14260 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14261 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14262 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14264 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14265 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14267 /* FIXME: use Mux-type input source selection */
14268 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14269 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14270 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14273 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14277 #define alc269_auto_create_multi_out_ctls \
14278 alc268_auto_create_multi_out_ctls
14279 #define alc269_auto_create_input_ctls \
14280 alc268_auto_create_input_ctls
14282 #ifdef CONFIG_SND_HDA_POWER_SAVE
14283 #define alc269_loopbacks alc880_loopbacks
14286 /* pcm configuration: identical with ALC880 */
14287 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14288 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14289 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14290 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14292 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14296 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14297 /* NID is set in alc_build_pcms */
14299 .open = alc880_playback_pcm_open,
14300 .prepare = alc880_playback_pcm_prepare,
14301 .cleanup = alc880_playback_pcm_cleanup
14305 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14309 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14310 /* NID is set in alc_build_pcms */
14313 #ifdef CONFIG_SND_HDA_POWER_SAVE
14314 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14316 switch (codec->subsystem_id) {
14323 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14325 /* update mute-LED according to the speaker mute state */
14326 if (nid == 0x01 || nid == 0x14) {
14328 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14333 /* mic2 vref pin is used for mute LED control */
14334 snd_hda_codec_update_cache(codec, 0x19, 0,
14335 AC_VERB_SET_PIN_WIDGET_CONTROL,
14338 return alc_check_power_status(codec, nid);
14340 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14342 static int alc275_setup_dual_adc(struct hda_codec *codec)
14344 struct alc_spec *spec = codec->spec;
14346 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14348 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14349 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14350 if (spec->ext_mic.pin <= 0x12) {
14351 spec->private_adc_nids[0] = 0x08;
14352 spec->private_adc_nids[1] = 0x11;
14353 spec->private_capsrc_nids[0] = 0x23;
14354 spec->private_capsrc_nids[1] = 0x22;
14356 spec->private_adc_nids[0] = 0x11;
14357 spec->private_adc_nids[1] = 0x08;
14358 spec->private_capsrc_nids[0] = 0x22;
14359 spec->private_capsrc_nids[1] = 0x23;
14361 spec->adc_nids = spec->private_adc_nids;
14362 spec->capsrc_nids = spec->private_capsrc_nids;
14363 spec->num_adc_nids = 2;
14364 spec->dual_adc_switch = 1;
14365 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14366 spec->adc_nids[0], spec->adc_nids[1]);
14373 * BIOS auto configuration
14375 static int alc269_parse_auto_config(struct hda_codec *codec)
14377 struct alc_spec *spec = codec->spec;
14379 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14381 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14386 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14389 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14393 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14395 alc_auto_parse_digital(codec);
14397 if (spec->kctls.list)
14398 add_mixer(spec, spec->kctls.list);
14400 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14401 add_verb(spec, alc269vb_init_verbs);
14402 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14404 add_verb(spec, alc269_init_verbs);
14405 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14408 spec->num_mux_defs = 1;
14409 spec->input_mux = &spec->private_imux[0];
14411 if (!alc275_setup_dual_adc(codec))
14412 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14413 sizeof(alc269_adc_candidates));
14415 /* set default input source */
14416 if (!spec->dual_adc_switch)
14417 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14418 spec->input_mux->items[0].index);
14420 err = alc_auto_add_mic_boost(codec);
14424 if (!spec->cap_mixer && !spec->no_analog)
14425 set_capture_mixer(codec);
14430 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14431 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14432 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14435 /* init callback for auto-configuration model -- overriding the default init */
14436 static void alc269_auto_init(struct hda_codec *codec)
14438 struct alc_spec *spec = codec->spec;
14439 alc269_auto_init_multi_out(codec);
14440 alc269_auto_init_hp_out(codec);
14441 alc269_auto_init_analog_input(codec);
14442 alc_auto_init_digital(codec);
14443 if (spec->unsol_event)
14444 alc_inithook(codec);
14448 ALC269_FIXUP_SONY_VAIO,
14451 static const struct alc_fixup alc269_fixups[] = {
14452 [ALC269_FIXUP_SONY_VAIO] = {
14453 .verbs = (const struct hda_verb[]) {
14454 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14460 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14461 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14462 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14468 * configuration and preset
14470 static const char *alc269_models[ALC269_MODEL_LAST] = {
14471 [ALC269_BASIC] = "basic",
14472 [ALC269_QUANTA_FL1] = "quanta",
14473 [ALC269_AMIC] = "laptop-amic",
14474 [ALC269_DMIC] = "laptop-dmic",
14475 [ALC269_FUJITSU] = "fujitsu",
14476 [ALC269_LIFEBOOK] = "lifebook",
14477 [ALC269_AUTO] = "auto",
14480 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14481 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14482 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14483 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14485 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14486 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14487 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14488 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14489 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14490 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14491 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14492 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14493 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14494 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14495 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14496 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14497 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14498 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14499 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14500 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14501 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14502 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14503 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14504 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14505 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14506 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14507 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14508 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14509 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14510 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14511 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14512 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14513 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14514 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14515 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14516 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14517 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14518 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14519 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14520 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14521 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14523 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14525 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14526 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14527 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14528 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14529 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14530 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14531 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14532 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14533 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14534 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14538 static struct alc_config_preset alc269_presets[] = {
14540 .mixers = { alc269_base_mixer },
14541 .init_verbs = { alc269_init_verbs },
14542 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14543 .dac_nids = alc269_dac_nids,
14545 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14546 .channel_mode = alc269_modes,
14547 .input_mux = &alc269_capture_source,
14549 [ALC269_QUANTA_FL1] = {
14550 .mixers = { alc269_quanta_fl1_mixer },
14551 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14552 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14553 .dac_nids = alc269_dac_nids,
14555 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14556 .channel_mode = alc269_modes,
14557 .input_mux = &alc269_capture_source,
14558 .unsol_event = alc269_quanta_fl1_unsol_event,
14559 .setup = alc269_quanta_fl1_setup,
14560 .init_hook = alc269_quanta_fl1_init_hook,
14563 .mixers = { alc269_laptop_mixer },
14564 .cap_mixer = alc269_laptop_analog_capture_mixer,
14565 .init_verbs = { alc269_init_verbs,
14566 alc269_laptop_amic_init_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 .unsol_event = alc269_laptop_unsol_event,
14573 .setup = alc269_laptop_amic_setup,
14574 .init_hook = alc269_laptop_inithook,
14577 .mixers = { alc269_laptop_mixer },
14578 .cap_mixer = alc269_laptop_digital_capture_mixer,
14579 .init_verbs = { alc269_init_verbs,
14580 alc269_laptop_dmic_init_verbs },
14581 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14582 .dac_nids = alc269_dac_nids,
14584 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14585 .channel_mode = alc269_modes,
14586 .unsol_event = alc269_laptop_unsol_event,
14587 .setup = alc269_laptop_dmic_setup,
14588 .init_hook = alc269_laptop_inithook,
14590 [ALC269VB_AMIC] = {
14591 .mixers = { alc269vb_laptop_mixer },
14592 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14593 .init_verbs = { alc269vb_init_verbs,
14594 alc269vb_laptop_amic_init_verbs },
14595 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14596 .dac_nids = alc269_dac_nids,
14598 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14599 .channel_mode = alc269_modes,
14600 .unsol_event = alc269_laptop_unsol_event,
14601 .setup = alc269vb_laptop_amic_setup,
14602 .init_hook = alc269_laptop_inithook,
14604 [ALC269VB_DMIC] = {
14605 .mixers = { alc269vb_laptop_mixer },
14606 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14607 .init_verbs = { alc269vb_init_verbs,
14608 alc269vb_laptop_dmic_init_verbs },
14609 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14610 .dac_nids = alc269_dac_nids,
14612 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14613 .channel_mode = alc269_modes,
14614 .unsol_event = alc269_laptop_unsol_event,
14615 .setup = alc269vb_laptop_dmic_setup,
14616 .init_hook = alc269_laptop_inithook,
14618 [ALC269_FUJITSU] = {
14619 .mixers = { alc269_fujitsu_mixer },
14620 .cap_mixer = alc269_laptop_digital_capture_mixer,
14621 .init_verbs = { alc269_init_verbs,
14622 alc269_laptop_dmic_init_verbs },
14623 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14624 .dac_nids = alc269_dac_nids,
14626 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14627 .channel_mode = alc269_modes,
14628 .unsol_event = alc269_laptop_unsol_event,
14629 .setup = alc269_laptop_dmic_setup,
14630 .init_hook = alc269_laptop_inithook,
14632 [ALC269_LIFEBOOK] = {
14633 .mixers = { alc269_lifebook_mixer },
14634 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14635 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14636 .dac_nids = alc269_dac_nids,
14638 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14639 .channel_mode = alc269_modes,
14640 .input_mux = &alc269_capture_source,
14641 .unsol_event = alc269_lifebook_unsol_event,
14642 .init_hook = alc269_lifebook_init_hook,
14645 .mixers = { alc269_asus_mixer },
14646 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14647 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
14648 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14649 .dac_nids = alc269_dac_nids,
14650 .adc_nids = alc262_dmic_adc_nids,
14651 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
14652 .capsrc_nids = alc262_dmic_capsrc_nids,
14653 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14654 .channel_mode = alc269_modes,
14655 .input_mux = &alc269_capture_source,
14656 .dig_out_nid = ALC880_DIGOUT_NID,
14657 .unsol_event = alc_sku_unsol_event,
14658 .setup = alc269vb_laptop_dmic_setup,
14659 .init_hook = alc_inithook,
14663 static int patch_alc269(struct hda_codec *codec)
14665 struct alc_spec *spec;
14668 int is_alc269vb = 0;
14670 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14674 codec->spec = spec;
14676 alc_auto_parse_customize_define(codec);
14678 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14679 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14680 spec->cdefine.platform_type == 1)
14681 alc_codec_rename(codec, "ALC271X");
14683 alc_codec_rename(codec, "ALC259");
14686 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14688 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14692 if (board_config < 0) {
14693 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14695 board_config = ALC269_AUTO;
14698 if (board_config == ALC269_AUTO)
14699 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14701 if (board_config == ALC269_AUTO) {
14702 /* automatic parse from the BIOS config */
14703 err = alc269_parse_auto_config(codec);
14709 "hda_codec: Cannot set up configuration "
14710 "from BIOS. Using base mode...\n");
14711 board_config = ALC269_BASIC;
14715 if (has_cdefine_beep(codec)) {
14716 err = snd_hda_attach_beep_device(codec, 0x1);
14723 if (board_config != ALC269_AUTO)
14724 setup_preset(codec, &alc269_presets[board_config]);
14726 if (board_config == ALC269_QUANTA_FL1) {
14727 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14728 * fix the sample rate of analog I/O to 44.1kHz
14730 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14731 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14732 } else if (spec->dual_adc_switch) {
14733 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14734 /* switch ADC dynamically */
14735 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14737 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14738 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14740 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14741 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14743 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14744 if (!is_alc269vb) {
14745 spec->adc_nids = alc269_adc_nids;
14746 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14747 spec->capsrc_nids = alc269_capsrc_nids;
14749 spec->adc_nids = alc269vb_adc_nids;
14750 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14751 spec->capsrc_nids = alc269vb_capsrc_nids;
14755 if (!spec->cap_mixer)
14756 set_capture_mixer(codec);
14757 if (has_cdefine_beep(codec))
14758 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14760 if (board_config == ALC269_AUTO)
14761 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14763 spec->vmaster_nid = 0x02;
14765 codec->patch_ops = alc_patch_ops;
14766 if (board_config == ALC269_AUTO)
14767 spec->init_hook = alc269_auto_init;
14768 #ifdef CONFIG_SND_HDA_POWER_SAVE
14769 if (!spec->loopback.amplist)
14770 spec->loopback.amplist = alc269_loopbacks;
14771 if (alc269_mic2_for_mute_led(codec))
14772 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14779 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14783 * set the path ways for 2 channel output
14784 * need to set the codec line out and mic 1 pin widgets to inputs
14786 static struct hda_verb alc861_threestack_ch2_init[] = {
14787 /* set pin widget 1Ah (line in) for input */
14788 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14789 /* set pin widget 18h (mic1/2) for input, for mic also enable
14792 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14794 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14796 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14797 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14803 * need to set the codec line out and mic 1 pin widgets to outputs
14805 static struct hda_verb alc861_threestack_ch6_init[] = {
14806 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14807 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14808 /* set pin widget 18h (mic1) for output (CLFE)*/
14809 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14811 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14812 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14814 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14816 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14817 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14822 static struct hda_channel_mode alc861_threestack_modes[2] = {
14823 { 2, alc861_threestack_ch2_init },
14824 { 6, alc861_threestack_ch6_init },
14826 /* Set mic1 as input and unmute the mixer */
14827 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14828 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14829 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14832 /* Set mic1 as output and mute mixer */
14833 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14834 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14835 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14839 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14840 { 2, alc861_uniwill_m31_ch2_init },
14841 { 4, alc861_uniwill_m31_ch4_init },
14844 /* Set mic1 and line-in as input and unmute the mixer */
14845 static struct hda_verb alc861_asus_ch2_init[] = {
14846 /* set pin widget 1Ah (line in) for input */
14847 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14848 /* set pin widget 18h (mic1/2) for input, for mic also enable
14851 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14853 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14855 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14856 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14860 /* Set mic1 nad line-in as output and mute mixer */
14861 static struct hda_verb alc861_asus_ch6_init[] = {
14862 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14863 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14864 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14865 /* set pin widget 18h (mic1) for output (CLFE)*/
14866 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14867 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14868 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14869 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14871 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14873 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14874 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14879 static struct hda_channel_mode alc861_asus_modes[2] = {
14880 { 2, alc861_asus_ch2_init },
14881 { 6, alc861_asus_ch6_init },
14886 static struct snd_kcontrol_new alc861_base_mixer[] = {
14887 /* output mixer control */
14888 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14889 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14890 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14891 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14892 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14894 /*Input mixer control */
14895 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14896 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14897 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14898 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14899 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14900 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14902 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14903 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14909 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14910 /* output mixer control */
14911 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14912 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14913 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14914 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14915 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14917 /* Input mixer control */
14918 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14919 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14920 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14921 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14922 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14923 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14925 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14926 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14927 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14930 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14931 .name = "Channel Mode",
14932 .info = alc_ch_mode_info,
14933 .get = alc_ch_mode_get,
14934 .put = alc_ch_mode_put,
14935 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14940 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14941 /* output mixer control */
14942 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14943 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14944 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14949 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14950 /* output mixer control */
14951 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14952 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14953 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14954 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14955 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14957 /* Input mixer control */
14958 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14959 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14960 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14961 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14962 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14963 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14964 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14965 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14966 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14970 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14971 .name = "Channel Mode",
14972 .info = alc_ch_mode_info,
14973 .get = alc_ch_mode_get,
14974 .put = alc_ch_mode_put,
14975 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14980 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14981 /* output mixer control */
14982 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14983 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14984 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14985 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14986 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14988 /* Input mixer control */
14989 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14990 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14991 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14992 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14993 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14994 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14996 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14998 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15001 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15002 .name = "Channel Mode",
15003 .info = alc_ch_mode_info,
15004 .get = alc_ch_mode_get,
15005 .put = alc_ch_mode_put,
15006 .private_value = ARRAY_SIZE(alc861_asus_modes),
15011 /* additional mixer */
15012 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15013 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15014 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15019 * generic initialization of ADC, input mixers and output mixers
15021 static struct hda_verb alc861_base_init_verbs[] = {
15023 * Unmute ADC0 and set the default input to mic-in
15025 /* port-A for surround (rear panel) */
15026 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15027 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15028 /* port-B for mic-in (rear panel) with vref */
15029 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15030 /* port-C for line-in (rear panel) */
15031 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15032 /* port-D for Front */
15033 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15034 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15035 /* port-E for HP out (front panel) */
15036 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15037 /* route front PCM to HP */
15038 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15039 /* port-F for mic-in (front panel) with vref */
15040 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15041 /* port-G for CLFE (rear panel) */
15042 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15043 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15044 /* port-H for side (rear panel) */
15045 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15046 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15048 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15049 /* route front mic to ADC1*/
15050 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15051 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15053 /* Unmute DAC0~3 & spdif out*/
15054 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15055 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15056 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15057 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15060 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15061 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15062 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15063 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15064 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15066 /* Unmute Stereo Mixer 15 */
15067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15072 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15074 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15077 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15079 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15080 /* hp used DAC 3 (Front) */
15081 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15082 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15087 static struct hda_verb alc861_threestack_init_verbs[] = {
15089 * Unmute ADC0 and set the default input to mic-in
15091 /* port-A for surround (rear panel) */
15092 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15093 /* port-B for mic-in (rear panel) with vref */
15094 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15095 /* port-C for line-in (rear panel) */
15096 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15097 /* port-D for Front */
15098 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15099 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15100 /* port-E for HP out (front panel) */
15101 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15102 /* route front PCM to HP */
15103 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15104 /* port-F for mic-in (front panel) with vref */
15105 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15106 /* port-G for CLFE (rear panel) */
15107 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15108 /* port-H for side (rear panel) */
15109 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15111 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15112 /* route front mic to ADC1*/
15113 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15114 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15115 /* Unmute DAC0~3 & spdif out*/
15116 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15117 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15118 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15119 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15122 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15123 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15124 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15125 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15126 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15128 /* Unmute Stereo Mixer 15 */
15129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15130 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15131 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15134 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15136 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15137 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15138 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15139 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15140 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15142 /* hp used DAC 3 (Front) */
15143 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15144 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15148 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15150 * Unmute ADC0 and set the default input to mic-in
15152 /* port-A for surround (rear panel) */
15153 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15154 /* port-B for mic-in (rear panel) with vref */
15155 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15156 /* port-C for line-in (rear panel) */
15157 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15158 /* port-D for Front */
15159 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15160 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15161 /* port-E for HP out (front panel) */
15162 /* this has to be set to VREF80 */
15163 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15164 /* route front PCM to HP */
15165 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15166 /* port-F for mic-in (front panel) with vref */
15167 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15168 /* port-G for CLFE (rear panel) */
15169 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15170 /* port-H for side (rear panel) */
15171 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15173 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15174 /* route front mic to ADC1*/
15175 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15176 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15177 /* Unmute DAC0~3 & spdif out*/
15178 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15179 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15180 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15181 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15184 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15185 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15186 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15187 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15188 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15190 /* Unmute Stereo Mixer 15 */
15191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15194 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15196 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15197 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15198 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15199 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15201 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15202 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15203 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15204 /* hp used DAC 3 (Front) */
15205 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15206 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15210 static struct hda_verb alc861_asus_init_verbs[] = {
15212 * Unmute ADC0 and set the default input to mic-in
15214 /* port-A for surround (rear panel)
15215 * according to codec#0 this is the HP jack
15217 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15218 /* route front PCM to HP */
15219 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15220 /* port-B for mic-in (rear panel) with vref */
15221 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15222 /* port-C for line-in (rear panel) */
15223 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15224 /* port-D for Front */
15225 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15226 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15227 /* port-E for HP out (front panel) */
15228 /* this has to be set to VREF80 */
15229 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15230 /* route front PCM to HP */
15231 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15232 /* port-F for mic-in (front panel) with vref */
15233 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15234 /* port-G for CLFE (rear panel) */
15235 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15236 /* port-H for side (rear panel) */
15237 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15239 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15240 /* route front mic to ADC1*/
15241 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15243 /* Unmute DAC0~3 & spdif out*/
15244 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15245 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15246 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15247 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15249 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15250 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15251 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15252 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15253 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15255 /* Unmute Stereo Mixer 15 */
15256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15258 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15259 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15262 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15263 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15264 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15265 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15266 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15269 /* hp used DAC 3 (Front) */
15270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15275 /* additional init verbs for ASUS laptops */
15276 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15277 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15278 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15283 * generic initialization of ADC, input mixers and output mixers
15285 static struct hda_verb alc861_auto_init_verbs[] = {
15287 * Unmute ADC0 and set the default input to mic-in
15289 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15292 /* Unmute DAC0~3 & spdif out*/
15293 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15294 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15295 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15296 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15299 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15300 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15301 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15302 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15303 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15305 /* Unmute Stereo Mixer 15 */
15306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15312 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15313 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15314 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15316 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15317 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15320 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15322 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15323 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15324 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15325 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15326 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15327 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15329 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15334 static struct hda_verb alc861_toshiba_init_verbs[] = {
15335 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15340 /* toggle speaker-output according to the hp-jack state */
15341 static void alc861_toshiba_automute(struct hda_codec *codec)
15343 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15345 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15346 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15347 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15348 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15351 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15354 if ((res >> 26) == ALC880_HP_EVENT)
15355 alc861_toshiba_automute(codec);
15358 /* pcm configuration: identical with ALC880 */
15359 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15360 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15361 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15362 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15365 #define ALC861_DIGOUT_NID 0x07
15367 static struct hda_channel_mode alc861_8ch_modes[1] = {
15371 static hda_nid_t alc861_dac_nids[4] = {
15372 /* front, surround, clfe, side */
15373 0x03, 0x06, 0x05, 0x04
15376 static hda_nid_t alc660_dac_nids[3] = {
15377 /* front, clfe, surround */
15381 static hda_nid_t alc861_adc_nids[1] = {
15386 static struct hda_input_mux alc861_capture_source = {
15390 { "Front Mic", 0x3 },
15397 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15399 struct alc_spec *spec = codec->spec;
15400 hda_nid_t mix, srcs[5];
15403 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15405 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15408 for (i = 0; i < num; i++) {
15410 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15411 if (type != AC_WID_AUD_OUT)
15413 for (j = 0; j < spec->multiout.num_dacs; j++)
15414 if (spec->multiout.dac_nids[j] == srcs[i])
15416 if (j >= spec->multiout.num_dacs)
15422 /* fill in the dac_nids table from the parsed pin configuration */
15423 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15424 const struct auto_pin_cfg *cfg)
15426 struct alc_spec *spec = codec->spec;
15428 hda_nid_t nid, dac;
15430 spec->multiout.dac_nids = spec->private_dac_nids;
15431 for (i = 0; i < cfg->line_outs; i++) {
15432 nid = cfg->line_out_pins[i];
15433 dac = alc861_look_for_dac(codec, nid);
15436 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15441 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15442 hda_nid_t nid, unsigned int chs)
15444 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15445 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15448 /* add playback controls from the parsed DAC table */
15449 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15450 const struct auto_pin_cfg *cfg)
15452 struct alc_spec *spec = codec->spec;
15453 static const char *chname[4] = {
15454 "Front", "Surround", NULL /*CLFE*/, "Side"
15459 if (cfg->line_outs == 1) {
15460 const char *pfx = NULL;
15463 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15466 nid = spec->multiout.dac_nids[0];
15467 return alc861_create_out_sw(codec, pfx, nid, 3);
15471 for (i = 0; i < cfg->line_outs; i++) {
15472 nid = spec->multiout.dac_nids[i];
15477 err = alc861_create_out_sw(codec, "Center", nid, 1);
15480 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15484 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15492 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15494 struct alc_spec *spec = codec->spec;
15501 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15502 nid = alc861_look_for_dac(codec, pin);
15504 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15507 spec->multiout.hp_nid = nid;
15513 /* create playback/capture controls for input pins */
15514 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15515 const struct auto_pin_cfg *cfg)
15517 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15520 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15522 int pin_type, hda_nid_t dac)
15524 hda_nid_t mix, srcs[5];
15527 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15529 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15531 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15533 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15536 for (i = 0; i < num; i++) {
15538 if (srcs[i] == dac || srcs[i] == 0x15)
15539 mute = AMP_IN_UNMUTE(i);
15541 mute = AMP_IN_MUTE(i);
15542 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15547 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15549 struct alc_spec *spec = codec->spec;
15552 for (i = 0; i < spec->autocfg.line_outs; i++) {
15553 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15554 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15556 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15557 spec->multiout.dac_nids[i]);
15561 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15563 struct alc_spec *spec = codec->spec;
15565 if (spec->autocfg.hp_outs)
15566 alc861_auto_set_output_and_unmute(codec,
15567 spec->autocfg.hp_pins[0],
15569 spec->multiout.hp_nid);
15570 if (spec->autocfg.speaker_outs)
15571 alc861_auto_set_output_and_unmute(codec,
15572 spec->autocfg.speaker_pins[0],
15574 spec->multiout.dac_nids[0]);
15577 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15579 struct alc_spec *spec = codec->spec;
15582 for (i = 0; i < AUTO_PIN_LAST; i++) {
15583 hda_nid_t nid = spec->autocfg.input_pins[i];
15584 if (nid >= 0x0c && nid <= 0x11)
15585 alc_set_input_pin(codec, nid, i);
15589 /* parse the BIOS configuration and set up the alc_spec */
15590 /* return 1 if successful, 0 if the proper config is not found,
15591 * or a negative error code
15593 static int alc861_parse_auto_config(struct hda_codec *codec)
15595 struct alc_spec *spec = codec->spec;
15597 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15599 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15603 if (!spec->autocfg.line_outs)
15604 return 0; /* can't find valid BIOS pin config */
15606 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15609 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15612 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15615 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15619 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15621 alc_auto_parse_digital(codec);
15623 if (spec->kctls.list)
15624 add_mixer(spec, spec->kctls.list);
15626 add_verb(spec, alc861_auto_init_verbs);
15628 spec->num_mux_defs = 1;
15629 spec->input_mux = &spec->private_imux[0];
15631 spec->adc_nids = alc861_adc_nids;
15632 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15633 set_capture_mixer(codec);
15635 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15640 /* additional initialization for auto-configuration model */
15641 static void alc861_auto_init(struct hda_codec *codec)
15643 struct alc_spec *spec = codec->spec;
15644 alc861_auto_init_multi_out(codec);
15645 alc861_auto_init_hp_out(codec);
15646 alc861_auto_init_analog_input(codec);
15647 alc_auto_init_digital(codec);
15648 if (spec->unsol_event)
15649 alc_inithook(codec);
15652 #ifdef CONFIG_SND_HDA_POWER_SAVE
15653 static struct hda_amp_list alc861_loopbacks[] = {
15654 { 0x15, HDA_INPUT, 0 },
15655 { 0x15, HDA_INPUT, 1 },
15656 { 0x15, HDA_INPUT, 2 },
15657 { 0x15, HDA_INPUT, 3 },
15664 * configuration and preset
15666 static const char *alc861_models[ALC861_MODEL_LAST] = {
15667 [ALC861_3ST] = "3stack",
15668 [ALC660_3ST] = "3stack-660",
15669 [ALC861_3ST_DIG] = "3stack-dig",
15670 [ALC861_6ST_DIG] = "6stack-dig",
15671 [ALC861_UNIWILL_M31] = "uniwill-m31",
15672 [ALC861_TOSHIBA] = "toshiba",
15673 [ALC861_ASUS] = "asus",
15674 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15675 [ALC861_AUTO] = "auto",
15678 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15679 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15680 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15681 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15682 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15683 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15684 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15685 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15686 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15687 * Any other models that need this preset?
15689 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15690 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15691 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15692 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15693 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15694 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15695 /* FIXME: the below seems conflict */
15696 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15697 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15698 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15702 static struct alc_config_preset alc861_presets[] = {
15704 .mixers = { alc861_3ST_mixer },
15705 .init_verbs = { alc861_threestack_init_verbs },
15706 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15707 .dac_nids = alc861_dac_nids,
15708 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15709 .channel_mode = alc861_threestack_modes,
15711 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15712 .adc_nids = alc861_adc_nids,
15713 .input_mux = &alc861_capture_source,
15715 [ALC861_3ST_DIG] = {
15716 .mixers = { alc861_base_mixer },
15717 .init_verbs = { alc861_threestack_init_verbs },
15718 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15719 .dac_nids = alc861_dac_nids,
15720 .dig_out_nid = ALC861_DIGOUT_NID,
15721 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15722 .channel_mode = alc861_threestack_modes,
15724 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15725 .adc_nids = alc861_adc_nids,
15726 .input_mux = &alc861_capture_source,
15728 [ALC861_6ST_DIG] = {
15729 .mixers = { alc861_base_mixer },
15730 .init_verbs = { alc861_base_init_verbs },
15731 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15732 .dac_nids = alc861_dac_nids,
15733 .dig_out_nid = ALC861_DIGOUT_NID,
15734 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15735 .channel_mode = alc861_8ch_modes,
15736 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15737 .adc_nids = alc861_adc_nids,
15738 .input_mux = &alc861_capture_source,
15741 .mixers = { alc861_3ST_mixer },
15742 .init_verbs = { alc861_threestack_init_verbs },
15743 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15744 .dac_nids = alc660_dac_nids,
15745 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15746 .channel_mode = alc861_threestack_modes,
15748 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15749 .adc_nids = alc861_adc_nids,
15750 .input_mux = &alc861_capture_source,
15752 [ALC861_UNIWILL_M31] = {
15753 .mixers = { alc861_uniwill_m31_mixer },
15754 .init_verbs = { alc861_uniwill_m31_init_verbs },
15755 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15756 .dac_nids = alc861_dac_nids,
15757 .dig_out_nid = ALC861_DIGOUT_NID,
15758 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15759 .channel_mode = alc861_uniwill_m31_modes,
15761 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15762 .adc_nids = alc861_adc_nids,
15763 .input_mux = &alc861_capture_source,
15765 [ALC861_TOSHIBA] = {
15766 .mixers = { alc861_toshiba_mixer },
15767 .init_verbs = { alc861_base_init_verbs,
15768 alc861_toshiba_init_verbs },
15769 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15770 .dac_nids = alc861_dac_nids,
15771 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15772 .channel_mode = alc883_3ST_2ch_modes,
15773 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15774 .adc_nids = alc861_adc_nids,
15775 .input_mux = &alc861_capture_source,
15776 .unsol_event = alc861_toshiba_unsol_event,
15777 .init_hook = alc861_toshiba_automute,
15780 .mixers = { alc861_asus_mixer },
15781 .init_verbs = { alc861_asus_init_verbs },
15782 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15783 .dac_nids = alc861_dac_nids,
15784 .dig_out_nid = ALC861_DIGOUT_NID,
15785 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15786 .channel_mode = alc861_asus_modes,
15789 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15790 .adc_nids = alc861_adc_nids,
15791 .input_mux = &alc861_capture_source,
15793 [ALC861_ASUS_LAPTOP] = {
15794 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15795 .init_verbs = { alc861_asus_init_verbs,
15796 alc861_asus_laptop_init_verbs },
15797 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15798 .dac_nids = alc861_dac_nids,
15799 .dig_out_nid = ALC861_DIGOUT_NID,
15800 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15801 .channel_mode = alc883_3ST_2ch_modes,
15803 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15804 .adc_nids = alc861_adc_nids,
15805 .input_mux = &alc861_capture_source,
15809 /* Pin config fixes */
15811 PINFIX_FSC_AMILO_PI1505,
15814 static const struct alc_fixup alc861_fixups[] = {
15815 [PINFIX_FSC_AMILO_PI1505] = {
15816 .pins = (const struct alc_pincfg[]) {
15817 { 0x0b, 0x0221101f }, /* HP */
15818 { 0x0f, 0x90170310 }, /* speaker */
15824 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15825 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15829 static int patch_alc861(struct hda_codec *codec)
15831 struct alc_spec *spec;
15835 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15839 codec->spec = spec;
15841 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15845 if (board_config < 0) {
15846 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15848 board_config = ALC861_AUTO;
15851 if (board_config == ALC861_AUTO)
15852 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15854 if (board_config == ALC861_AUTO) {
15855 /* automatic parse from the BIOS config */
15856 err = alc861_parse_auto_config(codec);
15862 "hda_codec: Cannot set up configuration "
15863 "from BIOS. Using base mode...\n");
15864 board_config = ALC861_3ST_DIG;
15868 err = snd_hda_attach_beep_device(codec, 0x23);
15874 if (board_config != ALC861_AUTO)
15875 setup_preset(codec, &alc861_presets[board_config]);
15877 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15878 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15880 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15881 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15883 if (!spec->cap_mixer)
15884 set_capture_mixer(codec);
15885 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15887 spec->vmaster_nid = 0x03;
15889 if (board_config == ALC861_AUTO)
15890 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15892 codec->patch_ops = alc_patch_ops;
15893 if (board_config == ALC861_AUTO) {
15894 spec->init_hook = alc861_auto_init;
15895 #ifdef CONFIG_SND_HDA_POWER_SAVE
15896 spec->power_hook = alc_power_eapd;
15899 #ifdef CONFIG_SND_HDA_POWER_SAVE
15900 if (!spec->loopback.amplist)
15901 spec->loopback.amplist = alc861_loopbacks;
15908 * ALC861-VD support
15912 * In addition, an independent DAC
15914 #define ALC861VD_DIGOUT_NID 0x06
15916 static hda_nid_t alc861vd_dac_nids[4] = {
15917 /* front, surr, clfe, side surr */
15918 0x02, 0x03, 0x04, 0x05
15921 /* dac_nids for ALC660vd are in a different order - according to
15922 * Realtek's driver.
15923 * This should probably result in a different mixer for 6stack models
15924 * of ALC660vd codecs, but for now there is only 3stack mixer
15925 * - and it is the same as in 861vd.
15926 * adc_nids in ALC660vd are (is) the same as in 861vd
15928 static hda_nid_t alc660vd_dac_nids[3] = {
15929 /* front, rear, clfe, rear_surr */
15933 static hda_nid_t alc861vd_adc_nids[1] = {
15938 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15941 /* FIXME: should be a matrix-type input source selection */
15942 static struct hda_input_mux alc861vd_capture_source = {
15946 { "Front Mic", 0x1 },
15952 static struct hda_input_mux alc861vd_dallas_capture_source = {
15955 { "Ext Mic", 0x0 },
15956 { "Int Mic", 0x1 },
15960 static struct hda_input_mux alc861vd_hp_capture_source = {
15963 { "Front Mic", 0x0 },
15964 { "ATAPI Mic", 0x1 },
15971 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15978 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15979 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15980 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15981 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15982 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15989 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15990 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15991 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15992 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15993 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15997 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15998 { 6, alc861vd_6stack_ch6_init },
15999 { 8, alc861vd_6stack_ch8_init },
16002 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16005 .name = "Channel Mode",
16006 .info = alc_ch_mode_info,
16007 .get = alc_ch_mode_get,
16008 .put = alc_ch_mode_put,
16013 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16014 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16016 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16017 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16018 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16020 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16021 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16023 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16025 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16027 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16028 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16030 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16031 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16036 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16037 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16039 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16040 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16041 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16043 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16044 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16046 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16047 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16052 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16053 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16054 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16056 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16058 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16062 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16063 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16064 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16066 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16067 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16069 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16070 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16075 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16076 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16077 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16078 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16080 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16082 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16086 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16096 /* Pin assignment: Speaker=0x14, HP = 0x15,
16097 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16099 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16101 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16102 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16103 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16104 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16105 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16106 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16107 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16108 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16109 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16113 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16114 * Front Mic=0x18, ATAPI Mic = 0x19,
16116 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16117 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16119 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16120 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16121 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16122 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16123 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16124 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16130 * generic initialization of ADC, input mixers and output mixers
16132 static struct hda_verb alc861vd_volume_init_verbs[] = {
16134 * Unmute ADC0 and set the default input to mic-in
16136 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16139 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16140 * the analog-loopback mixer widget
16142 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16143 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16144 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16145 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16149 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16150 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16151 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16156 * Set up output mixers (0x02 - 0x05)
16158 /* set vol=0 to output mixers */
16159 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16160 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16161 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16162 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16164 /* set up input amps for analog loopback */
16165 /* Amp Indices: DAC = 0, mixer = 1 */
16166 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16168 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16170 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16172 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16179 * 3-stack pin configuration:
16180 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16182 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16184 * Set pin mode and muting
16186 /* set front pin widgets 0x14 for output */
16187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16191 /* Mic (rear) pin: input vref at 80% */
16192 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16193 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16194 /* Front Mic pin: input vref at 80% */
16195 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16196 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16197 /* Line In pin: input */
16198 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16200 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16203 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16204 /* CD pin widget for input */
16205 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16211 * 6-stack pin configuration:
16213 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16215 * Set pin mode and muting
16217 /* set front pin widgets 0x14 for output */
16218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16220 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16222 /* Rear Pin: output 1 (0x0d) */
16223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16225 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16226 /* CLFE Pin: output 2 (0x0e) */
16227 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16228 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16229 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16230 /* Side Pin: output 3 (0x0f) */
16231 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16232 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16233 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16235 /* Mic (rear) pin: input vref at 80% */
16236 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16237 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16238 /* Front Mic pin: input vref at 80% */
16239 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16240 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16241 /* Line In pin: input */
16242 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16243 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16244 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16246 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16247 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16248 /* CD pin widget for input */
16249 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16254 static struct hda_verb alc861vd_eapd_verbs[] = {
16255 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16259 static struct hda_verb alc660vd_eapd_verbs[] = {
16260 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16261 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16265 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16266 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16269 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16270 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16274 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16276 unsigned int present;
16277 unsigned char bits;
16279 present = snd_hda_jack_detect(codec, 0x18);
16280 bits = present ? HDA_AMP_MUTE : 0;
16282 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16283 HDA_AMP_MUTE, bits);
16286 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16288 struct alc_spec *spec = codec->spec;
16289 spec->autocfg.hp_pins[0] = 0x1b;
16290 spec->autocfg.speaker_pins[0] = 0x14;
16293 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16295 alc_automute_amp(codec);
16296 alc861vd_lenovo_mic_automute(codec);
16299 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16302 switch (res >> 26) {
16303 case ALC880_MIC_EVENT:
16304 alc861vd_lenovo_mic_automute(codec);
16307 alc_automute_amp_unsol_event(codec, res);
16312 static struct hda_verb alc861vd_dallas_verbs[] = {
16313 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16314 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16315 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16316 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16319 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16320 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16322 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16323 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16325 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16327 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16328 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16331 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16332 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16333 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16334 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16336 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16337 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16338 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16339 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16341 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16342 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16343 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16350 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16351 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16357 /* toggle speaker-output according to the hp-jack state */
16358 static void alc861vd_dallas_setup(struct hda_codec *codec)
16360 struct alc_spec *spec = codec->spec;
16362 spec->autocfg.hp_pins[0] = 0x15;
16363 spec->autocfg.speaker_pins[0] = 0x14;
16366 #ifdef CONFIG_SND_HDA_POWER_SAVE
16367 #define alc861vd_loopbacks alc880_loopbacks
16370 /* pcm configuration: identical with ALC880 */
16371 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16372 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16373 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16374 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16377 * configuration and preset
16379 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16380 [ALC660VD_3ST] = "3stack-660",
16381 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16382 [ALC660VD_ASUS_V1S] = "asus-v1s",
16383 [ALC861VD_3ST] = "3stack",
16384 [ALC861VD_3ST_DIG] = "3stack-digout",
16385 [ALC861VD_6ST_DIG] = "6stack-digout",
16386 [ALC861VD_LENOVO] = "lenovo",
16387 [ALC861VD_DALLAS] = "dallas",
16388 [ALC861VD_HP] = "hp",
16389 [ALC861VD_AUTO] = "auto",
16392 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16393 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16394 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16395 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16396 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16397 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16398 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16399 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16400 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16401 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16402 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16403 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16404 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16405 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16406 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16407 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16411 static struct alc_config_preset alc861vd_presets[] = {
16413 .mixers = { alc861vd_3st_mixer },
16414 .init_verbs = { alc861vd_volume_init_verbs,
16415 alc861vd_3stack_init_verbs },
16416 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16417 .dac_nids = alc660vd_dac_nids,
16418 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16419 .channel_mode = alc861vd_3stack_2ch_modes,
16420 .input_mux = &alc861vd_capture_source,
16422 [ALC660VD_3ST_DIG] = {
16423 .mixers = { alc861vd_3st_mixer },
16424 .init_verbs = { alc861vd_volume_init_verbs,
16425 alc861vd_3stack_init_verbs },
16426 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16427 .dac_nids = alc660vd_dac_nids,
16428 .dig_out_nid = ALC861VD_DIGOUT_NID,
16429 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16430 .channel_mode = alc861vd_3stack_2ch_modes,
16431 .input_mux = &alc861vd_capture_source,
16434 .mixers = { alc861vd_3st_mixer },
16435 .init_verbs = { alc861vd_volume_init_verbs,
16436 alc861vd_3stack_init_verbs },
16437 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16438 .dac_nids = alc861vd_dac_nids,
16439 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16440 .channel_mode = alc861vd_3stack_2ch_modes,
16441 .input_mux = &alc861vd_capture_source,
16443 [ALC861VD_3ST_DIG] = {
16444 .mixers = { alc861vd_3st_mixer },
16445 .init_verbs = { alc861vd_volume_init_verbs,
16446 alc861vd_3stack_init_verbs },
16447 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16448 .dac_nids = alc861vd_dac_nids,
16449 .dig_out_nid = ALC861VD_DIGOUT_NID,
16450 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16451 .channel_mode = alc861vd_3stack_2ch_modes,
16452 .input_mux = &alc861vd_capture_source,
16454 [ALC861VD_6ST_DIG] = {
16455 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16456 .init_verbs = { alc861vd_volume_init_verbs,
16457 alc861vd_6stack_init_verbs },
16458 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16459 .dac_nids = alc861vd_dac_nids,
16460 .dig_out_nid = ALC861VD_DIGOUT_NID,
16461 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16462 .channel_mode = alc861vd_6stack_modes,
16463 .input_mux = &alc861vd_capture_source,
16465 [ALC861VD_LENOVO] = {
16466 .mixers = { alc861vd_lenovo_mixer },
16467 .init_verbs = { alc861vd_volume_init_verbs,
16468 alc861vd_3stack_init_verbs,
16469 alc861vd_eapd_verbs,
16470 alc861vd_lenovo_unsol_verbs },
16471 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16472 .dac_nids = alc660vd_dac_nids,
16473 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16474 .channel_mode = alc861vd_3stack_2ch_modes,
16475 .input_mux = &alc861vd_capture_source,
16476 .unsol_event = alc861vd_lenovo_unsol_event,
16477 .setup = alc861vd_lenovo_setup,
16478 .init_hook = alc861vd_lenovo_init_hook,
16480 [ALC861VD_DALLAS] = {
16481 .mixers = { alc861vd_dallas_mixer },
16482 .init_verbs = { alc861vd_dallas_verbs },
16483 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16484 .dac_nids = alc861vd_dac_nids,
16485 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16486 .channel_mode = alc861vd_3stack_2ch_modes,
16487 .input_mux = &alc861vd_dallas_capture_source,
16488 .unsol_event = alc_automute_amp_unsol_event,
16489 .setup = alc861vd_dallas_setup,
16490 .init_hook = alc_automute_amp,
16493 .mixers = { alc861vd_hp_mixer },
16494 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16495 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16496 .dac_nids = alc861vd_dac_nids,
16497 .dig_out_nid = ALC861VD_DIGOUT_NID,
16498 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16499 .channel_mode = alc861vd_3stack_2ch_modes,
16500 .input_mux = &alc861vd_hp_capture_source,
16501 .unsol_event = alc_automute_amp_unsol_event,
16502 .setup = alc861vd_dallas_setup,
16503 .init_hook = alc_automute_amp,
16505 [ALC660VD_ASUS_V1S] = {
16506 .mixers = { alc861vd_lenovo_mixer },
16507 .init_verbs = { alc861vd_volume_init_verbs,
16508 alc861vd_3stack_init_verbs,
16509 alc861vd_eapd_verbs,
16510 alc861vd_lenovo_unsol_verbs },
16511 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16512 .dac_nids = alc660vd_dac_nids,
16513 .dig_out_nid = ALC861VD_DIGOUT_NID,
16514 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16515 .channel_mode = alc861vd_3stack_2ch_modes,
16516 .input_mux = &alc861vd_capture_source,
16517 .unsol_event = alc861vd_lenovo_unsol_event,
16518 .setup = alc861vd_lenovo_setup,
16519 .init_hook = alc861vd_lenovo_init_hook,
16524 * BIOS auto configuration
16526 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16527 const struct auto_pin_cfg *cfg)
16529 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16533 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16534 hda_nid_t nid, int pin_type, int dac_idx)
16536 alc_set_pin_output(codec, nid, pin_type);
16539 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16541 struct alc_spec *spec = codec->spec;
16544 for (i = 0; i <= HDA_SIDE; i++) {
16545 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16546 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16548 alc861vd_auto_set_output_and_unmute(codec, nid,
16554 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16556 struct alc_spec *spec = codec->spec;
16559 pin = spec->autocfg.hp_pins[0];
16560 if (pin) /* connect to front and use dac 0 */
16561 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16562 pin = spec->autocfg.speaker_pins[0];
16564 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16567 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16569 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16571 struct alc_spec *spec = codec->spec;
16574 for (i = 0; i < AUTO_PIN_LAST; i++) {
16575 hda_nid_t nid = spec->autocfg.input_pins[i];
16576 if (alc_is_input_pin(codec, nid)) {
16577 alc_set_input_pin(codec, nid, i);
16578 if (nid != ALC861VD_PIN_CD_NID &&
16579 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16580 snd_hda_codec_write(codec, nid, 0,
16581 AC_VERB_SET_AMP_GAIN_MUTE,
16587 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16589 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16590 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16592 /* add playback controls from the parsed DAC table */
16593 /* Based on ALC880 version. But ALC861VD has separate,
16594 * different NIDs for mute/unmute switch and volume control */
16595 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16596 const struct auto_pin_cfg *cfg)
16598 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16599 hda_nid_t nid_v, nid_s;
16602 for (i = 0; i < cfg->line_outs; i++) {
16603 if (!spec->multiout.dac_nids[i])
16605 nid_v = alc861vd_idx_to_mixer_vol(
16607 spec->multiout.dac_nids[i]));
16608 nid_s = alc861vd_idx_to_mixer_switch(
16610 spec->multiout.dac_nids[i]));
16614 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16616 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16620 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16622 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16626 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16628 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16632 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16634 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16640 if (cfg->line_outs == 1 &&
16641 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16648 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16649 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16653 if (cfg->line_outs == 1 &&
16654 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16656 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16657 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16666 /* add playback controls for speaker and HP outputs */
16667 /* Based on ALC880 version. But ALC861VD has separate,
16668 * different NIDs for mute/unmute switch and volume control */
16669 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16670 hda_nid_t pin, const char *pfx)
16672 hda_nid_t nid_v, nid_s;
16678 if (alc880_is_fixed_pin(pin)) {
16679 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16680 /* specify the DAC as the extra output */
16681 if (!spec->multiout.hp_nid)
16682 spec->multiout.hp_nid = nid_v;
16684 spec->multiout.extra_out_nid[0] = nid_v;
16685 /* control HP volume/switch on the output mixer amp */
16686 nid_v = alc861vd_idx_to_mixer_vol(
16687 alc880_fixed_pin_idx(pin));
16688 nid_s = alc861vd_idx_to_mixer_switch(
16689 alc880_fixed_pin_idx(pin));
16691 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16692 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16695 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16696 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16699 } else if (alc880_is_multi_pin(pin)) {
16700 /* set manual connection */
16701 /* we have only a switch on HP-out PIN */
16702 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16703 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16710 /* parse the BIOS configuration and set up the alc_spec
16711 * return 1 if successful, 0 if the proper config is not found,
16712 * or a negative error code
16713 * Based on ALC880 version - had to change it to override
16714 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16715 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16717 struct alc_spec *spec = codec->spec;
16719 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16721 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16725 if (!spec->autocfg.line_outs)
16726 return 0; /* can't find valid BIOS pin config */
16728 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16731 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16734 err = alc861vd_auto_create_extra_out(spec,
16735 spec->autocfg.speaker_pins[0],
16739 err = alc861vd_auto_create_extra_out(spec,
16740 spec->autocfg.hp_pins[0],
16744 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16748 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16750 alc_auto_parse_digital(codec);
16752 if (spec->kctls.list)
16753 add_mixer(spec, spec->kctls.list);
16755 add_verb(spec, alc861vd_volume_init_verbs);
16757 spec->num_mux_defs = 1;
16758 spec->input_mux = &spec->private_imux[0];
16760 err = alc_auto_add_mic_boost(codec);
16764 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16769 /* additional initialization for auto-configuration model */
16770 static void alc861vd_auto_init(struct hda_codec *codec)
16772 struct alc_spec *spec = codec->spec;
16773 alc861vd_auto_init_multi_out(codec);
16774 alc861vd_auto_init_hp_out(codec);
16775 alc861vd_auto_init_analog_input(codec);
16776 alc861vd_auto_init_input_src(codec);
16777 alc_auto_init_digital(codec);
16778 if (spec->unsol_event)
16779 alc_inithook(codec);
16783 ALC660VD_FIX_ASUS_GPIO1
16787 static const struct alc_fixup alc861vd_fixups[] = {
16788 [ALC660VD_FIX_ASUS_GPIO1] = {
16789 .verbs = (const struct hda_verb[]) {
16790 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16791 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16792 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16798 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16799 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16803 static int patch_alc861vd(struct hda_codec *codec)
16805 struct alc_spec *spec;
16806 int err, board_config;
16808 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16812 codec->spec = spec;
16814 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16818 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16819 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16821 board_config = ALC861VD_AUTO;
16824 if (board_config == ALC861VD_AUTO)
16825 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16827 if (board_config == ALC861VD_AUTO) {
16828 /* automatic parse from the BIOS config */
16829 err = alc861vd_parse_auto_config(codec);
16835 "hda_codec: Cannot set up configuration "
16836 "from BIOS. Using base mode...\n");
16837 board_config = ALC861VD_3ST;
16841 err = snd_hda_attach_beep_device(codec, 0x23);
16847 if (board_config != ALC861VD_AUTO)
16848 setup_preset(codec, &alc861vd_presets[board_config]);
16850 if (codec->vendor_id == 0x10ec0660) {
16851 /* always turn on EAPD */
16852 add_verb(spec, alc660vd_eapd_verbs);
16855 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16856 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16858 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16859 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16861 if (!spec->adc_nids) {
16862 spec->adc_nids = alc861vd_adc_nids;
16863 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16865 if (!spec->capsrc_nids)
16866 spec->capsrc_nids = alc861vd_capsrc_nids;
16868 set_capture_mixer(codec);
16869 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16871 spec->vmaster_nid = 0x02;
16873 if (board_config == ALC861VD_AUTO)
16874 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16876 codec->patch_ops = alc_patch_ops;
16878 if (board_config == ALC861VD_AUTO)
16879 spec->init_hook = alc861vd_auto_init;
16880 #ifdef CONFIG_SND_HDA_POWER_SAVE
16881 if (!spec->loopback.amplist)
16882 spec->loopback.amplist = alc861vd_loopbacks;
16891 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16892 * configuration. Each pin widget can choose any input DACs and a mixer.
16893 * Each ADC is connected from a mixer of all inputs. This makes possible
16894 * 6-channel independent captures.
16896 * In addition, an independent DAC for the multi-playback (not used in this
16899 #define ALC662_DIGOUT_NID 0x06
16900 #define ALC662_DIGIN_NID 0x0a
16902 static hda_nid_t alc662_dac_nids[4] = {
16903 /* front, rear, clfe, rear_surr */
16907 static hda_nid_t alc272_dac_nids[2] = {
16911 static hda_nid_t alc662_adc_nids[2] = {
16916 static hda_nid_t alc272_adc_nids[1] = {
16921 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16922 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16926 /* FIXME: should be a matrix-type input source selection */
16927 static struct hda_input_mux alc662_capture_source = {
16931 { "Front Mic", 0x1 },
16937 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16945 static struct hda_input_mux alc663_capture_source = {
16949 { "Front Mic", 0x1 },
16954 #if 0 /* set to 1 for testing other input sources below */
16955 static struct hda_input_mux alc272_nc10_capture_source = {
16958 { "Autoselect Mic", 0x0 },
16959 { "Internal Mic", 0x1 },
16960 { "In-0x02", 0x2 },
16961 { "In-0x03", 0x3 },
16962 { "In-0x04", 0x4 },
16963 { "In-0x05", 0x5 },
16964 { "In-0x06", 0x6 },
16965 { "In-0x07", 0x7 },
16966 { "In-0x08", 0x8 },
16967 { "In-0x09", 0x9 },
16968 { "In-0x0a", 0x0a },
16969 { "In-0x0b", 0x0b },
16970 { "In-0x0c", 0x0c },
16971 { "In-0x0d", 0x0d },
16972 { "In-0x0e", 0x0e },
16973 { "In-0x0f", 0x0f },
16981 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16988 static struct hda_verb alc662_3ST_ch2_init[] = {
16989 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16990 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16991 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16992 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16999 static struct hda_verb alc662_3ST_ch6_init[] = {
17000 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17001 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17002 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17003 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17004 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17005 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17009 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17010 { 2, alc662_3ST_ch2_init },
17011 { 6, alc662_3ST_ch6_init },
17017 static struct hda_verb alc662_sixstack_ch6_init[] = {
17018 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17019 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17020 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17027 static struct hda_verb alc662_sixstack_ch8_init[] = {
17028 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17029 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17030 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17034 static struct hda_channel_mode alc662_5stack_modes[2] = {
17035 { 2, alc662_sixstack_ch6_init },
17036 { 6, alc662_sixstack_ch8_init },
17039 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17040 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17043 static struct snd_kcontrol_new alc662_base_mixer[] = {
17044 /* output mixer control */
17045 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17046 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17048 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17051 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17052 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17053 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17055 /*Input mixer control */
17056 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17057 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17058 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17059 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17060 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17061 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17062 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17063 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17067 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17068 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17069 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17071 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17072 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17073 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17074 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17077 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17078 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17082 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17083 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17084 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17085 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17086 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17087 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17088 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17089 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17090 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17092 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17093 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17094 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17095 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17098 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17103 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17104 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17105 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17106 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17107 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17109 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17110 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17116 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17117 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17118 ALC262_HIPPO_MASTER_SWITCH,
17120 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17121 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17122 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17124 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17125 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17126 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17130 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17131 ALC262_HIPPO_MASTER_SWITCH,
17132 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17133 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17136 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17137 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17138 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17139 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17140 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17144 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17145 .ops = &snd_hda_bind_vol,
17147 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17148 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17153 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17154 .ops = &snd_hda_bind_sw,
17156 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17157 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17162 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17163 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17164 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
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 hda_bind_ctls alc663_asus_tree_bind_switch = {
17171 .ops = &snd_hda_bind_sw,
17173 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17174 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17175 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17180 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17181 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17182 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17185 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17186 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17191 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17192 .ops = &snd_hda_bind_sw,
17194 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17195 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17196 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17201 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17202 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17203 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17206 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17207 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17211 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17212 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17213 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17217 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17218 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17222 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17223 .ops = &snd_hda_bind_vol,
17225 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17226 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17231 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17232 .ops = &snd_hda_bind_sw,
17234 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17235 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17240 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17241 HDA_BIND_VOL("Master Playback Volume",
17242 &alc663_asus_two_bind_master_vol),
17243 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17251 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17252 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17253 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17261 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17262 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17263 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17264 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17265 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17270 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17271 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17275 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17276 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17277 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17278 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17282 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17283 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17289 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17290 .ops = &snd_hda_bind_sw,
17292 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17293 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17294 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17295 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17296 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17301 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17302 .ops = &snd_hda_bind_sw,
17304 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17305 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17310 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17311 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17312 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17313 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17314 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17315 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17316 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17317 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17323 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17324 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17325 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17326 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17327 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17328 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17335 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17337 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17338 .name = "Channel Mode",
17339 .info = alc_ch_mode_info,
17340 .get = alc_ch_mode_get,
17341 .put = alc_ch_mode_put,
17346 static struct hda_verb alc662_init_verbs[] = {
17347 /* ADC: mute amp left and right */
17348 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17349 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17358 /* Front Pin: output 0 (0x0c) */
17359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17360 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17362 /* Rear Pin: output 1 (0x0d) */
17363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17366 /* CLFE Pin: output 2 (0x0e) */
17367 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17370 /* Mic (rear) pin: input vref at 80% */
17371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17373 /* Front Mic pin: input vref at 80% */
17374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17376 /* Line In pin: input */
17377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17379 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17380 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17381 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17382 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17383 /* CD pin widget for input */
17384 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17386 /* FIXME: use matrix-type input source selection */
17387 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17389 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17392 /* always trun on EAPD */
17393 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17394 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17399 static struct hda_verb alc663_init_verbs[] = {
17400 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17401 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17402 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17403 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17404 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17409 static struct hda_verb alc272_init_verbs[] = {
17410 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17411 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17412 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17413 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17414 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17415 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17416 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17421 static struct hda_verb alc662_sue_init_verbs[] = {
17422 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17423 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17427 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17428 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17429 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17433 /* Set Unsolicited Event*/
17434 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17435 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17436 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17440 static struct hda_verb alc663_m51va_init_verbs[] = {
17441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17442 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
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, 0x01}, /* Headphone */
17446 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
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_21jd_amic_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, 0x01}, /* Headphone */
17457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17459 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17460 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17464 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17465 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17466 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17467 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17468 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17471 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17472 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17476 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17479 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17482 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17483 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17487 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17488 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17489 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17490 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17491 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17492 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17494 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17497 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17498 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17499 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17503 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17504 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17505 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17506 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17507 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17510 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17513 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17514 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17515 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17519 static struct hda_verb alc663_g71v_init_verbs[] = {
17520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17521 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17522 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17524 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17525 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17526 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17528 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17529 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17530 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17534 static struct hda_verb alc663_g50v_init_verbs[] = {
17535 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17536 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17537 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17539 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17540 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17544 static struct hda_verb alc662_ecs_init_verbs[] = {
17545 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17547 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17548 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17552 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17553 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17554 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17556 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17557 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17558 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17559 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17560 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17562 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17563 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17567 static struct hda_verb alc272_dell_init_verbs[] = {
17568 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17569 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17571 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17572 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17573 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17574 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17577 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17578 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17582 static struct hda_verb alc663_mode7_init_verbs[] = {
17583 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17584 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17585 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17586 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17588 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17589 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17590 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17591 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17592 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17595 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17596 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17597 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17601 static struct hda_verb alc663_mode8_init_verbs[] = {
17602 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17603 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17606 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17607 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17608 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17610 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17611 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17612 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17615 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17616 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17617 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17621 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17622 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17623 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17627 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17628 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17629 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17633 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17635 unsigned int present;
17636 unsigned char bits;
17638 present = snd_hda_jack_detect(codec, 0x14);
17639 bits = present ? HDA_AMP_MUTE : 0;
17641 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17642 HDA_AMP_MUTE, bits);
17645 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17647 unsigned int present;
17648 unsigned char bits;
17650 present = snd_hda_jack_detect(codec, 0x1b);
17651 bits = present ? HDA_AMP_MUTE : 0;
17653 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17654 HDA_AMP_MUTE, bits);
17655 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17656 HDA_AMP_MUTE, bits);
17659 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17662 if ((res >> 26) == ALC880_HP_EVENT)
17663 alc662_lenovo_101e_all_automute(codec);
17664 if ((res >> 26) == ALC880_FRONT_EVENT)
17665 alc662_lenovo_101e_ispeaker_automute(codec);
17668 /* unsolicited event for HP jack sensing */
17669 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17672 if ((res >> 26) == ALC880_MIC_EVENT)
17673 alc_mic_automute(codec);
17675 alc262_hippo_unsol_event(codec, res);
17678 static void alc662_eeepc_setup(struct hda_codec *codec)
17680 struct alc_spec *spec = codec->spec;
17682 alc262_hippo1_setup(codec);
17683 spec->ext_mic.pin = 0x18;
17684 spec->ext_mic.mux_idx = 0;
17685 spec->int_mic.pin = 0x19;
17686 spec->int_mic.mux_idx = 1;
17687 spec->auto_mic = 1;
17690 static void alc662_eeepc_inithook(struct hda_codec *codec)
17692 alc262_hippo_automute(codec);
17693 alc_mic_automute(codec);
17696 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17698 struct alc_spec *spec = codec->spec;
17700 spec->autocfg.hp_pins[0] = 0x14;
17701 spec->autocfg.speaker_pins[0] = 0x1b;
17704 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17706 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17708 unsigned int present;
17709 unsigned char bits;
17711 present = snd_hda_jack_detect(codec, 0x21);
17712 bits = present ? HDA_AMP_MUTE : 0;
17713 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17714 HDA_AMP_MUTE, bits);
17715 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17716 HDA_AMP_MUTE, bits);
17719 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17721 unsigned int present;
17722 unsigned char bits;
17724 present = snd_hda_jack_detect(codec, 0x21);
17725 bits = present ? HDA_AMP_MUTE : 0;
17726 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17727 HDA_AMP_MUTE, bits);
17728 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17729 HDA_AMP_MUTE, bits);
17730 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17731 HDA_AMP_MUTE, bits);
17732 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17733 HDA_AMP_MUTE, bits);
17736 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17738 unsigned int present;
17739 unsigned char bits;
17741 present = snd_hda_jack_detect(codec, 0x15);
17742 bits = present ? HDA_AMP_MUTE : 0;
17743 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17744 HDA_AMP_MUTE, bits);
17745 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17746 HDA_AMP_MUTE, bits);
17747 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17748 HDA_AMP_MUTE, bits);
17749 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17750 HDA_AMP_MUTE, bits);
17753 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17755 unsigned int present;
17756 unsigned char bits;
17758 present = snd_hda_jack_detect(codec, 0x1b);
17759 bits = present ? 0 : PIN_OUT;
17760 snd_hda_codec_write(codec, 0x14, 0,
17761 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17764 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17766 unsigned int present1, present2;
17768 present1 = snd_hda_jack_detect(codec, 0x21);
17769 present2 = snd_hda_jack_detect(codec, 0x15);
17771 if (present1 || present2) {
17772 snd_hda_codec_write_cache(codec, 0x14, 0,
17773 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17775 snd_hda_codec_write_cache(codec, 0x14, 0,
17776 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17780 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17782 unsigned int present1, present2;
17784 present1 = snd_hda_jack_detect(codec, 0x1b);
17785 present2 = snd_hda_jack_detect(codec, 0x15);
17787 if (present1 || present2) {
17788 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17789 HDA_AMP_MUTE, HDA_AMP_MUTE);
17790 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17791 HDA_AMP_MUTE, HDA_AMP_MUTE);
17793 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17795 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17800 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17802 unsigned int present1, present2;
17804 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17805 AC_VERB_GET_PIN_SENSE, 0)
17806 & AC_PINSENSE_PRESENCE;
17807 present2 = snd_hda_codec_read(codec, 0x21, 0,
17808 AC_VERB_GET_PIN_SENSE, 0)
17809 & AC_PINSENSE_PRESENCE;
17811 if (present1 || present2) {
17812 snd_hda_codec_write_cache(codec, 0x14, 0,
17813 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17814 snd_hda_codec_write_cache(codec, 0x17, 0,
17815 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17817 snd_hda_codec_write_cache(codec, 0x14, 0,
17818 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17819 snd_hda_codec_write_cache(codec, 0x17, 0,
17820 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17824 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17826 unsigned int present1, present2;
17828 present1 = snd_hda_codec_read(codec, 0x21, 0,
17829 AC_VERB_GET_PIN_SENSE, 0)
17830 & AC_PINSENSE_PRESENCE;
17831 present2 = snd_hda_codec_read(codec, 0x15, 0,
17832 AC_VERB_GET_PIN_SENSE, 0)
17833 & AC_PINSENSE_PRESENCE;
17835 if (present1 || present2) {
17836 snd_hda_codec_write_cache(codec, 0x14, 0,
17837 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17838 snd_hda_codec_write_cache(codec, 0x17, 0,
17839 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17841 snd_hda_codec_write_cache(codec, 0x14, 0,
17842 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17843 snd_hda_codec_write_cache(codec, 0x17, 0,
17844 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17848 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17851 switch (res >> 26) {
17852 case ALC880_HP_EVENT:
17853 alc663_m51va_speaker_automute(codec);
17855 case ALC880_MIC_EVENT:
17856 alc_mic_automute(codec);
17861 static void alc663_m51va_setup(struct hda_codec *codec)
17863 struct alc_spec *spec = codec->spec;
17864 spec->ext_mic.pin = 0x18;
17865 spec->ext_mic.mux_idx = 0;
17866 spec->int_mic.pin = 0x12;
17867 spec->int_mic.mux_idx = 9;
17868 spec->auto_mic = 1;
17871 static void alc663_m51va_inithook(struct hda_codec *codec)
17873 alc663_m51va_speaker_automute(codec);
17874 alc_mic_automute(codec);
17877 /* ***************** Mode1 ******************************/
17878 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17880 static void alc663_mode1_setup(struct hda_codec *codec)
17882 struct alc_spec *spec = codec->spec;
17883 spec->ext_mic.pin = 0x18;
17884 spec->ext_mic.mux_idx = 0;
17885 spec->int_mic.pin = 0x19;
17886 spec->int_mic.mux_idx = 1;
17887 spec->auto_mic = 1;
17890 #define alc663_mode1_inithook alc663_m51va_inithook
17892 /* ***************** Mode2 ******************************/
17893 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17896 switch (res >> 26) {
17897 case ALC880_HP_EVENT:
17898 alc662_f5z_speaker_automute(codec);
17900 case ALC880_MIC_EVENT:
17901 alc_mic_automute(codec);
17906 #define alc662_mode2_setup alc663_mode1_setup
17908 static void alc662_mode2_inithook(struct hda_codec *codec)
17910 alc662_f5z_speaker_automute(codec);
17911 alc_mic_automute(codec);
17913 /* ***************** Mode3 ******************************/
17914 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17917 switch (res >> 26) {
17918 case ALC880_HP_EVENT:
17919 alc663_two_hp_m1_speaker_automute(codec);
17921 case ALC880_MIC_EVENT:
17922 alc_mic_automute(codec);
17927 #define alc663_mode3_setup alc663_mode1_setup
17929 static void alc663_mode3_inithook(struct hda_codec *codec)
17931 alc663_two_hp_m1_speaker_automute(codec);
17932 alc_mic_automute(codec);
17934 /* ***************** Mode4 ******************************/
17935 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17938 switch (res >> 26) {
17939 case ALC880_HP_EVENT:
17940 alc663_21jd_two_speaker_automute(codec);
17942 case ALC880_MIC_EVENT:
17943 alc_mic_automute(codec);
17948 #define alc663_mode4_setup alc663_mode1_setup
17950 static void alc663_mode4_inithook(struct hda_codec *codec)
17952 alc663_21jd_two_speaker_automute(codec);
17953 alc_mic_automute(codec);
17955 /* ***************** Mode5 ******************************/
17956 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17959 switch (res >> 26) {
17960 case ALC880_HP_EVENT:
17961 alc663_15jd_two_speaker_automute(codec);
17963 case ALC880_MIC_EVENT:
17964 alc_mic_automute(codec);
17969 #define alc663_mode5_setup alc663_mode1_setup
17971 static void alc663_mode5_inithook(struct hda_codec *codec)
17973 alc663_15jd_two_speaker_automute(codec);
17974 alc_mic_automute(codec);
17976 /* ***************** Mode6 ******************************/
17977 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17980 switch (res >> 26) {
17981 case ALC880_HP_EVENT:
17982 alc663_two_hp_m2_speaker_automute(codec);
17984 case ALC880_MIC_EVENT:
17985 alc_mic_automute(codec);
17990 #define alc663_mode6_setup alc663_mode1_setup
17992 static void alc663_mode6_inithook(struct hda_codec *codec)
17994 alc663_two_hp_m2_speaker_automute(codec);
17995 alc_mic_automute(codec);
17998 /* ***************** Mode7 ******************************/
17999 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18002 switch (res >> 26) {
18003 case ALC880_HP_EVENT:
18004 alc663_two_hp_m7_speaker_automute(codec);
18006 case ALC880_MIC_EVENT:
18007 alc_mic_automute(codec);
18012 #define alc663_mode7_setup alc663_mode1_setup
18014 static void alc663_mode7_inithook(struct hda_codec *codec)
18016 alc663_two_hp_m7_speaker_automute(codec);
18017 alc_mic_automute(codec);
18020 /* ***************** Mode8 ******************************/
18021 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18024 switch (res >> 26) {
18025 case ALC880_HP_EVENT:
18026 alc663_two_hp_m8_speaker_automute(codec);
18028 case ALC880_MIC_EVENT:
18029 alc_mic_automute(codec);
18034 #define alc663_mode8_setup alc663_m51va_setup
18036 static void alc663_mode8_inithook(struct hda_codec *codec)
18038 alc663_two_hp_m8_speaker_automute(codec);
18039 alc_mic_automute(codec);
18042 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18044 unsigned int present;
18045 unsigned char bits;
18047 present = snd_hda_jack_detect(codec, 0x21);
18048 bits = present ? HDA_AMP_MUTE : 0;
18049 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18050 HDA_AMP_MUTE, bits);
18051 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18052 HDA_AMP_MUTE, bits);
18055 static void alc663_g71v_front_automute(struct hda_codec *codec)
18057 unsigned int present;
18058 unsigned char bits;
18060 present = snd_hda_jack_detect(codec, 0x15);
18061 bits = present ? HDA_AMP_MUTE : 0;
18062 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18063 HDA_AMP_MUTE, bits);
18066 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18069 switch (res >> 26) {
18070 case ALC880_HP_EVENT:
18071 alc663_g71v_hp_automute(codec);
18073 case ALC880_FRONT_EVENT:
18074 alc663_g71v_front_automute(codec);
18076 case ALC880_MIC_EVENT:
18077 alc_mic_automute(codec);
18082 #define alc663_g71v_setup alc663_m51va_setup
18084 static void alc663_g71v_inithook(struct hda_codec *codec)
18086 alc663_g71v_front_automute(codec);
18087 alc663_g71v_hp_automute(codec);
18088 alc_mic_automute(codec);
18091 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18094 switch (res >> 26) {
18095 case ALC880_HP_EVENT:
18096 alc663_m51va_speaker_automute(codec);
18098 case ALC880_MIC_EVENT:
18099 alc_mic_automute(codec);
18104 #define alc663_g50v_setup alc663_m51va_setup
18106 static void alc663_g50v_inithook(struct hda_codec *codec)
18108 alc663_m51va_speaker_automute(codec);
18109 alc_mic_automute(codec);
18112 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18113 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18114 ALC262_HIPPO_MASTER_SWITCH,
18116 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18117 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18118 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18120 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18121 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18122 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18126 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18127 /* Master Playback automatically created from Speaker and Headphone */
18128 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18129 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18130 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18131 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18133 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18134 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18135 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18137 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18138 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18139 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18143 #ifdef CONFIG_SND_HDA_POWER_SAVE
18144 #define alc662_loopbacks alc880_loopbacks
18148 /* pcm configuration: identical with ALC880 */
18149 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18150 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18151 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18152 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18155 * configuration and preset
18157 static const char *alc662_models[ALC662_MODEL_LAST] = {
18158 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18159 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18160 [ALC662_3ST_6ch] = "3stack-6ch",
18161 [ALC662_5ST_DIG] = "6stack-dig",
18162 [ALC662_LENOVO_101E] = "lenovo-101e",
18163 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18164 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18165 [ALC662_ECS] = "ecs",
18166 [ALC663_ASUS_M51VA] = "m51va",
18167 [ALC663_ASUS_G71V] = "g71v",
18168 [ALC663_ASUS_H13] = "h13",
18169 [ALC663_ASUS_G50V] = "g50v",
18170 [ALC663_ASUS_MODE1] = "asus-mode1",
18171 [ALC662_ASUS_MODE2] = "asus-mode2",
18172 [ALC663_ASUS_MODE3] = "asus-mode3",
18173 [ALC663_ASUS_MODE4] = "asus-mode4",
18174 [ALC663_ASUS_MODE5] = "asus-mode5",
18175 [ALC663_ASUS_MODE6] = "asus-mode6",
18176 [ALC663_ASUS_MODE7] = "asus-mode7",
18177 [ALC663_ASUS_MODE8] = "asus-mode8",
18178 [ALC272_DELL] = "dell",
18179 [ALC272_DELL_ZM1] = "dell-zm1",
18180 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18181 [ALC662_AUTO] = "auto",
18184 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18185 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18186 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18187 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18188 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18189 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18190 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18191 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18192 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18193 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18194 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18195 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18196 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18197 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18198 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18199 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18200 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18201 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18202 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18203 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18204 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18205 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18206 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18207 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18208 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18209 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18210 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18211 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18212 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18213 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18214 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18215 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18216 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18217 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18218 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18219 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18220 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18221 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18222 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18223 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18224 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18225 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18226 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18227 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18228 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18229 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18230 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18231 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18232 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18233 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18234 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18235 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18236 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18237 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18238 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18239 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18240 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18241 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18242 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18243 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18244 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18245 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18246 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18247 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18248 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18249 ALC662_3ST_6ch_DIG),
18250 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18251 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18252 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18253 ALC662_3ST_6ch_DIG),
18254 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18255 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18256 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18257 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18258 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18259 ALC662_3ST_6ch_DIG),
18260 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18265 static struct alc_config_preset alc662_presets[] = {
18266 [ALC662_3ST_2ch_DIG] = {
18267 .mixers = { alc662_3ST_2ch_mixer },
18268 .init_verbs = { alc662_init_verbs },
18269 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18270 .dac_nids = alc662_dac_nids,
18271 .dig_out_nid = ALC662_DIGOUT_NID,
18272 .dig_in_nid = ALC662_DIGIN_NID,
18273 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18274 .channel_mode = alc662_3ST_2ch_modes,
18275 .input_mux = &alc662_capture_source,
18277 [ALC662_3ST_6ch_DIG] = {
18278 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18279 .init_verbs = { alc662_init_verbs },
18280 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18281 .dac_nids = alc662_dac_nids,
18282 .dig_out_nid = ALC662_DIGOUT_NID,
18283 .dig_in_nid = ALC662_DIGIN_NID,
18284 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18285 .channel_mode = alc662_3ST_6ch_modes,
18287 .input_mux = &alc662_capture_source,
18289 [ALC662_3ST_6ch] = {
18290 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18291 .init_verbs = { alc662_init_verbs },
18292 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18293 .dac_nids = alc662_dac_nids,
18294 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18295 .channel_mode = alc662_3ST_6ch_modes,
18297 .input_mux = &alc662_capture_source,
18299 [ALC662_5ST_DIG] = {
18300 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18301 .init_verbs = { alc662_init_verbs },
18302 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18303 .dac_nids = alc662_dac_nids,
18304 .dig_out_nid = ALC662_DIGOUT_NID,
18305 .dig_in_nid = ALC662_DIGIN_NID,
18306 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18307 .channel_mode = alc662_5stack_modes,
18308 .input_mux = &alc662_capture_source,
18310 [ALC662_LENOVO_101E] = {
18311 .mixers = { alc662_lenovo_101e_mixer },
18312 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18313 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18314 .dac_nids = alc662_dac_nids,
18315 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18316 .channel_mode = alc662_3ST_2ch_modes,
18317 .input_mux = &alc662_lenovo_101e_capture_source,
18318 .unsol_event = alc662_lenovo_101e_unsol_event,
18319 .init_hook = alc662_lenovo_101e_all_automute,
18321 [ALC662_ASUS_EEEPC_P701] = {
18322 .mixers = { alc662_eeepc_p701_mixer },
18323 .init_verbs = { alc662_init_verbs,
18324 alc662_eeepc_sue_init_verbs },
18325 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18326 .dac_nids = alc662_dac_nids,
18327 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18328 .channel_mode = alc662_3ST_2ch_modes,
18329 .unsol_event = alc662_eeepc_unsol_event,
18330 .setup = alc662_eeepc_setup,
18331 .init_hook = alc662_eeepc_inithook,
18333 [ALC662_ASUS_EEEPC_EP20] = {
18334 .mixers = { alc662_eeepc_ep20_mixer,
18335 alc662_chmode_mixer },
18336 .init_verbs = { alc662_init_verbs,
18337 alc662_eeepc_ep20_sue_init_verbs },
18338 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18339 .dac_nids = alc662_dac_nids,
18340 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18341 .channel_mode = alc662_3ST_6ch_modes,
18342 .input_mux = &alc662_lenovo_101e_capture_source,
18343 .unsol_event = alc662_eeepc_unsol_event,
18344 .setup = alc662_eeepc_ep20_setup,
18345 .init_hook = alc662_eeepc_ep20_inithook,
18348 .mixers = { alc662_ecs_mixer },
18349 .init_verbs = { alc662_init_verbs,
18350 alc662_ecs_init_verbs },
18351 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18352 .dac_nids = alc662_dac_nids,
18353 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18354 .channel_mode = alc662_3ST_2ch_modes,
18355 .unsol_event = alc662_eeepc_unsol_event,
18356 .setup = alc662_eeepc_setup,
18357 .init_hook = alc662_eeepc_inithook,
18359 [ALC663_ASUS_M51VA] = {
18360 .mixers = { alc663_m51va_mixer },
18361 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18362 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18363 .dac_nids = alc662_dac_nids,
18364 .dig_out_nid = ALC662_DIGOUT_NID,
18365 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18366 .channel_mode = alc662_3ST_2ch_modes,
18367 .unsol_event = alc663_m51va_unsol_event,
18368 .setup = alc663_m51va_setup,
18369 .init_hook = alc663_m51va_inithook,
18371 [ALC663_ASUS_G71V] = {
18372 .mixers = { alc663_g71v_mixer },
18373 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18374 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18375 .dac_nids = alc662_dac_nids,
18376 .dig_out_nid = ALC662_DIGOUT_NID,
18377 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18378 .channel_mode = alc662_3ST_2ch_modes,
18379 .unsol_event = alc663_g71v_unsol_event,
18380 .setup = alc663_g71v_setup,
18381 .init_hook = alc663_g71v_inithook,
18383 [ALC663_ASUS_H13] = {
18384 .mixers = { alc663_m51va_mixer },
18385 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18386 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18387 .dac_nids = alc662_dac_nids,
18388 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18389 .channel_mode = alc662_3ST_2ch_modes,
18390 .unsol_event = alc663_m51va_unsol_event,
18391 .init_hook = alc663_m51va_inithook,
18393 [ALC663_ASUS_G50V] = {
18394 .mixers = { alc663_g50v_mixer },
18395 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18396 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18397 .dac_nids = alc662_dac_nids,
18398 .dig_out_nid = ALC662_DIGOUT_NID,
18399 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18400 .channel_mode = alc662_3ST_6ch_modes,
18401 .input_mux = &alc663_capture_source,
18402 .unsol_event = alc663_g50v_unsol_event,
18403 .setup = alc663_g50v_setup,
18404 .init_hook = alc663_g50v_inithook,
18406 [ALC663_ASUS_MODE1] = {
18407 .mixers = { alc663_m51va_mixer },
18408 .cap_mixer = alc662_auto_capture_mixer,
18409 .init_verbs = { alc662_init_verbs,
18410 alc663_21jd_amic_init_verbs },
18411 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18413 .dac_nids = alc662_dac_nids,
18414 .dig_out_nid = ALC662_DIGOUT_NID,
18415 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18416 .channel_mode = alc662_3ST_2ch_modes,
18417 .unsol_event = alc663_mode1_unsol_event,
18418 .setup = alc663_mode1_setup,
18419 .init_hook = alc663_mode1_inithook,
18421 [ALC662_ASUS_MODE2] = {
18422 .mixers = { alc662_1bjd_mixer },
18423 .cap_mixer = alc662_auto_capture_mixer,
18424 .init_verbs = { alc662_init_verbs,
18425 alc662_1bjd_amic_init_verbs },
18426 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18427 .dac_nids = alc662_dac_nids,
18428 .dig_out_nid = ALC662_DIGOUT_NID,
18429 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18430 .channel_mode = alc662_3ST_2ch_modes,
18431 .unsol_event = alc662_mode2_unsol_event,
18432 .setup = alc662_mode2_setup,
18433 .init_hook = alc662_mode2_inithook,
18435 [ALC663_ASUS_MODE3] = {
18436 .mixers = { alc663_two_hp_m1_mixer },
18437 .cap_mixer = alc662_auto_capture_mixer,
18438 .init_verbs = { alc662_init_verbs,
18439 alc663_two_hp_amic_m1_init_verbs },
18440 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18442 .dac_nids = alc662_dac_nids,
18443 .dig_out_nid = ALC662_DIGOUT_NID,
18444 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18445 .channel_mode = alc662_3ST_2ch_modes,
18446 .unsol_event = alc663_mode3_unsol_event,
18447 .setup = alc663_mode3_setup,
18448 .init_hook = alc663_mode3_inithook,
18450 [ALC663_ASUS_MODE4] = {
18451 .mixers = { alc663_asus_21jd_clfe_mixer },
18452 .cap_mixer = alc662_auto_capture_mixer,
18453 .init_verbs = { alc662_init_verbs,
18454 alc663_21jd_amic_init_verbs},
18455 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18457 .dac_nids = alc662_dac_nids,
18458 .dig_out_nid = ALC662_DIGOUT_NID,
18459 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18460 .channel_mode = alc662_3ST_2ch_modes,
18461 .unsol_event = alc663_mode4_unsol_event,
18462 .setup = alc663_mode4_setup,
18463 .init_hook = alc663_mode4_inithook,
18465 [ALC663_ASUS_MODE5] = {
18466 .mixers = { alc663_asus_15jd_clfe_mixer },
18467 .cap_mixer = alc662_auto_capture_mixer,
18468 .init_verbs = { alc662_init_verbs,
18469 alc663_15jd_amic_init_verbs },
18470 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18472 .dac_nids = alc662_dac_nids,
18473 .dig_out_nid = ALC662_DIGOUT_NID,
18474 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18475 .channel_mode = alc662_3ST_2ch_modes,
18476 .unsol_event = alc663_mode5_unsol_event,
18477 .setup = alc663_mode5_setup,
18478 .init_hook = alc663_mode5_inithook,
18480 [ALC663_ASUS_MODE6] = {
18481 .mixers = { alc663_two_hp_m2_mixer },
18482 .cap_mixer = alc662_auto_capture_mixer,
18483 .init_verbs = { alc662_init_verbs,
18484 alc663_two_hp_amic_m2_init_verbs },
18485 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18487 .dac_nids = alc662_dac_nids,
18488 .dig_out_nid = ALC662_DIGOUT_NID,
18489 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18490 .channel_mode = alc662_3ST_2ch_modes,
18491 .unsol_event = alc663_mode6_unsol_event,
18492 .setup = alc663_mode6_setup,
18493 .init_hook = alc663_mode6_inithook,
18495 [ALC663_ASUS_MODE7] = {
18496 .mixers = { alc663_mode7_mixer },
18497 .cap_mixer = alc662_auto_capture_mixer,
18498 .init_verbs = { alc662_init_verbs,
18499 alc663_mode7_init_verbs },
18500 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18502 .dac_nids = alc662_dac_nids,
18503 .dig_out_nid = ALC662_DIGOUT_NID,
18504 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18505 .channel_mode = alc662_3ST_2ch_modes,
18506 .unsol_event = alc663_mode7_unsol_event,
18507 .setup = alc663_mode7_setup,
18508 .init_hook = alc663_mode7_inithook,
18510 [ALC663_ASUS_MODE8] = {
18511 .mixers = { alc663_mode8_mixer },
18512 .cap_mixer = alc662_auto_capture_mixer,
18513 .init_verbs = { alc662_init_verbs,
18514 alc663_mode8_init_verbs },
18515 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18517 .dac_nids = alc662_dac_nids,
18518 .dig_out_nid = ALC662_DIGOUT_NID,
18519 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18520 .channel_mode = alc662_3ST_2ch_modes,
18521 .unsol_event = alc663_mode8_unsol_event,
18522 .setup = alc663_mode8_setup,
18523 .init_hook = alc663_mode8_inithook,
18526 .mixers = { alc663_m51va_mixer },
18527 .cap_mixer = alc272_auto_capture_mixer,
18528 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18529 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18530 .dac_nids = alc662_dac_nids,
18531 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18532 .adc_nids = alc272_adc_nids,
18533 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18534 .capsrc_nids = alc272_capsrc_nids,
18535 .channel_mode = alc662_3ST_2ch_modes,
18536 .unsol_event = alc663_m51va_unsol_event,
18537 .setup = alc663_m51va_setup,
18538 .init_hook = alc663_m51va_inithook,
18540 [ALC272_DELL_ZM1] = {
18541 .mixers = { alc663_m51va_mixer },
18542 .cap_mixer = alc662_auto_capture_mixer,
18543 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18544 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18545 .dac_nids = alc662_dac_nids,
18546 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18547 .adc_nids = alc662_adc_nids,
18549 .capsrc_nids = alc662_capsrc_nids,
18550 .channel_mode = alc662_3ST_2ch_modes,
18551 .unsol_event = alc663_m51va_unsol_event,
18552 .setup = alc663_m51va_setup,
18553 .init_hook = alc663_m51va_inithook,
18555 [ALC272_SAMSUNG_NC10] = {
18556 .mixers = { alc272_nc10_mixer },
18557 .init_verbs = { alc662_init_verbs,
18558 alc663_21jd_amic_init_verbs },
18559 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18560 .dac_nids = alc272_dac_nids,
18561 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18562 .channel_mode = alc662_3ST_2ch_modes,
18563 /*.input_mux = &alc272_nc10_capture_source,*/
18564 .unsol_event = alc663_mode4_unsol_event,
18565 .setup = alc663_mode4_setup,
18566 .init_hook = alc663_mode4_inithook,
18572 * BIOS auto configuration
18575 /* convert from MIX nid to DAC */
18576 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18580 else if (nid >= 0x0c && nid <= 0x0e)
18581 return nid - 0x0c + 0x02;
18586 /* get MIX nid connected to the given pin targeted to DAC */
18587 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18593 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18594 for (i = 0; i < num; i++) {
18595 if (alc662_mix_to_dac(mix[i]) == dac)
18601 /* look for an empty DAC slot */
18602 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18604 struct alc_spec *spec = codec->spec;
18608 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18611 for (i = 0; i < num; i++) {
18612 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18615 for (j = 0; j < spec->multiout.num_dacs; j++)
18616 if (spec->multiout.dac_nids[j] == nid)
18618 if (j >= spec->multiout.num_dacs)
18624 /* fill in the dac_nids table from the parsed pin configuration */
18625 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18626 const struct auto_pin_cfg *cfg)
18628 struct alc_spec *spec = codec->spec;
18632 spec->multiout.dac_nids = spec->private_dac_nids;
18633 for (i = 0; i < cfg->line_outs; i++) {
18634 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18637 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18642 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18643 hda_nid_t nid, unsigned int chs)
18645 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18646 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18649 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18650 hda_nid_t nid, unsigned int chs)
18652 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18653 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18656 #define alc662_add_stereo_vol(spec, pfx, nid) \
18657 alc662_add_vol_ctl(spec, pfx, nid, 3)
18658 #define alc662_add_stereo_sw(spec, pfx, nid) \
18659 alc662_add_sw_ctl(spec, pfx, nid, 3)
18661 /* add playback controls from the parsed DAC table */
18662 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18663 const struct auto_pin_cfg *cfg)
18665 struct alc_spec *spec = codec->spec;
18666 static const char *chname[4] = {
18667 "Front", "Surround", NULL /*CLFE*/, "Side"
18669 hda_nid_t nid, mix;
18672 for (i = 0; i < cfg->line_outs; i++) {
18673 nid = spec->multiout.dac_nids[i];
18676 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18681 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18684 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18687 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18690 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18695 if (cfg->line_outs == 1 &&
18696 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18703 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18706 if (cfg->line_outs == 1 &&
18707 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18709 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18717 /* add playback controls for speaker and HP outputs */
18718 /* return DAC nid if any new DAC is assigned */
18719 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18722 struct alc_spec *spec = codec->spec;
18723 hda_nid_t nid, mix;
18728 nid = alc662_look_for_dac(codec, pin);
18730 /* the corresponding DAC is already occupied */
18731 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18732 return 0; /* no way */
18733 /* create a switch only */
18734 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18735 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18738 mix = alc662_dac_to_mix(codec, pin, nid);
18741 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18744 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18750 /* create playback/capture controls for input pins */
18751 #define alc662_auto_create_input_ctls \
18752 alc882_auto_create_input_ctls
18754 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18755 hda_nid_t nid, int pin_type,
18759 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18761 alc_set_pin_output(codec, nid, pin_type);
18762 /* need the manual connection? */
18763 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18766 for (i = 0; i < num; i++) {
18767 if (alc662_mix_to_dac(srcs[i]) != dac)
18769 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18774 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18776 struct alc_spec *spec = codec->spec;
18777 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18780 for (i = 0; i <= HDA_SIDE; i++) {
18781 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18783 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18784 spec->multiout.dac_nids[i]);
18788 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18790 struct alc_spec *spec = codec->spec;
18793 pin = spec->autocfg.hp_pins[0];
18795 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18796 spec->multiout.hp_nid);
18797 pin = spec->autocfg.speaker_pins[0];
18799 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18800 spec->multiout.extra_out_nid[0]);
18803 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18805 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18807 struct alc_spec *spec = codec->spec;
18810 for (i = 0; i < AUTO_PIN_LAST; i++) {
18811 hda_nid_t nid = spec->autocfg.input_pins[i];
18812 if (alc_is_input_pin(codec, nid)) {
18813 alc_set_input_pin(codec, nid, i);
18814 if (nid != ALC662_PIN_CD_NID &&
18815 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18816 snd_hda_codec_write(codec, nid, 0,
18817 AC_VERB_SET_AMP_GAIN_MUTE,
18823 #define alc662_auto_init_input_src alc882_auto_init_input_src
18825 static int alc662_parse_auto_config(struct hda_codec *codec)
18827 struct alc_spec *spec = codec->spec;
18829 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18831 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18835 if (!spec->autocfg.line_outs)
18836 return 0; /* can't find valid BIOS pin config */
18838 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18841 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18844 err = alc662_auto_create_extra_out(codec,
18845 spec->autocfg.speaker_pins[0],
18850 spec->multiout.extra_out_nid[0] = err;
18851 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18856 spec->multiout.hp_nid = err;
18857 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18861 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18863 alc_auto_parse_digital(codec);
18865 if (spec->kctls.list)
18866 add_mixer(spec, spec->kctls.list);
18868 spec->num_mux_defs = 1;
18869 spec->input_mux = &spec->private_imux[0];
18871 add_verb(spec, alc662_init_verbs);
18872 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18873 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18874 add_verb(spec, alc663_init_verbs);
18876 if (codec->vendor_id == 0x10ec0272)
18877 add_verb(spec, alc272_init_verbs);
18879 err = alc_auto_add_mic_boost(codec);
18883 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18884 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18885 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18887 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18892 /* additional initialization for auto-configuration model */
18893 static void alc662_auto_init(struct hda_codec *codec)
18895 struct alc_spec *spec = codec->spec;
18896 alc662_auto_init_multi_out(codec);
18897 alc662_auto_init_hp_out(codec);
18898 alc662_auto_init_analog_input(codec);
18899 alc662_auto_init_input_src(codec);
18900 alc_auto_init_digital(codec);
18901 if (spec->unsol_event)
18902 alc_inithook(codec);
18905 static int patch_alc662(struct hda_codec *codec)
18907 struct alc_spec *spec;
18908 int err, board_config;
18910 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18914 codec->spec = spec;
18916 alc_auto_parse_customize_define(codec);
18918 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18920 if (alc_read_coef_idx(codec, 0) == 0x8020)
18921 alc_codec_rename(codec, "ALC661");
18922 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18923 codec->bus->pci->subsystem_vendor == 0x1025 &&
18924 spec->cdefine.platform_type == 1)
18925 alc_codec_rename(codec, "ALC272X");
18927 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18930 if (board_config < 0) {
18931 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18933 board_config = ALC662_AUTO;
18936 if (board_config == ALC662_AUTO) {
18937 /* automatic parse from the BIOS config */
18938 err = alc662_parse_auto_config(codec);
18944 "hda_codec: Cannot set up configuration "
18945 "from BIOS. Using base mode...\n");
18946 board_config = ALC662_3ST_2ch_DIG;
18950 if (has_cdefine_beep(codec)) {
18951 err = snd_hda_attach_beep_device(codec, 0x1);
18958 if (board_config != ALC662_AUTO)
18959 setup_preset(codec, &alc662_presets[board_config]);
18961 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18962 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18964 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18965 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18967 if (!spec->adc_nids) {
18968 spec->adc_nids = alc662_adc_nids;
18969 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18971 if (!spec->capsrc_nids)
18972 spec->capsrc_nids = alc662_capsrc_nids;
18974 if (!spec->cap_mixer)
18975 set_capture_mixer(codec);
18977 if (has_cdefine_beep(codec)) {
18978 switch (codec->vendor_id) {
18980 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18985 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18988 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18992 spec->vmaster_nid = 0x02;
18994 codec->patch_ops = alc_patch_ops;
18995 if (board_config == ALC662_AUTO)
18996 spec->init_hook = alc662_auto_init;
18997 #ifdef CONFIG_SND_HDA_POWER_SAVE
18998 if (!spec->loopback.amplist)
18999 spec->loopback.amplist = alc662_loopbacks;
19005 static int patch_alc888(struct hda_codec *codec)
19007 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19008 kfree(codec->chip_name);
19009 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19010 if (!codec->chip_name) {
19014 return patch_alc662(codec);
19016 return patch_alc882(codec);
19022 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19023 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19024 #define alc680_modes alc260_modes
19026 static hda_nid_t alc680_dac_nids[3] = {
19027 /* Lout1, Lout2, hp */
19031 static hda_nid_t alc680_adc_nids[3] = {
19033 /* DMIC, MIC, Line-in*/
19038 * Analog capture ADC cgange
19040 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19041 struct hda_codec *codec,
19042 unsigned int stream_tag,
19043 unsigned int format,
19044 struct snd_pcm_substream *substream)
19046 struct alc_spec *spec = codec->spec;
19047 struct auto_pin_cfg *cfg = &spec->autocfg;
19048 unsigned int pre_mic, pre_line;
19050 pre_mic = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]);
19051 pre_line = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_LINE]);
19053 spec->cur_adc_stream_tag = stream_tag;
19054 spec->cur_adc_format = format;
19056 if (pre_mic || pre_line) {
19058 snd_hda_codec_setup_stream(codec, 0x08, stream_tag, 0,
19061 snd_hda_codec_setup_stream(codec, 0x09, stream_tag, 0,
19064 snd_hda_codec_setup_stream(codec, 0x07, stream_tag, 0, format);
19068 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19069 struct hda_codec *codec,
19070 struct snd_pcm_substream *substream)
19072 snd_hda_codec_cleanup_stream(codec, 0x07);
19073 snd_hda_codec_cleanup_stream(codec, 0x08);
19074 snd_hda_codec_cleanup_stream(codec, 0x09);
19078 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19079 .substreams = 1, /* can be overridden */
19082 /* NID is set in alc_build_pcms */
19084 .prepare = alc680_capture_pcm_prepare,
19085 .cleanup = alc680_capture_pcm_cleanup
19089 static struct snd_kcontrol_new alc680_base_mixer[] = {
19090 /* output mixer control */
19091 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19092 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19093 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19095 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19097 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19101 static struct hda_bind_ctls alc680_bind_cap_vol = {
19102 .ops = &snd_hda_bind_vol,
19104 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19105 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19106 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19111 static struct hda_bind_ctls alc680_bind_cap_switch = {
19112 .ops = &snd_hda_bind_sw,
19114 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19115 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19116 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19121 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19122 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19123 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19128 * generic initialization of ADC, input mixers and output mixers
19130 static struct hda_verb alc680_init_verbs[] = {
19131 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19132 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19133 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19135 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19137 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19138 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19139 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19140 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19142 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19144 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19148 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19149 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19154 /* toggle speaker-output according to the hp-jack state */
19155 static void alc680_base_setup(struct hda_codec *codec)
19157 struct alc_spec *spec = codec->spec;
19159 spec->autocfg.hp_pins[0] = 0x16;
19160 spec->autocfg.speaker_pins[0] = 0x14;
19161 spec->autocfg.speaker_pins[1] = 0x15;
19162 spec->autocfg.input_pins[AUTO_PIN_MIC] = 0x18;
19163 spec->autocfg.input_pins[AUTO_PIN_LINE] = 0x19;
19166 static void alc680_rec_autoswitch(struct hda_codec *codec)
19168 struct alc_spec *spec = codec->spec;
19169 struct auto_pin_cfg *cfg = &spec->autocfg;
19170 unsigned int present;
19173 present = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]);
19175 new_adc = present ? 0x8 : 0x7;
19176 __snd_hda_codec_cleanup_stream(codec, !present ? 0x8 : 0x7, 1);
19177 snd_hda_codec_setup_stream(codec, new_adc,
19178 spec->cur_adc_stream_tag, 0,
19179 spec->cur_adc_format);
19183 static void alc680_unsol_event(struct hda_codec *codec,
19186 if ((res >> 26) == ALC880_HP_EVENT)
19187 alc_automute_amp(codec);
19188 if ((res >> 26) == ALC880_MIC_EVENT)
19189 alc680_rec_autoswitch(codec);
19192 static void alc680_inithook(struct hda_codec *codec)
19194 alc_automute_amp(codec);
19195 alc680_rec_autoswitch(codec);
19198 /* create input playback/capture controls for the given pin */
19199 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19200 const char *ctlname, int idx)
19218 if (spec->multiout.dac_nids[0] != dac &&
19219 spec->multiout.dac_nids[1] != dac) {
19220 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19221 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19226 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19227 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19231 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19237 /* add playback controls from the parsed DAC table */
19238 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19239 const struct auto_pin_cfg *cfg)
19244 spec->multiout.dac_nids = spec->private_dac_nids;
19246 nid = cfg->line_out_pins[0];
19249 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19253 err = alc680_new_analog_output(spec, nid, name, 0);
19258 nid = cfg->speaker_pins[0];
19260 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19264 nid = cfg->hp_pins[0];
19266 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19274 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19275 hda_nid_t nid, int pin_type)
19277 alc_set_pin_output(codec, nid, pin_type);
19280 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19282 struct alc_spec *spec = codec->spec;
19283 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19285 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19286 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19290 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19292 struct alc_spec *spec = codec->spec;
19295 pin = spec->autocfg.hp_pins[0];
19297 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19298 pin = spec->autocfg.speaker_pins[0];
19300 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19303 /* pcm configuration: identical with ALC880 */
19304 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19305 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19306 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19307 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19308 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19311 * BIOS auto configuration
19313 static int alc680_parse_auto_config(struct hda_codec *codec)
19315 struct alc_spec *spec = codec->spec;
19317 static hda_nid_t alc680_ignore[] = { 0 };
19319 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19324 if (!spec->autocfg.line_outs) {
19325 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19326 spec->multiout.max_channels = 2;
19327 spec->no_analog = 1;
19330 return 0; /* can't find valid BIOS pin config */
19332 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19336 spec->multiout.max_channels = 2;
19339 /* digital only support output */
19340 alc_auto_parse_digital(codec);
19341 if (spec->kctls.list)
19342 add_mixer(spec, spec->kctls.list);
19344 add_verb(spec, alc680_init_verbs);
19346 err = alc_auto_add_mic_boost(codec);
19353 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19355 /* init callback for auto-configuration model -- overriding the default init */
19356 static void alc680_auto_init(struct hda_codec *codec)
19358 struct alc_spec *spec = codec->spec;
19359 alc680_auto_init_multi_out(codec);
19360 alc680_auto_init_hp_out(codec);
19361 alc680_auto_init_analog_input(codec);
19362 alc_auto_init_digital(codec);
19363 if (spec->unsol_event)
19364 alc_inithook(codec);
19368 * configuration and preset
19370 static const char *alc680_models[ALC680_MODEL_LAST] = {
19371 [ALC680_BASE] = "base",
19372 [ALC680_AUTO] = "auto",
19375 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19376 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19380 static struct alc_config_preset alc680_presets[] = {
19382 .mixers = { alc680_base_mixer },
19383 .cap_mixer = alc680_master_capture_mixer,
19384 .init_verbs = { alc680_init_verbs },
19385 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19386 .dac_nids = alc680_dac_nids,
19387 .dig_out_nid = ALC680_DIGOUT_NID,
19388 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19389 .channel_mode = alc680_modes,
19390 .unsol_event = alc680_unsol_event,
19391 .setup = alc680_base_setup,
19392 .init_hook = alc680_inithook,
19397 static int patch_alc680(struct hda_codec *codec)
19399 struct alc_spec *spec;
19403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19407 codec->spec = spec;
19409 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19413 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19414 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19416 board_config = ALC680_AUTO;
19419 if (board_config == ALC680_AUTO) {
19420 /* automatic parse from the BIOS config */
19421 err = alc680_parse_auto_config(codec);
19427 "hda_codec: Cannot set up configuration "
19428 "from BIOS. Using base mode...\n");
19429 board_config = ALC680_BASE;
19433 if (board_config != ALC680_AUTO)
19434 setup_preset(codec, &alc680_presets[board_config]);
19436 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19437 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19438 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19439 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19441 if (!spec->adc_nids) {
19442 spec->adc_nids = alc680_adc_nids;
19443 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19446 if (!spec->cap_mixer)
19447 set_capture_mixer(codec);
19449 spec->vmaster_nid = 0x02;
19451 codec->patch_ops = alc_patch_ops;
19452 if (board_config == ALC680_AUTO)
19453 spec->init_hook = alc680_auto_init;
19461 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19462 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19463 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19464 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19465 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19466 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19467 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19468 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19469 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19470 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19471 .patch = patch_alc861 },
19472 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19473 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19474 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19475 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19476 .patch = patch_alc882 },
19477 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19478 .patch = patch_alc662 },
19479 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19480 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19481 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19482 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19483 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19484 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19485 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19486 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19487 .patch = patch_alc882 },
19488 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19489 .patch = patch_alc882 },
19490 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19491 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19492 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19493 .patch = patch_alc882 },
19494 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19495 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19496 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19497 {} /* terminator */
19500 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19502 MODULE_LICENSE("GPL");
19503 MODULE_DESCRIPTION("Realtek HD-audio codec");
19505 static struct hda_codec_preset_list realtek_list = {
19506 .preset = snd_hda_preset_realtek,
19507 .owner = THIS_MODULE,
19510 static int __init patch_realtek_init(void)
19512 return snd_hda_add_codec_preset(&realtek_list);
19515 static void __exit patch_realtek_exit(void)
19517 snd_hda_delete_codec_preset(&realtek_list);
19520 module_init(patch_realtek_init)
19521 module_exit(patch_realtek_exit)