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_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_speaker(struct hda_codec *codec, int pinctl)
995 struct alc_spec *spec = codec->spec;
1000 spec->jack_present = 0;
1001 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1002 nid = spec->autocfg.hp_pins[i];
1005 if (snd_hda_jack_detect(codec, nid)) {
1006 spec->jack_present = 1;
1011 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1012 /* Toggle internal speakers muting */
1013 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1014 nid = spec->autocfg.speaker_pins[i];
1018 snd_hda_codec_write(codec, nid, 0,
1019 AC_VERB_SET_PIN_WIDGET_CONTROL,
1020 spec->jack_present ? 0 : PIN_OUT);
1022 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1023 HDA_AMP_MUTE, mute);
1028 static void alc_automute_pin(struct hda_codec *codec)
1030 alc_automute_speaker(codec, 1);
1033 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1036 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1039 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1040 for (i = 0; i < nums; i++)
1046 /* switch the current ADC according to the jack state */
1047 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1049 struct alc_spec *spec = codec->spec;
1050 unsigned int present;
1053 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1055 spec->cur_adc_idx = 1;
1057 spec->cur_adc_idx = 0;
1058 new_adc = spec->adc_nids[spec->cur_adc_idx];
1059 if (spec->cur_adc && spec->cur_adc != new_adc) {
1060 /* stream is running, let's swap the current ADC */
1061 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1062 spec->cur_adc = new_adc;
1063 snd_hda_codec_setup_stream(codec, new_adc,
1064 spec->cur_adc_stream_tag, 0,
1065 spec->cur_adc_format);
1069 static void alc_mic_automute(struct hda_codec *codec)
1071 struct alc_spec *spec = codec->spec;
1072 struct alc_mic_route *dead, *alive;
1073 unsigned int present, type;
1076 if (!spec->auto_mic)
1078 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1080 if (snd_BUG_ON(!spec->adc_nids))
1083 if (spec->dual_adc_switch) {
1084 alc_dual_mic_adc_auto_switch(codec);
1088 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1090 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1092 alive = &spec->ext_mic;
1093 dead = &spec->int_mic;
1095 alive = &spec->int_mic;
1096 dead = &spec->ext_mic;
1099 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1100 if (type == AC_WID_AUD_MIX) {
1101 /* Matrix-mixer style (e.g. ALC882) */
1102 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1105 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1107 HDA_AMP_MUTE, HDA_AMP_MUTE);
1109 /* MUX style (e.g. ALC880) */
1110 snd_hda_codec_write_cache(codec, cap_nid, 0,
1111 AC_VERB_SET_CONNECT_SEL,
1115 /* FIXME: analog mixer */
1118 /* unsolicited event for HP jack sensing */
1119 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1121 if (codec->vendor_id == 0x10ec0880)
1126 case ALC880_HP_EVENT:
1127 alc_automute_pin(codec);
1129 case ALC880_MIC_EVENT:
1130 alc_mic_automute(codec);
1135 static void alc_inithook(struct hda_codec *codec)
1137 alc_automute_pin(codec);
1138 alc_mic_automute(codec);
1141 /* additional initialization for ALC888 variants */
1142 static void alc888_coef_init(struct hda_codec *codec)
1146 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1147 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1148 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1149 if ((tmp & 0xf0) == 0x20)
1151 snd_hda_codec_read(codec, 0x20, 0,
1152 AC_VERB_SET_PROC_COEF, 0x830);
1155 snd_hda_codec_read(codec, 0x20, 0,
1156 AC_VERB_SET_PROC_COEF, 0x3030);
1159 static void alc889_coef_init(struct hda_codec *codec)
1163 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1164 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1165 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1166 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1169 /* turn on/off EAPD control (only if available) */
1170 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1172 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1174 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1175 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1179 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1184 case ALC_INIT_GPIO1:
1185 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1187 case ALC_INIT_GPIO2:
1188 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1190 case ALC_INIT_GPIO3:
1191 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1193 case ALC_INIT_DEFAULT:
1194 switch (codec->vendor_id) {
1196 set_eapd(codec, 0x0f, 1);
1197 set_eapd(codec, 0x10, 1);
1210 set_eapd(codec, 0x14, 1);
1211 set_eapd(codec, 0x15, 1);
1214 switch (codec->vendor_id) {
1216 snd_hda_codec_write(codec, 0x1a, 0,
1217 AC_VERB_SET_COEF_INDEX, 7);
1218 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1219 AC_VERB_GET_PROC_COEF, 0);
1220 snd_hda_codec_write(codec, 0x1a, 0,
1221 AC_VERB_SET_COEF_INDEX, 7);
1222 snd_hda_codec_write(codec, 0x1a, 0,
1223 AC_VERB_SET_PROC_COEF,
1233 alc889_coef_init(codec);
1236 alc888_coef_init(codec);
1238 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1241 snd_hda_codec_write(codec, 0x20, 0,
1242 AC_VERB_SET_COEF_INDEX, 7);
1243 tmp = snd_hda_codec_read(codec, 0x20, 0,
1244 AC_VERB_GET_PROC_COEF, 0);
1245 snd_hda_codec_write(codec, 0x20, 0,
1246 AC_VERB_SET_COEF_INDEX, 7);
1247 snd_hda_codec_write(codec, 0x20, 0,
1248 AC_VERB_SET_PROC_COEF,
1257 static void alc_init_auto_hp(struct hda_codec *codec)
1259 struct alc_spec *spec = codec->spec;
1260 struct auto_pin_cfg *cfg = &spec->autocfg;
1263 if (!cfg->hp_pins[0]) {
1264 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1268 if (!cfg->speaker_pins[0]) {
1269 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1271 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1272 sizeof(cfg->speaker_pins));
1273 cfg->speaker_outs = cfg->line_outs;
1276 if (!cfg->hp_pins[0]) {
1277 memcpy(cfg->hp_pins, cfg->line_out_pins,
1278 sizeof(cfg->hp_pins));
1279 cfg->hp_outs = cfg->line_outs;
1282 for (i = 0; i < cfg->hp_outs; i++) {
1283 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1285 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1286 AC_VERB_SET_UNSOLICITED_ENABLE,
1287 AC_USRSP_EN | ALC880_HP_EVENT);
1289 spec->unsol_event = alc_sku_unsol_event;
1292 static void alc_init_auto_mic(struct hda_codec *codec)
1294 struct alc_spec *spec = codec->spec;
1295 struct auto_pin_cfg *cfg = &spec->autocfg;
1296 hda_nid_t fixed, ext;
1299 /* there must be only two mic inputs exclusively */
1300 for (i = 0; i < cfg->num_inputs; i++)
1301 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1305 for (i = 0; i < cfg->num_inputs; i++) {
1306 hda_nid_t nid = cfg->inputs[i].pin;
1307 unsigned int defcfg;
1308 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1309 switch (get_defcfg_connect(defcfg)) {
1310 case AC_JACK_PORT_FIXED:
1312 return; /* already occupied */
1315 case AC_JACK_PORT_COMPLEX:
1317 return; /* already occupied */
1321 return; /* invalid entry */
1326 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1327 return; /* no unsol support */
1328 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1330 spec->ext_mic.pin = ext;
1331 spec->int_mic.pin = fixed;
1332 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1333 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1335 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1336 AC_VERB_SET_UNSOLICITED_ENABLE,
1337 AC_USRSP_EN | ALC880_MIC_EVENT);
1338 spec->unsol_event = alc_sku_unsol_event;
1341 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1343 unsigned int ass, tmp, i;
1345 struct alc_spec *spec = codec->spec;
1347 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1349 ass = codec->subsystem_id & 0xffff;
1350 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1354 if (codec->vendor_id == 0x10ec0260)
1356 ass = snd_hda_codec_get_pincfg(codec, nid);
1359 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1360 codec->chip_name, ass);
1366 for (i = 1; i < 16; i++) {
1370 if (((ass >> 16) & 0xf) != tmp)
1373 spec->cdefine.port_connectivity = ass >> 30;
1374 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1375 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1376 spec->cdefine.customization = ass >> 8;
1378 spec->cdefine.sku_cfg = ass;
1379 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1380 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1381 spec->cdefine.swap = (ass & 0x2) >> 1;
1382 spec->cdefine.override = ass & 0x1;
1384 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1385 nid, spec->cdefine.sku_cfg);
1386 snd_printd("SKU: port_connectivity=0x%x\n",
1387 spec->cdefine.port_connectivity);
1388 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1389 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1390 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1391 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1392 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1393 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1394 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1399 /* check subsystem ID and set up device-specific initialization;
1400 * return 1 if initialized, 0 if invalid SSID
1402 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1403 * 31 ~ 16 : Manufacture ID
1405 * 7 ~ 0 : Assembly ID
1406 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1408 static int alc_subsystem_id(struct hda_codec *codec,
1409 hda_nid_t porta, hda_nid_t porte,
1410 hda_nid_t portd, hda_nid_t porti)
1412 unsigned int ass, tmp, i;
1414 struct alc_spec *spec = codec->spec;
1416 ass = codec->subsystem_id & 0xffff;
1417 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1420 /* invalid SSID, check the special NID pin defcfg instead */
1422 * 31~30 : port connectivity
1425 * 19~16 : Check sum (15:1)
1430 if (codec->vendor_id == 0x10ec0260)
1432 ass = snd_hda_codec_get_pincfg(codec, nid);
1433 snd_printd("realtek: No valid SSID, "
1434 "checking pincfg 0x%08x for NID 0x%x\n",
1438 if ((ass >> 30) != 1) /* no physical connection */
1443 for (i = 1; i < 16; i++) {
1447 if (((ass >> 16) & 0xf) != tmp)
1450 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1451 ass & 0xffff, codec->vendor_id);
1455 * 2 : 0 --> Desktop, 1 --> Laptop
1456 * 3~5 : External Amplifier control
1459 tmp = (ass & 0x38) >> 3; /* external Amp control */
1462 spec->init_amp = ALC_INIT_GPIO1;
1465 spec->init_amp = ALC_INIT_GPIO2;
1468 spec->init_amp = ALC_INIT_GPIO3;
1471 spec->init_amp = ALC_INIT_DEFAULT;
1475 /* is laptop or Desktop and enable the function "Mute internal speaker
1476 * when the external headphone out jack is plugged"
1478 if (!(ass & 0x8000))
1481 * 10~8 : Jack location
1482 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1484 * 15 : 1 --> enable the function "Mute internal speaker
1485 * when the external headphone out jack is plugged"
1487 if (!spec->autocfg.hp_pins[0]) {
1489 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1500 for (i = 0; i < spec->autocfg.line_outs; i++)
1501 if (spec->autocfg.line_out_pins[i] == nid)
1503 spec->autocfg.hp_pins[0] = nid;
1506 alc_init_auto_hp(codec);
1507 alc_init_auto_mic(codec);
1511 static void alc_ssid_check(struct hda_codec *codec,
1512 hda_nid_t porta, hda_nid_t porte,
1513 hda_nid_t portd, hda_nid_t porti)
1515 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1516 struct alc_spec *spec = codec->spec;
1517 snd_printd("realtek: "
1518 "Enable default setup for auto mode as fallback\n");
1519 spec->init_amp = ALC_INIT_DEFAULT;
1520 alc_init_auto_hp(codec);
1521 alc_init_auto_mic(codec);
1526 * Fix-up pin default configurations and add default verbs
1535 const struct alc_pincfg *pins;
1536 const struct hda_verb *verbs;
1539 static void alc_pick_fixup(struct hda_codec *codec,
1540 const struct snd_pci_quirk *quirk,
1541 const struct alc_fixup *fix,
1544 const struct alc_pincfg *cfg;
1546 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1549 fix += quirk->value;
1551 if (pre_init && cfg) {
1552 #ifdef CONFIG_SND_DEBUG_VERBOSE
1553 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1554 codec->chip_name, quirk->name);
1556 for (; cfg->nid; cfg++)
1557 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1559 if (!pre_init && fix->verbs) {
1560 #ifdef CONFIG_SND_DEBUG_VERBOSE
1561 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1562 codec->chip_name, quirk->name);
1564 add_verb(codec->spec, fix->verbs);
1568 static int alc_read_coef_idx(struct hda_codec *codec,
1569 unsigned int coef_idx)
1572 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1574 val = snd_hda_codec_read(codec, 0x20, 0,
1575 AC_VERB_GET_PROC_COEF, 0);
1579 /* set right pin controls for digital I/O */
1580 static void alc_auto_init_digital(struct hda_codec *codec)
1582 struct alc_spec *spec = codec->spec;
1586 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1587 pin = spec->autocfg.dig_out_pins[i];
1589 snd_hda_codec_write(codec, pin, 0,
1590 AC_VERB_SET_PIN_WIDGET_CONTROL,
1594 pin = spec->autocfg.dig_in_pin;
1596 snd_hda_codec_write(codec, pin, 0,
1597 AC_VERB_SET_PIN_WIDGET_CONTROL,
1601 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1602 static void alc_auto_parse_digital(struct hda_codec *codec)
1604 struct alc_spec *spec = codec->spec;
1608 /* support multiple SPDIFs; the secondary is set up as a slave */
1609 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1610 err = snd_hda_get_connections(codec,
1611 spec->autocfg.dig_out_pins[i],
1616 spec->multiout.dig_out_nid = dig_nid;
1617 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1619 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1620 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1622 spec->slave_dig_outs[i - 1] = dig_nid;
1626 if (spec->autocfg.dig_in_pin) {
1628 err = snd_hda_get_connections(codec,
1629 spec->autocfg.dig_in_pin,
1632 spec->dig_in_nid = dig_nid;
1643 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1644 /* Mic-in jack as mic in */
1645 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1646 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1647 /* Line-in jack as Line in */
1648 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1649 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1650 /* Line-Out as Front */
1651 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1658 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1659 /* Mic-in jack as mic in */
1660 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1661 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
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 Front */
1666 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1673 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1674 /* Mic-in jack as CLFE */
1675 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1676 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1677 /* Line-in jack as Surround */
1678 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1679 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1680 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1681 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1688 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1689 /* Mic-in jack as CLFE */
1690 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1691 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1692 /* Line-in jack as Surround */
1693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1694 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1695 /* Line-Out as Side */
1696 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1700 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1701 { 2, alc888_4ST_ch2_intel_init },
1702 { 4, alc888_4ST_ch4_intel_init },
1703 { 6, alc888_4ST_ch6_intel_init },
1704 { 8, alc888_4ST_ch8_intel_init },
1708 * ALC888 Fujitsu Siemens Amillo xa3530
1711 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1712 /* Front Mic: set to PIN_IN (empty by default) */
1713 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1714 /* Connect Internal HP to Front */
1715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1717 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1718 /* Connect Bass HP to Front */
1719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1720 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1721 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1722 /* Connect Line-Out side jack (SPDIF) to Side */
1723 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1725 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1726 /* Connect Mic jack to CLFE */
1727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1729 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1730 /* Connect Line-in jack to Surround */
1731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1733 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1734 /* Connect HP out jack to Front */
1735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1736 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1737 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1738 /* Enable unsolicited event for HP jack and Line-out jack */
1739 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1740 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1744 static void alc_automute_amp(struct hda_codec *codec)
1746 alc_automute_speaker(codec, 0);
1749 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1752 if (codec->vendor_id == 0x10ec0880)
1756 if (res == ALC880_HP_EVENT)
1757 alc_automute_amp(codec);
1760 static void alc889_automute_setup(struct hda_codec *codec)
1762 struct alc_spec *spec = codec->spec;
1764 spec->autocfg.hp_pins[0] = 0x15;
1765 spec->autocfg.speaker_pins[0] = 0x14;
1766 spec->autocfg.speaker_pins[1] = 0x16;
1767 spec->autocfg.speaker_pins[2] = 0x17;
1768 spec->autocfg.speaker_pins[3] = 0x19;
1769 spec->autocfg.speaker_pins[4] = 0x1a;
1772 static void alc889_intel_init_hook(struct hda_codec *codec)
1774 alc889_coef_init(codec);
1775 alc_automute_amp(codec);
1778 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1780 struct alc_spec *spec = codec->spec;
1782 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1783 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1784 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1785 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1789 * ALC888 Acer Aspire 4930G model
1792 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1793 /* Front Mic: set to PIN_IN (empty by default) */
1794 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1795 /* Unselect Front Mic by default in input mixer 3 */
1796 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1797 /* Enable unsolicited event for HP jack */
1798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1799 /* Connect Internal HP to front */
1800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1801 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1802 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1803 /* Connect HP out to front */
1804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1806 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1811 * ALC888 Acer Aspire 6530G model
1814 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1815 /* Route to built-in subwoofer as well as speakers */
1816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1818 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1820 /* Bias voltage on for external mic port */
1821 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1822 /* Front Mic: set to PIN_IN (empty by default) */
1823 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1824 /* Unselect Front Mic by default in input mixer 3 */
1825 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1826 /* Enable unsolicited event for HP jack */
1827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1828 /* Enable speaker output */
1829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1830 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1831 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1832 /* Enable headphone output */
1833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1835 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1836 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1841 * ALC889 Acer Aspire 8930G model
1844 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1845 /* Front Mic: set to PIN_IN (empty by default) */
1846 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1847 /* Unselect Front Mic by default in input mixer 3 */
1848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1849 /* Enable unsolicited event for HP jack */
1850 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1851 /* Connect Internal Front to Front */
1852 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1853 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1854 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1855 /* Connect Internal Rear to Rear */
1856 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1857 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1858 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1859 /* Connect Internal CLFE to CLFE */
1860 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1861 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1862 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1863 /* Connect HP out to Front */
1864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1866 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1867 /* Enable all DACs */
1868 /* DAC DISABLE/MUTE 1? */
1869 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1870 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1871 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1872 /* DAC DISABLE/MUTE 2? */
1873 /* some bit here disables the other DACs. Init=0x4900 */
1874 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1875 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1877 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1878 * which makes the stereo useless. However, either the mic or the ALC889
1879 * makes the signal become a difference/sum signal instead of standard
1880 * stereo, which is annoying. So instead we flip this bit which makes the
1881 * codec replicate the sum signal to both channels, turning it into a
1884 /* DMIC_CONTROL? Init value = 0x0001 */
1885 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1886 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1890 static struct hda_input_mux alc888_2_capture_sources[2] = {
1891 /* Front mic only available on one ADC */
1898 { "Front Mic", 0xb },
1911 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1912 /* Interal mic only available on one ADC */
1919 { "Input Mix", 0xa },
1929 { "Input Mix", 0xa },
1934 static struct hda_input_mux alc889_capture_sources[3] = {
1935 /* Digital mic only available on first "ADC" */
1942 { "Front Mic", 0xb },
1943 { "Input Mix", 0xa },
1952 { "Input Mix", 0xa },
1961 { "Input Mix", 0xa },
1966 static struct snd_kcontrol_new alc888_base_mixer[] = {
1967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1969 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1970 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1971 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1973 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1974 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1975 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1976 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1977 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1978 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1979 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1983 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1988 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1992 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1993 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1995 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1996 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1997 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1998 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1999 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2007 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2009 struct alc_spec *spec = codec->spec;
2011 spec->autocfg.hp_pins[0] = 0x15;
2012 spec->autocfg.speaker_pins[0] = 0x14;
2013 spec->autocfg.speaker_pins[1] = 0x16;
2014 spec->autocfg.speaker_pins[2] = 0x17;
2017 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2019 struct alc_spec *spec = codec->spec;
2021 spec->autocfg.hp_pins[0] = 0x15;
2022 spec->autocfg.speaker_pins[0] = 0x14;
2023 spec->autocfg.speaker_pins[1] = 0x16;
2024 spec->autocfg.speaker_pins[2] = 0x17;
2027 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2029 struct alc_spec *spec = codec->spec;
2031 spec->autocfg.hp_pins[0] = 0x15;
2032 spec->autocfg.speaker_pins[0] = 0x14;
2033 spec->autocfg.speaker_pins[1] = 0x16;
2034 spec->autocfg.speaker_pins[2] = 0x1b;
2038 * ALC880 3-stack model
2040 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2041 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2042 * F-Mic = 0x1b, HP = 0x19
2045 static hda_nid_t alc880_dac_nids[4] = {
2046 /* front, rear, clfe, rear_surr */
2047 0x02, 0x05, 0x04, 0x03
2050 static hda_nid_t alc880_adc_nids[3] = {
2055 /* The datasheet says the node 0x07 is connected from inputs,
2056 * but it shows zero connection in the real implementation on some devices.
2057 * Note: this is a 915GAV bug, fixed on 915GLV
2059 static hda_nid_t alc880_adc_nids_alt[2] = {
2064 #define ALC880_DIGOUT_NID 0x06
2065 #define ALC880_DIGIN_NID 0x0a
2067 static struct hda_input_mux alc880_capture_source = {
2071 { "Front Mic", 0x3 },
2077 /* channel source setting (2/6 channel selection for 3-stack) */
2079 static struct hda_verb alc880_threestack_ch2_init[] = {
2080 /* set line-in to input, mute it */
2081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2083 /* set mic-in to input vref 80%, mute it */
2084 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2085 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2090 static struct hda_verb alc880_threestack_ch6_init[] = {
2091 /* set line-in to output, unmute it */
2092 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2093 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2094 /* set mic-in to output, unmute it */
2095 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2096 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2100 static struct hda_channel_mode alc880_threestack_modes[2] = {
2101 { 2, alc880_threestack_ch2_init },
2102 { 6, alc880_threestack_ch6_init },
2105 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2106 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2107 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2108 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2109 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2110 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2111 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2112 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2113 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2114 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2115 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2116 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2117 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2125 .name = "Channel Mode",
2126 .info = alc_ch_mode_info,
2127 .get = alc_ch_mode_get,
2128 .put = alc_ch_mode_put,
2133 /* capture mixer elements */
2134 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2135 struct snd_ctl_elem_info *uinfo)
2137 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2138 struct alc_spec *spec = codec->spec;
2141 mutex_lock(&codec->control_mutex);
2142 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2144 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2145 mutex_unlock(&codec->control_mutex);
2149 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2150 unsigned int size, unsigned int __user *tlv)
2152 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2153 struct alc_spec *spec = codec->spec;
2156 mutex_lock(&codec->control_mutex);
2157 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2159 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2160 mutex_unlock(&codec->control_mutex);
2164 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2165 struct snd_ctl_elem_value *ucontrol);
2167 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2168 struct snd_ctl_elem_value *ucontrol,
2171 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2172 struct alc_spec *spec = codec->spec;
2173 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2176 mutex_lock(&codec->control_mutex);
2177 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2179 err = func(kcontrol, ucontrol);
2180 mutex_unlock(&codec->control_mutex);
2184 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2185 struct snd_ctl_elem_value *ucontrol)
2187 return alc_cap_getput_caller(kcontrol, ucontrol,
2188 snd_hda_mixer_amp_volume_get);
2191 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2192 struct snd_ctl_elem_value *ucontrol)
2194 return alc_cap_getput_caller(kcontrol, ucontrol,
2195 snd_hda_mixer_amp_volume_put);
2198 /* capture mixer elements */
2199 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2201 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2202 struct snd_ctl_elem_value *ucontrol)
2204 return alc_cap_getput_caller(kcontrol, ucontrol,
2205 snd_hda_mixer_amp_switch_get);
2208 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2209 struct snd_ctl_elem_value *ucontrol)
2211 return alc_cap_getput_caller(kcontrol, ucontrol,
2212 snd_hda_mixer_amp_switch_put);
2215 #define _DEFINE_CAPMIX(num) \
2217 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2218 .name = "Capture Switch", \
2219 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2221 .info = alc_cap_sw_info, \
2222 .get = alc_cap_sw_get, \
2223 .put = alc_cap_sw_put, \
2226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2227 .name = "Capture Volume", \
2228 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2229 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2230 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2232 .info = alc_cap_vol_info, \
2233 .get = alc_cap_vol_get, \
2234 .put = alc_cap_vol_put, \
2235 .tlv = { .c = alc_cap_vol_tlv }, \
2238 #define _DEFINE_CAPSRC(num) \
2240 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2241 /* .name = "Capture Source", */ \
2242 .name = "Input Source", \
2244 .info = alc_mux_enum_info, \
2245 .get = alc_mux_enum_get, \
2246 .put = alc_mux_enum_put, \
2249 #define DEFINE_CAPMIX(num) \
2250 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2251 _DEFINE_CAPMIX(num), \
2252 _DEFINE_CAPSRC(num), \
2256 #define DEFINE_CAPMIX_NOSRC(num) \
2257 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2258 _DEFINE_CAPMIX(num), \
2262 /* up to three ADCs */
2266 DEFINE_CAPMIX_NOSRC(1);
2267 DEFINE_CAPMIX_NOSRC(2);
2268 DEFINE_CAPMIX_NOSRC(3);
2271 * ALC880 5-stack model
2273 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2275 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2276 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2279 /* additional mixers to alc880_three_stack_mixer */
2280 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2281 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2282 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2286 /* channel source setting (6/8 channel selection for 5-stack) */
2288 static struct hda_verb alc880_fivestack_ch6_init[] = {
2289 /* set line-in to input, mute it */
2290 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2291 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2296 static struct hda_verb alc880_fivestack_ch8_init[] = {
2297 /* set line-in to output, unmute it */
2298 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2299 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2303 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2304 { 6, alc880_fivestack_ch6_init },
2305 { 8, alc880_fivestack_ch8_init },
2310 * ALC880 6-stack model
2312 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2313 * Side = 0x05 (0x0f)
2314 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2315 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2318 static hda_nid_t alc880_6st_dac_nids[4] = {
2319 /* front, rear, clfe, rear_surr */
2320 0x02, 0x03, 0x04, 0x05
2323 static struct hda_input_mux alc880_6stack_capture_source = {
2327 { "Front Mic", 0x1 },
2333 /* fixed 8-channels */
2334 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2338 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2339 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2340 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2342 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2343 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2344 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2345 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2348 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2349 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2350 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2352 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2355 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2358 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2359 .name = "Channel Mode",
2360 .info = alc_ch_mode_info,
2361 .get = alc_ch_mode_get,
2362 .put = alc_ch_mode_put,
2371 * W810 has rear IO for:
2374 * Center/LFE (DAC 04)
2377 * The system also has a pair of internal speakers, and a headphone jack.
2378 * These are both connected to Line2 on the codec, hence to DAC 02.
2380 * There is a variable resistor to control the speaker or headphone
2381 * volume. This is a hardware-only device without a software API.
2383 * Plugging headphones in will disable the internal speakers. This is
2384 * implemented in hardware, not via the driver using jack sense. In
2385 * a similar fashion, plugging into the rear socket marked "front" will
2386 * disable both the speakers and headphones.
2388 * For input, there's a microphone jack, and an "audio in" jack.
2389 * These may not do anything useful with this driver yet, because I
2390 * haven't setup any initialization verbs for these yet...
2393 static hda_nid_t alc880_w810_dac_nids[3] = {
2394 /* front, rear/surround, clfe */
2398 /* fixed 6 channels */
2399 static struct hda_channel_mode alc880_w810_modes[1] = {
2403 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2404 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2405 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2406 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2407 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2408 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2409 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2410 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2411 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2412 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2421 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2422 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2426 static hda_nid_t alc880_z71v_dac_nids[1] = {
2429 #define ALC880_Z71V_HP_DAC 0x03
2431 /* fixed 2 channels */
2432 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2436 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2437 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2438 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2439 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2440 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2441 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2442 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2444 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2450 * ALC880 F1734 model
2452 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2453 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2456 static hda_nid_t alc880_f1734_dac_nids[1] = {
2459 #define ALC880_F1734_HP_DAC 0x02
2461 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2462 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2463 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2464 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2465 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2467 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2473 static struct hda_input_mux alc880_f1734_capture_source = {
2485 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2486 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2487 * Mic = 0x18, Line = 0x1a
2490 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2491 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2493 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2496 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2497 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2499 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2500 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2501 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2502 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2503 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2504 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2505 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2506 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2507 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2509 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2510 .name = "Channel Mode",
2511 .info = alc_ch_mode_info,
2512 .get = alc_ch_mode_get,
2513 .put = alc_ch_mode_put,
2519 * ALC880 ASUS W1V model
2521 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2522 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2523 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2526 /* additional mixers to alc880_asus_mixer */
2527 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2528 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2529 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2534 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2535 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2536 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2539 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2542 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2543 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2548 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2549 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2550 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2551 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2552 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2553 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2554 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2555 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2556 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2559 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2560 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2561 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2562 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2563 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2564 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2566 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2567 .name = "Channel Mode",
2568 .info = alc_ch_mode_info,
2569 .get = alc_ch_mode_get,
2570 .put = alc_ch_mode_put,
2575 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2576 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2577 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2578 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2579 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2580 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2581 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2582 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2583 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2584 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2585 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2589 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2590 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2591 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2592 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2593 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2600 * virtual master controls
2604 * slave controls for virtual master
2606 static const char *alc_slave_vols[] = {
2607 "Front Playback Volume",
2608 "Surround Playback Volume",
2609 "Center Playback Volume",
2610 "LFE Playback Volume",
2611 "Side Playback Volume",
2612 "Headphone Playback Volume",
2613 "Speaker Playback Volume",
2614 "Mono Playback Volume",
2615 "Line-Out Playback Volume",
2616 "PCM Playback Volume",
2620 static const char *alc_slave_sws[] = {
2621 "Front Playback Switch",
2622 "Surround Playback Switch",
2623 "Center Playback Switch",
2624 "LFE Playback Switch",
2625 "Side Playback Switch",
2626 "Headphone Playback Switch",
2627 "Speaker Playback Switch",
2628 "Mono Playback Switch",
2629 "IEC958 Playback Switch",
2630 "Line-Out Playback Switch",
2631 "PCM Playback Switch",
2636 * build control elements
2639 #define NID_MAPPING (-1)
2641 #define SUBDEV_SPEAKER_ (0 << 6)
2642 #define SUBDEV_HP_ (1 << 6)
2643 #define SUBDEV_LINE_ (2 << 6)
2644 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2645 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2646 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2648 static void alc_free_kctls(struct hda_codec *codec);
2650 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2651 /* additional beep mixers; the actual parameters are overwritten at build */
2652 static struct snd_kcontrol_new alc_beep_mixer[] = {
2653 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2654 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2659 static int alc_build_controls(struct hda_codec *codec)
2661 struct alc_spec *spec = codec->spec;
2662 struct snd_kcontrol *kctl = NULL;
2663 struct snd_kcontrol_new *knew;
2668 for (i = 0; i < spec->num_mixers; i++) {
2669 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2673 if (spec->cap_mixer) {
2674 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2678 if (spec->multiout.dig_out_nid) {
2679 err = snd_hda_create_spdif_out_ctls(codec,
2680 spec->multiout.dig_out_nid);
2683 if (!spec->no_analog) {
2684 err = snd_hda_create_spdif_share_sw(codec,
2688 spec->multiout.share_spdif = 1;
2691 if (spec->dig_in_nid) {
2692 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2697 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2698 /* create beep controls if needed */
2699 if (spec->beep_amp) {
2700 struct snd_kcontrol_new *knew;
2701 for (knew = alc_beep_mixer; knew->name; knew++) {
2702 struct snd_kcontrol *kctl;
2703 kctl = snd_ctl_new1(knew, codec);
2706 kctl->private_value = spec->beep_amp;
2707 err = snd_hda_ctl_add(codec, 0, kctl);
2714 /* if we have no master control, let's create it */
2715 if (!spec->no_analog &&
2716 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2717 unsigned int vmaster_tlv[4];
2718 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2719 HDA_OUTPUT, vmaster_tlv);
2720 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2721 vmaster_tlv, alc_slave_vols);
2725 if (!spec->no_analog &&
2726 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2727 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2728 NULL, alc_slave_sws);
2733 /* assign Capture Source enums to NID */
2734 if (spec->capsrc_nids || spec->adc_nids) {
2735 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2737 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2738 for (i = 0; kctl && i < kctl->count; i++) {
2739 hda_nid_t *nids = spec->capsrc_nids;
2741 nids = spec->adc_nids;
2742 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2747 if (spec->cap_mixer) {
2748 const char *kname = kctl ? kctl->id.name : NULL;
2749 for (knew = spec->cap_mixer; knew->name; knew++) {
2750 if (kname && strcmp(knew->name, kname) == 0)
2752 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2753 for (i = 0; kctl && i < kctl->count; i++) {
2754 err = snd_hda_add_nid(codec, kctl, i,
2762 /* other nid->control mapping */
2763 for (i = 0; i < spec->num_mixers; i++) {
2764 for (knew = spec->mixers[i]; knew->name; knew++) {
2765 if (knew->iface != NID_MAPPING)
2767 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2770 u = knew->subdevice;
2771 for (j = 0; j < 4; j++, u >>= 8) {
2776 case SUBDEV_SPEAKER_:
2777 nid = spec->autocfg.speaker_pins[nid];
2780 nid = spec->autocfg.line_out_pins[nid];
2783 nid = spec->autocfg.hp_pins[nid];
2788 err = snd_hda_add_nid(codec, kctl, 0, nid);
2792 u = knew->private_value;
2793 for (j = 0; j < 4; j++, u >>= 8) {
2797 err = snd_hda_add_nid(codec, kctl, 0, nid);
2804 alc_free_kctls(codec); /* no longer needed */
2811 * initialize the codec volumes, etc
2815 * generic initialization of ADC, input mixers and output mixers
2817 static struct hda_verb alc880_volume_init_verbs[] = {
2819 * Unmute ADC0-2 and set the default input to mic-in
2821 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2823 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2825 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2828 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2830 * Note: PASD motherboards uses the Line In 2 as the input for front
2833 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2843 * Set up output mixers (0x0c - 0x0f)
2845 /* set vol=0 to output mixers */
2846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2850 /* set up input amps for analog loopback */
2851 /* Amp Indices: DAC = 0, mixer = 1 */
2852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2854 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2855 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2856 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2857 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2858 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2859 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2865 * 3-stack pin configuration:
2866 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2868 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2870 * preset connection lists of input pins
2871 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2873 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2874 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2875 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2878 * Set pin mode and muting
2880 /* set front pin widgets 0x14 for output */
2881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2883 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2884 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2885 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2886 /* Mic2 (as headphone out) for HP output */
2887 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2888 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2889 /* Line In pin widget for input */
2890 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2891 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2892 /* Line2 (as front mic) pin widget for input and vref at 80% */
2893 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2894 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2895 /* CD pin widget for input */
2896 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2902 * 5-stack pin configuration:
2903 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2904 * line-in/side = 0x1a, f-mic = 0x1b
2906 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2908 * preset connection lists of input pins
2909 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2911 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2912 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2915 * Set pin mode and muting
2917 /* set pin widgets 0x14-0x17 for output */
2918 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2920 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2921 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2922 /* unmute pins for output (no gain on this amp) */
2923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2925 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2926 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2928 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2930 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2931 /* Mic2 (as headphone out) for HP output */
2932 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2933 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2934 /* Line In pin widget for input */
2935 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2936 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2937 /* Line2 (as front mic) pin widget for input and vref at 80% */
2938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2940 /* CD pin widget for input */
2941 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2947 * W810 pin configuration:
2948 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2950 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2951 /* hphone/speaker input selector: front DAC */
2952 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2954 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2955 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2958 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2959 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2961 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2962 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2968 * Z71V pin configuration:
2969 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2971 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2972 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2973 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2977 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2978 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2979 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2980 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2986 * 6-stack pin configuration:
2987 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2988 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2990 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2991 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2994 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2997 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3000 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3002 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3003 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3004 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3005 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3006 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3007 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3008 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3009 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3010 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3016 * Uniwill pin configuration:
3017 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3020 static struct hda_verb alc880_uniwill_init_verbs[] = {
3021 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3023 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3025 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3027 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3028 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3029 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3030 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3033 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3034 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3035 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3036 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3040 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3041 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3042 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3044 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3045 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3046 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3048 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3049 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3056 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3058 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3059 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3063 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3066 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3068 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3069 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3072 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3076 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3077 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3078 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3079 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3081 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3082 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3087 static struct hda_verb alc880_beep_init_verbs[] = {
3088 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3092 /* auto-toggle front mic */
3093 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3095 unsigned int present;
3098 present = snd_hda_jack_detect(codec, 0x18);
3099 bits = present ? HDA_AMP_MUTE : 0;
3100 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3103 static void alc880_uniwill_setup(struct hda_codec *codec)
3105 struct alc_spec *spec = codec->spec;
3107 spec->autocfg.hp_pins[0] = 0x14;
3108 spec->autocfg.speaker_pins[0] = 0x15;
3109 spec->autocfg.speaker_pins[0] = 0x16;
3112 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3114 alc_automute_amp(codec);
3115 alc880_uniwill_mic_automute(codec);
3118 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3121 /* Looks like the unsol event is incompatible with the standard
3122 * definition. 4bit tag is placed at 28 bit!
3124 switch (res >> 28) {
3125 case ALC880_MIC_EVENT:
3126 alc880_uniwill_mic_automute(codec);
3129 alc_automute_amp_unsol_event(codec, res);
3134 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3136 struct alc_spec *spec = codec->spec;
3138 spec->autocfg.hp_pins[0] = 0x14;
3139 spec->autocfg.speaker_pins[0] = 0x15;
3142 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3144 unsigned int present;
3146 present = snd_hda_codec_read(codec, 0x21, 0,
3147 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3148 present &= HDA_AMP_VOLMASK;
3149 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3150 HDA_AMP_VOLMASK, present);
3151 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3152 HDA_AMP_VOLMASK, present);
3155 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3158 /* Looks like the unsol event is incompatible with the standard
3159 * definition. 4bit tag is placed at 28 bit!
3161 if ((res >> 28) == ALC880_DCVOL_EVENT)
3162 alc880_uniwill_p53_dcvol_automute(codec);
3164 alc_automute_amp_unsol_event(codec, res);
3168 * F1734 pin configuration:
3169 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3171 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3172 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3173 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3174 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3175 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3176 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3183 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3187 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3188 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3189 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3190 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3193 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3194 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3200 * ASUS pin configuration:
3201 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3203 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3204 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3205 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3206 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3207 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3209 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3210 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3212 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3213 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3214 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3215 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3216 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3218 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3219 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3220 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3222 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3223 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3224 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3225 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3226 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3231 /* Enable GPIO mask and set output */
3232 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3233 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3234 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3236 /* Clevo m520g init */
3237 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3238 /* headphone output */
3239 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3241 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3242 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3244 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3245 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3247 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3248 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3249 /* Mic1 (rear panel) */
3250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3252 /* Mic2 (front panel) */
3253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3256 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3258 /* change to EAPD mode */
3259 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3260 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3265 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3266 /* change to EAPD mode */
3267 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3268 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3270 /* Headphone output */
3271 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3274 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3276 /* Line In pin widget for input */
3277 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3278 /* CD pin widget for input */
3279 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3280 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3281 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3283 /* change to EAPD mode */
3284 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3285 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3291 * LG m1 express dual
3294 * Rear Line-In/Out (blue): 0x14
3295 * Build-in Mic-In: 0x15
3297 * HP-Out (green): 0x1b
3298 * Mic-In/Out (red): 0x19
3302 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3303 static hda_nid_t alc880_lg_dac_nids[3] = {
3307 /* seems analog CD is not working */
3308 static struct hda_input_mux alc880_lg_capture_source = {
3313 { "Internal Mic", 0x6 },
3317 /* 2,4,6 channel modes */
3318 static struct hda_verb alc880_lg_ch2_init[] = {
3319 /* set line-in and mic-in to input */
3320 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3321 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3325 static struct hda_verb alc880_lg_ch4_init[] = {
3326 /* set line-in to out and mic-in to input */
3327 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3328 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3332 static struct hda_verb alc880_lg_ch6_init[] = {
3333 /* set line-in and mic-in to output */
3334 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3335 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3339 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3340 { 2, alc880_lg_ch2_init },
3341 { 4, alc880_lg_ch4_init },
3342 { 6, alc880_lg_ch6_init },
3345 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3347 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3348 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3349 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3350 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3351 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3352 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3353 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3356 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3357 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3358 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3359 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3361 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3362 .name = "Channel Mode",
3363 .info = alc_ch_mode_info,
3364 .get = alc_ch_mode_get,
3365 .put = alc_ch_mode_put,
3370 static struct hda_verb alc880_lg_init_verbs[] = {
3371 /* set capture source to mic-in */
3372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3375 /* mute all amp mixer inputs */
3376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3379 /* line-in to input */
3380 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3381 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3383 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3384 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3386 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3387 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3388 /* mic-in to input */
3389 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3393 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3394 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3395 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3397 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3401 /* toggle speaker-output according to the hp-jack state */
3402 static void alc880_lg_setup(struct hda_codec *codec)
3404 struct alc_spec *spec = codec->spec;
3406 spec->autocfg.hp_pins[0] = 0x1b;
3407 spec->autocfg.speaker_pins[0] = 0x17;
3416 * Built-in Mic-In: 0x19
3422 static struct hda_input_mux alc880_lg_lw_capture_source = {
3426 { "Internal Mic", 0x1 },
3431 #define alc880_lg_lw_modes alc880_threestack_modes
3433 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3434 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3435 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3436 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3437 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3438 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3439 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3440 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3441 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3442 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3443 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3446 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3447 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3450 .name = "Channel Mode",
3451 .info = alc_ch_mode_info,
3452 .get = alc_ch_mode_get,
3453 .put = alc_ch_mode_put,
3458 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3459 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3460 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3461 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3463 /* set capture source to mic-in */
3464 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3466 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3467 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3470 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3472 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3473 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3474 /* mic-in to input */
3475 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3476 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3479 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3481 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3485 /* toggle speaker-output according to the hp-jack state */
3486 static void alc880_lg_lw_setup(struct hda_codec *codec)
3488 struct alc_spec *spec = codec->spec;
3490 spec->autocfg.hp_pins[0] = 0x1b;
3491 spec->autocfg.speaker_pins[0] = 0x14;
3494 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3495 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3496 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3499 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3500 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3504 static struct hda_input_mux alc880_medion_rim_capture_source = {
3508 { "Internal Mic", 0x1 },
3512 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3513 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3515 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3516 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3518 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3519 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3521 /* Mic2 (as headphone out) for HP output */
3522 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3523 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3524 /* Internal Speaker */
3525 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3526 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3528 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3529 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3531 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3535 /* toggle speaker-output according to the hp-jack state */
3536 static void alc880_medion_rim_automute(struct hda_codec *codec)
3538 struct alc_spec *spec = codec->spec;
3539 alc_automute_amp(codec);
3541 if (spec->jack_present)
3542 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3544 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3547 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3550 /* Looks like the unsol event is incompatible with the standard
3551 * definition. 4bit tag is placed at 28 bit!
3553 if ((res >> 28) == ALC880_HP_EVENT)
3554 alc880_medion_rim_automute(codec);
3557 static void alc880_medion_rim_setup(struct hda_codec *codec)
3559 struct alc_spec *spec = codec->spec;
3561 spec->autocfg.hp_pins[0] = 0x14;
3562 spec->autocfg.speaker_pins[0] = 0x1b;
3565 #ifdef CONFIG_SND_HDA_POWER_SAVE
3566 static struct hda_amp_list alc880_loopbacks[] = {
3567 { 0x0b, HDA_INPUT, 0 },
3568 { 0x0b, HDA_INPUT, 1 },
3569 { 0x0b, HDA_INPUT, 2 },
3570 { 0x0b, HDA_INPUT, 3 },
3571 { 0x0b, HDA_INPUT, 4 },
3575 static struct hda_amp_list alc880_lg_loopbacks[] = {
3576 { 0x0b, HDA_INPUT, 1 },
3577 { 0x0b, HDA_INPUT, 6 },
3578 { 0x0b, HDA_INPUT, 7 },
3587 static int alc_init(struct hda_codec *codec)
3589 struct alc_spec *spec = codec->spec;
3593 alc_auto_init_amp(codec, spec->init_amp);
3595 for (i = 0; i < spec->num_init_verbs; i++)
3596 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3598 if (spec->init_hook)
3599 spec->init_hook(codec);
3601 #ifdef CONFIG_SND_HDA_POWER_SAVE
3602 if (codec->patch_ops.check_power_status)
3603 codec->patch_ops.check_power_status(codec, 0x01);
3608 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3610 struct alc_spec *spec = codec->spec;
3612 if (spec->unsol_event)
3613 spec->unsol_event(codec, res);
3616 #ifdef CONFIG_SND_HDA_POWER_SAVE
3617 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3619 struct alc_spec *spec = codec->spec;
3620 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3625 * Analog playback callbacks
3627 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3628 struct hda_codec *codec,
3629 struct snd_pcm_substream *substream)
3631 struct alc_spec *spec = codec->spec;
3632 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3636 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3637 struct hda_codec *codec,
3638 unsigned int stream_tag,
3639 unsigned int format,
3640 struct snd_pcm_substream *substream)
3642 struct alc_spec *spec = codec->spec;
3643 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3644 stream_tag, format, substream);
3647 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3648 struct hda_codec *codec,
3649 struct snd_pcm_substream *substream)
3651 struct alc_spec *spec = codec->spec;
3652 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3658 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3659 struct hda_codec *codec,
3660 struct snd_pcm_substream *substream)
3662 struct alc_spec *spec = codec->spec;
3663 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3666 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3667 struct hda_codec *codec,
3668 unsigned int stream_tag,
3669 unsigned int format,
3670 struct snd_pcm_substream *substream)
3672 struct alc_spec *spec = codec->spec;
3673 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3674 stream_tag, format, substream);
3677 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3678 struct hda_codec *codec,
3679 struct snd_pcm_substream *substream)
3681 struct alc_spec *spec = codec->spec;
3682 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3685 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3686 struct hda_codec *codec,
3687 struct snd_pcm_substream *substream)
3689 struct alc_spec *spec = codec->spec;
3690 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3696 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3697 struct hda_codec *codec,
3698 unsigned int stream_tag,
3699 unsigned int format,
3700 struct snd_pcm_substream *substream)
3702 struct alc_spec *spec = codec->spec;
3704 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3705 stream_tag, 0, format);
3709 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3710 struct hda_codec *codec,
3711 struct snd_pcm_substream *substream)
3713 struct alc_spec *spec = codec->spec;
3715 snd_hda_codec_cleanup_stream(codec,
3716 spec->adc_nids[substream->number + 1]);
3720 /* analog capture with dynamic dual-adc changes */
3721 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3722 struct hda_codec *codec,
3723 unsigned int stream_tag,
3724 unsigned int format,
3725 struct snd_pcm_substream *substream)
3727 struct alc_spec *spec = codec->spec;
3728 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3729 spec->cur_adc_stream_tag = stream_tag;
3730 spec->cur_adc_format = format;
3731 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3735 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3736 struct hda_codec *codec,
3737 struct snd_pcm_substream *substream)
3739 struct alc_spec *spec = codec->spec;
3740 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3745 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3749 .nid = 0, /* fill later */
3751 .prepare = dualmic_capture_pcm_prepare,
3752 .cleanup = dualmic_capture_pcm_cleanup
3758 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3762 /* NID is set in alc_build_pcms */
3764 .open = alc880_playback_pcm_open,
3765 .prepare = alc880_playback_pcm_prepare,
3766 .cleanup = alc880_playback_pcm_cleanup
3770 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3774 /* NID is set in alc_build_pcms */
3777 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3781 /* NID is set in alc_build_pcms */
3784 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3785 .substreams = 2, /* can be overridden */
3788 /* NID is set in alc_build_pcms */
3790 .prepare = alc880_alt_capture_pcm_prepare,
3791 .cleanup = alc880_alt_capture_pcm_cleanup
3795 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3799 /* NID is set in alc_build_pcms */
3801 .open = alc880_dig_playback_pcm_open,
3802 .close = alc880_dig_playback_pcm_close,
3803 .prepare = alc880_dig_playback_pcm_prepare,
3804 .cleanup = alc880_dig_playback_pcm_cleanup
3808 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3812 /* NID is set in alc_build_pcms */
3815 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3816 static struct hda_pcm_stream alc_pcm_null_stream = {
3822 static int alc_build_pcms(struct hda_codec *codec)
3824 struct alc_spec *spec = codec->spec;
3825 struct hda_pcm *info = spec->pcm_rec;
3828 codec->num_pcms = 1;
3829 codec->pcm_info = info;
3831 if (spec->no_analog)
3834 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3835 "%s Analog", codec->chip_name);
3836 info->name = spec->stream_name_analog;
3838 if (spec->stream_analog_playback) {
3839 if (snd_BUG_ON(!spec->multiout.dac_nids))
3841 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3842 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3844 if (spec->stream_analog_capture) {
3845 if (snd_BUG_ON(!spec->adc_nids))
3847 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3848 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3851 if (spec->channel_mode) {
3852 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3853 for (i = 0; i < spec->num_channel_mode; i++) {
3854 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3855 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3861 /* SPDIF for stream index #1 */
3862 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3863 snprintf(spec->stream_name_digital,
3864 sizeof(spec->stream_name_digital),
3865 "%s Digital", codec->chip_name);
3866 codec->num_pcms = 2;
3867 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3868 info = spec->pcm_rec + 1;
3869 info->name = spec->stream_name_digital;
3870 if (spec->dig_out_type)
3871 info->pcm_type = spec->dig_out_type;
3873 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3874 if (spec->multiout.dig_out_nid &&
3875 spec->stream_digital_playback) {
3876 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3877 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3879 if (spec->dig_in_nid &&
3880 spec->stream_digital_capture) {
3881 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3882 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3884 /* FIXME: do we need this for all Realtek codec models? */
3885 codec->spdif_status_reset = 1;
3888 if (spec->no_analog)
3891 /* If the use of more than one ADC is requested for the current
3892 * model, configure a second analog capture-only PCM.
3894 /* Additional Analaog capture for index #2 */
3895 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3896 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3897 codec->num_pcms = 3;
3898 info = spec->pcm_rec + 2;
3899 info->name = spec->stream_name_analog;
3900 if (spec->alt_dac_nid) {
3901 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3902 *spec->stream_analog_alt_playback;
3903 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3906 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3907 alc_pcm_null_stream;
3908 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3910 if (spec->num_adc_nids > 1) {
3911 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3912 *spec->stream_analog_alt_capture;
3913 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3915 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3916 spec->num_adc_nids - 1;
3918 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3919 alc_pcm_null_stream;
3920 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3927 static inline void alc_shutup(struct hda_codec *codec)
3929 snd_hda_shutup_pins(codec);
3932 static void alc_free_kctls(struct hda_codec *codec)
3934 struct alc_spec *spec = codec->spec;
3936 if (spec->kctls.list) {
3937 struct snd_kcontrol_new *kctl = spec->kctls.list;
3939 for (i = 0; i < spec->kctls.used; i++)
3940 kfree(kctl[i].name);
3942 snd_array_free(&spec->kctls);
3945 static void alc_free(struct hda_codec *codec)
3947 struct alc_spec *spec = codec->spec;
3953 alc_free_kctls(codec);
3955 snd_hda_detach_beep_device(codec);
3958 #ifdef CONFIG_SND_HDA_POWER_SAVE
3959 static void alc_power_eapd(struct hda_codec *codec)
3961 /* We currently only handle front, HP */
3962 switch (codec->vendor_id) {
3964 set_eapd(codec, 0x0f, 0);
3965 set_eapd(codec, 0x10, 0);
3978 set_eapd(codec, 0x14, 0);
3979 set_eapd(codec, 0x15, 0);
3984 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3986 struct alc_spec *spec = codec->spec;
3988 if (spec && spec->power_hook)
3989 spec->power_hook(codec);
3994 #ifdef SND_HDA_NEEDS_RESUME
3995 static int alc_resume(struct hda_codec *codec)
3997 codec->patch_ops.init(codec);
3998 snd_hda_codec_resume_amp(codec);
3999 snd_hda_codec_resume_cache(codec);
4000 #ifdef CONFIG_SND_HDA_POWER_SAVE
4001 if (codec->patch_ops.check_power_status)
4002 codec->patch_ops.check_power_status(codec, 0x01);
4010 static struct hda_codec_ops alc_patch_ops = {
4011 .build_controls = alc_build_controls,
4012 .build_pcms = alc_build_pcms,
4015 .unsol_event = alc_unsol_event,
4016 #ifdef SND_HDA_NEEDS_RESUME
4017 .resume = alc_resume,
4019 #ifdef CONFIG_SND_HDA_POWER_SAVE
4020 .suspend = alc_suspend,
4021 .check_power_status = alc_check_power_status,
4023 .reboot_notify = alc_shutup,
4026 /* replace the codec chip_name with the given string */
4027 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4029 kfree(codec->chip_name);
4030 codec->chip_name = kstrdup(name, GFP_KERNEL);
4031 if (!codec->chip_name) {
4039 * Test configuration for debugging
4041 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4044 #ifdef CONFIG_SND_DEBUG
4045 static hda_nid_t alc880_test_dac_nids[4] = {
4046 0x02, 0x03, 0x04, 0x05
4049 static struct hda_input_mux alc880_test_capture_source = {
4058 { "Surround", 0x6 },
4062 static struct hda_channel_mode alc880_test_modes[4] = {
4069 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4070 struct snd_ctl_elem_info *uinfo)
4072 static char *texts[] = {
4073 "N/A", "Line Out", "HP Out",
4074 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4076 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4078 uinfo->value.enumerated.items = 8;
4079 if (uinfo->value.enumerated.item >= 8)
4080 uinfo->value.enumerated.item = 7;
4081 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4085 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4086 struct snd_ctl_elem_value *ucontrol)
4088 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4089 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4090 unsigned int pin_ctl, item = 0;
4092 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4093 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4094 if (pin_ctl & AC_PINCTL_OUT_EN) {
4095 if (pin_ctl & AC_PINCTL_HP_EN)
4099 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4100 switch (pin_ctl & AC_PINCTL_VREFEN) {
4101 case AC_PINCTL_VREF_HIZ: item = 3; break;
4102 case AC_PINCTL_VREF_50: item = 4; break;
4103 case AC_PINCTL_VREF_GRD: item = 5; break;
4104 case AC_PINCTL_VREF_80: item = 6; break;
4105 case AC_PINCTL_VREF_100: item = 7; break;
4108 ucontrol->value.enumerated.item[0] = item;
4112 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4113 struct snd_ctl_elem_value *ucontrol)
4115 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4116 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4117 static unsigned int ctls[] = {
4118 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4119 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4120 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4121 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4122 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4123 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4125 unsigned int old_ctl, new_ctl;
4127 old_ctl = snd_hda_codec_read(codec, nid, 0,
4128 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4129 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4130 if (old_ctl != new_ctl) {
4132 snd_hda_codec_write_cache(codec, nid, 0,
4133 AC_VERB_SET_PIN_WIDGET_CONTROL,
4135 val = ucontrol->value.enumerated.item[0] >= 3 ?
4137 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4144 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4145 struct snd_ctl_elem_info *uinfo)
4147 static char *texts[] = {
4148 "Front", "Surround", "CLFE", "Side"
4150 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4152 uinfo->value.enumerated.items = 4;
4153 if (uinfo->value.enumerated.item >= 4)
4154 uinfo->value.enumerated.item = 3;
4155 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4159 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4160 struct snd_ctl_elem_value *ucontrol)
4162 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4163 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4166 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4167 ucontrol->value.enumerated.item[0] = sel & 3;
4171 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4172 struct snd_ctl_elem_value *ucontrol)
4174 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4175 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4178 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4179 if (ucontrol->value.enumerated.item[0] != sel) {
4180 sel = ucontrol->value.enumerated.item[0] & 3;
4181 snd_hda_codec_write_cache(codec, nid, 0,
4182 AC_VERB_SET_CONNECT_SEL, sel);
4188 #define PIN_CTL_TEST(xname,nid) { \
4189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4191 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4192 .info = alc_test_pin_ctl_info, \
4193 .get = alc_test_pin_ctl_get, \
4194 .put = alc_test_pin_ctl_put, \
4195 .private_value = nid \
4198 #define PIN_SRC_TEST(xname,nid) { \
4199 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4201 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4202 .info = alc_test_pin_src_info, \
4203 .get = alc_test_pin_src_get, \
4204 .put = alc_test_pin_src_put, \
4205 .private_value = nid \
4208 static struct snd_kcontrol_new alc880_test_mixer[] = {
4209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4210 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4211 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4212 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4214 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4215 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4216 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4217 PIN_CTL_TEST("Front Pin Mode", 0x14),
4218 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4219 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4220 PIN_CTL_TEST("Side Pin Mode", 0x17),
4221 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4222 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4223 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4224 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4225 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4226 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4227 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4228 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4229 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4230 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4231 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4232 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4233 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4234 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4235 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4236 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4237 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4238 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4240 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4241 .name = "Channel Mode",
4242 .info = alc_ch_mode_info,
4243 .get = alc_ch_mode_get,
4244 .put = alc_ch_mode_put,
4249 static struct hda_verb alc880_test_init_verbs[] = {
4250 /* Unmute inputs of 0x0c - 0x0f */
4251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4259 /* Vol output for 0x0c-0x0f */
4260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4264 /* Set output pins 0x14-0x17 */
4265 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4267 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4268 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4269 /* Unmute output pins 0x14-0x17 */
4270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4271 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4272 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4274 /* Set input pins 0x18-0x1c */
4275 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4277 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4279 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4280 /* Mute input pins 0x18-0x1b */
4281 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4283 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4284 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4287 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4288 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4289 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4291 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4292 /* Analog input/passthru */
4293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4305 static const char *alc880_models[ALC880_MODEL_LAST] = {
4306 [ALC880_3ST] = "3stack",
4307 [ALC880_TCL_S700] = "tcl",
4308 [ALC880_3ST_DIG] = "3stack-digout",
4309 [ALC880_CLEVO] = "clevo",
4310 [ALC880_5ST] = "5stack",
4311 [ALC880_5ST_DIG] = "5stack-digout",
4312 [ALC880_W810] = "w810",
4313 [ALC880_Z71V] = "z71v",
4314 [ALC880_6ST] = "6stack",
4315 [ALC880_6ST_DIG] = "6stack-digout",
4316 [ALC880_ASUS] = "asus",
4317 [ALC880_ASUS_W1V] = "asus-w1v",
4318 [ALC880_ASUS_DIG] = "asus-dig",
4319 [ALC880_ASUS_DIG2] = "asus-dig2",
4320 [ALC880_UNIWILL_DIG] = "uniwill",
4321 [ALC880_UNIWILL_P53] = "uniwill-p53",
4322 [ALC880_FUJITSU] = "fujitsu",
4323 [ALC880_F1734] = "F1734",
4325 [ALC880_LG_LW] = "lg-lw",
4326 [ALC880_MEDION_RIM] = "medion",
4327 #ifdef CONFIG_SND_DEBUG
4328 [ALC880_TEST] = "test",
4330 [ALC880_AUTO] = "auto",
4333 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4334 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4335 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4336 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4337 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4338 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4339 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4340 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4341 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4342 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4343 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4344 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4345 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4346 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4347 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4348 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4349 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4350 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4351 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4352 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4353 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4354 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4355 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4356 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4357 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4358 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4359 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4360 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4361 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4362 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4363 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4364 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4365 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4366 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4367 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4368 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4369 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4370 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4371 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4372 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4373 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4374 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4375 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4376 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4377 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4378 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4379 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4380 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4381 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4382 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4383 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4384 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4385 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4386 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4387 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4388 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4389 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4390 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4391 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4392 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4393 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4394 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4395 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4396 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4397 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4398 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4399 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4400 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4401 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4403 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4404 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4405 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4410 * ALC880 codec presets
4412 static struct alc_config_preset alc880_presets[] = {
4414 .mixers = { alc880_three_stack_mixer },
4415 .init_verbs = { alc880_volume_init_verbs,
4416 alc880_pin_3stack_init_verbs },
4417 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4418 .dac_nids = alc880_dac_nids,
4419 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4420 .channel_mode = alc880_threestack_modes,
4422 .input_mux = &alc880_capture_source,
4424 [ALC880_3ST_DIG] = {
4425 .mixers = { alc880_three_stack_mixer },
4426 .init_verbs = { alc880_volume_init_verbs,
4427 alc880_pin_3stack_init_verbs },
4428 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4429 .dac_nids = alc880_dac_nids,
4430 .dig_out_nid = ALC880_DIGOUT_NID,
4431 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4432 .channel_mode = alc880_threestack_modes,
4434 .input_mux = &alc880_capture_source,
4436 [ALC880_TCL_S700] = {
4437 .mixers = { alc880_tcl_s700_mixer },
4438 .init_verbs = { alc880_volume_init_verbs,
4439 alc880_pin_tcl_S700_init_verbs,
4440 alc880_gpio2_init_verbs },
4441 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4442 .dac_nids = alc880_dac_nids,
4443 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4444 .num_adc_nids = 1, /* single ADC */
4446 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4447 .channel_mode = alc880_2_jack_modes,
4448 .input_mux = &alc880_capture_source,
4451 .mixers = { alc880_three_stack_mixer,
4452 alc880_five_stack_mixer},
4453 .init_verbs = { alc880_volume_init_verbs,
4454 alc880_pin_5stack_init_verbs },
4455 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4456 .dac_nids = alc880_dac_nids,
4457 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4458 .channel_mode = alc880_fivestack_modes,
4459 .input_mux = &alc880_capture_source,
4461 [ALC880_5ST_DIG] = {
4462 .mixers = { alc880_three_stack_mixer,
4463 alc880_five_stack_mixer },
4464 .init_verbs = { alc880_volume_init_verbs,
4465 alc880_pin_5stack_init_verbs },
4466 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4467 .dac_nids = alc880_dac_nids,
4468 .dig_out_nid = ALC880_DIGOUT_NID,
4469 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4470 .channel_mode = alc880_fivestack_modes,
4471 .input_mux = &alc880_capture_source,
4474 .mixers = { alc880_six_stack_mixer },
4475 .init_verbs = { alc880_volume_init_verbs,
4476 alc880_pin_6stack_init_verbs },
4477 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4478 .dac_nids = alc880_6st_dac_nids,
4479 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4480 .channel_mode = alc880_sixstack_modes,
4481 .input_mux = &alc880_6stack_capture_source,
4483 [ALC880_6ST_DIG] = {
4484 .mixers = { alc880_six_stack_mixer },
4485 .init_verbs = { alc880_volume_init_verbs,
4486 alc880_pin_6stack_init_verbs },
4487 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4488 .dac_nids = alc880_6st_dac_nids,
4489 .dig_out_nid = ALC880_DIGOUT_NID,
4490 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4491 .channel_mode = alc880_sixstack_modes,
4492 .input_mux = &alc880_6stack_capture_source,
4495 .mixers = { alc880_w810_base_mixer },
4496 .init_verbs = { alc880_volume_init_verbs,
4497 alc880_pin_w810_init_verbs,
4498 alc880_gpio2_init_verbs },
4499 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4500 .dac_nids = alc880_w810_dac_nids,
4501 .dig_out_nid = ALC880_DIGOUT_NID,
4502 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4503 .channel_mode = alc880_w810_modes,
4504 .input_mux = &alc880_capture_source,
4507 .mixers = { alc880_z71v_mixer },
4508 .init_verbs = { alc880_volume_init_verbs,
4509 alc880_pin_z71v_init_verbs },
4510 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4511 .dac_nids = alc880_z71v_dac_nids,
4512 .dig_out_nid = ALC880_DIGOUT_NID,
4514 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4515 .channel_mode = alc880_2_jack_modes,
4516 .input_mux = &alc880_capture_source,
4519 .mixers = { alc880_f1734_mixer },
4520 .init_verbs = { alc880_volume_init_verbs,
4521 alc880_pin_f1734_init_verbs },
4522 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4523 .dac_nids = alc880_f1734_dac_nids,
4525 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4526 .channel_mode = alc880_2_jack_modes,
4527 .input_mux = &alc880_f1734_capture_source,
4528 .unsol_event = alc880_uniwill_p53_unsol_event,
4529 .setup = alc880_uniwill_p53_setup,
4530 .init_hook = alc_automute_amp,
4533 .mixers = { alc880_asus_mixer },
4534 .init_verbs = { alc880_volume_init_verbs,
4535 alc880_pin_asus_init_verbs,
4536 alc880_gpio1_init_verbs },
4537 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4538 .dac_nids = alc880_asus_dac_nids,
4539 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4540 .channel_mode = alc880_asus_modes,
4542 .input_mux = &alc880_capture_source,
4544 [ALC880_ASUS_DIG] = {
4545 .mixers = { alc880_asus_mixer },
4546 .init_verbs = { alc880_volume_init_verbs,
4547 alc880_pin_asus_init_verbs,
4548 alc880_gpio1_init_verbs },
4549 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4550 .dac_nids = alc880_asus_dac_nids,
4551 .dig_out_nid = ALC880_DIGOUT_NID,
4552 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4553 .channel_mode = alc880_asus_modes,
4555 .input_mux = &alc880_capture_source,
4557 [ALC880_ASUS_DIG2] = {
4558 .mixers = { alc880_asus_mixer },
4559 .init_verbs = { alc880_volume_init_verbs,
4560 alc880_pin_asus_init_verbs,
4561 alc880_gpio2_init_verbs }, /* use GPIO2 */
4562 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4563 .dac_nids = alc880_asus_dac_nids,
4564 .dig_out_nid = ALC880_DIGOUT_NID,
4565 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4566 .channel_mode = alc880_asus_modes,
4568 .input_mux = &alc880_capture_source,
4570 [ALC880_ASUS_W1V] = {
4571 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4572 .init_verbs = { alc880_volume_init_verbs,
4573 alc880_pin_asus_init_verbs,
4574 alc880_gpio1_init_verbs },
4575 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4576 .dac_nids = alc880_asus_dac_nids,
4577 .dig_out_nid = ALC880_DIGOUT_NID,
4578 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4579 .channel_mode = alc880_asus_modes,
4581 .input_mux = &alc880_capture_source,
4583 [ALC880_UNIWILL_DIG] = {
4584 .mixers = { alc880_asus_mixer },
4585 .init_verbs = { alc880_volume_init_verbs,
4586 alc880_pin_asus_init_verbs },
4587 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4588 .dac_nids = alc880_asus_dac_nids,
4589 .dig_out_nid = ALC880_DIGOUT_NID,
4590 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4591 .channel_mode = alc880_asus_modes,
4593 .input_mux = &alc880_capture_source,
4595 [ALC880_UNIWILL] = {
4596 .mixers = { alc880_uniwill_mixer },
4597 .init_verbs = { alc880_volume_init_verbs,
4598 alc880_uniwill_init_verbs },
4599 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4600 .dac_nids = alc880_asus_dac_nids,
4601 .dig_out_nid = ALC880_DIGOUT_NID,
4602 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4603 .channel_mode = alc880_threestack_modes,
4605 .input_mux = &alc880_capture_source,
4606 .unsol_event = alc880_uniwill_unsol_event,
4607 .setup = alc880_uniwill_setup,
4608 .init_hook = alc880_uniwill_init_hook,
4610 [ALC880_UNIWILL_P53] = {
4611 .mixers = { alc880_uniwill_p53_mixer },
4612 .init_verbs = { alc880_volume_init_verbs,
4613 alc880_uniwill_p53_init_verbs },
4614 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4615 .dac_nids = alc880_asus_dac_nids,
4616 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4617 .channel_mode = alc880_threestack_modes,
4618 .input_mux = &alc880_capture_source,
4619 .unsol_event = alc880_uniwill_p53_unsol_event,
4620 .setup = alc880_uniwill_p53_setup,
4621 .init_hook = alc_automute_amp,
4623 [ALC880_FUJITSU] = {
4624 .mixers = { alc880_fujitsu_mixer },
4625 .init_verbs = { alc880_volume_init_verbs,
4626 alc880_uniwill_p53_init_verbs,
4627 alc880_beep_init_verbs },
4628 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4629 .dac_nids = alc880_dac_nids,
4630 .dig_out_nid = ALC880_DIGOUT_NID,
4631 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4632 .channel_mode = alc880_2_jack_modes,
4633 .input_mux = &alc880_capture_source,
4634 .unsol_event = alc880_uniwill_p53_unsol_event,
4635 .setup = alc880_uniwill_p53_setup,
4636 .init_hook = alc_automute_amp,
4639 .mixers = { alc880_three_stack_mixer },
4640 .init_verbs = { alc880_volume_init_verbs,
4641 alc880_pin_clevo_init_verbs },
4642 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4643 .dac_nids = alc880_dac_nids,
4645 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4646 .channel_mode = alc880_threestack_modes,
4648 .input_mux = &alc880_capture_source,
4651 .mixers = { alc880_lg_mixer },
4652 .init_verbs = { alc880_volume_init_verbs,
4653 alc880_lg_init_verbs },
4654 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4655 .dac_nids = alc880_lg_dac_nids,
4656 .dig_out_nid = ALC880_DIGOUT_NID,
4657 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4658 .channel_mode = alc880_lg_ch_modes,
4660 .input_mux = &alc880_lg_capture_source,
4661 .unsol_event = alc_automute_amp_unsol_event,
4662 .setup = alc880_lg_setup,
4663 .init_hook = alc_automute_amp,
4664 #ifdef CONFIG_SND_HDA_POWER_SAVE
4665 .loopbacks = alc880_lg_loopbacks,
4669 .mixers = { alc880_lg_lw_mixer },
4670 .init_verbs = { alc880_volume_init_verbs,
4671 alc880_lg_lw_init_verbs },
4672 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4673 .dac_nids = alc880_dac_nids,
4674 .dig_out_nid = ALC880_DIGOUT_NID,
4675 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4676 .channel_mode = alc880_lg_lw_modes,
4677 .input_mux = &alc880_lg_lw_capture_source,
4678 .unsol_event = alc_automute_amp_unsol_event,
4679 .setup = alc880_lg_lw_setup,
4680 .init_hook = alc_automute_amp,
4682 [ALC880_MEDION_RIM] = {
4683 .mixers = { alc880_medion_rim_mixer },
4684 .init_verbs = { alc880_volume_init_verbs,
4685 alc880_medion_rim_init_verbs,
4686 alc_gpio2_init_verbs },
4687 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4688 .dac_nids = alc880_dac_nids,
4689 .dig_out_nid = ALC880_DIGOUT_NID,
4690 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4691 .channel_mode = alc880_2_jack_modes,
4692 .input_mux = &alc880_medion_rim_capture_source,
4693 .unsol_event = alc880_medion_rim_unsol_event,
4694 .setup = alc880_medion_rim_setup,
4695 .init_hook = alc880_medion_rim_automute,
4697 #ifdef CONFIG_SND_DEBUG
4699 .mixers = { alc880_test_mixer },
4700 .init_verbs = { alc880_test_init_verbs },
4701 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4702 .dac_nids = alc880_test_dac_nids,
4703 .dig_out_nid = ALC880_DIGOUT_NID,
4704 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4705 .channel_mode = alc880_test_modes,
4706 .input_mux = &alc880_test_capture_source,
4712 * Automatic parse of I/O pins from the BIOS configuration
4717 ALC_CTL_WIDGET_MUTE,
4720 static struct snd_kcontrol_new alc880_control_templates[] = {
4721 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4722 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4723 HDA_BIND_MUTE(NULL, 0, 0, 0),
4726 /* add dynamic controls */
4727 static int add_control(struct alc_spec *spec, int type, const char *name,
4728 int cidx, unsigned long val)
4730 struct snd_kcontrol_new *knew;
4732 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4733 knew = snd_array_new(&spec->kctls);
4736 *knew = alc880_control_templates[type];
4737 knew->name = kstrdup(name, GFP_KERNEL);
4741 if (get_amp_nid_(val))
4742 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4743 knew->private_value = val;
4747 static int add_control_with_pfx(struct alc_spec *spec, int type,
4748 const char *pfx, const char *dir,
4749 const char *sfx, int cidx, unsigned long val)
4752 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4753 return add_control(spec, type, name, cidx, val);
4756 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4757 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
4758 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4759 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
4760 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
4761 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
4762 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
4763 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
4765 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4766 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4767 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4768 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4769 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4770 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4771 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4772 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4773 #define ALC880_PIN_CD_NID 0x1c
4775 /* fill in the dac_nids table from the parsed pin configuration */
4776 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4777 const struct auto_pin_cfg *cfg)
4783 memset(assigned, 0, sizeof(assigned));
4784 spec->multiout.dac_nids = spec->private_dac_nids;
4786 /* check the pins hardwired to audio widget */
4787 for (i = 0; i < cfg->line_outs; i++) {
4788 nid = cfg->line_out_pins[i];
4789 if (alc880_is_fixed_pin(nid)) {
4790 int idx = alc880_fixed_pin_idx(nid);
4791 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4795 /* left pins can be connect to any audio widget */
4796 for (i = 0; i < cfg->line_outs; i++) {
4797 nid = cfg->line_out_pins[i];
4798 if (alc880_is_fixed_pin(nid))
4800 /* search for an empty channel */
4801 for (j = 0; j < cfg->line_outs; j++) {
4803 spec->multiout.dac_nids[i] =
4804 alc880_idx_to_dac(j);
4810 spec->multiout.num_dacs = cfg->line_outs;
4814 /* add playback controls from the parsed DAC table */
4815 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4816 const struct auto_pin_cfg *cfg)
4818 static const char *chname[4] = {
4819 "Front", "Surround", NULL /*CLFE*/, "Side"
4824 for (i = 0; i < cfg->line_outs; i++) {
4825 if (!spec->multiout.dac_nids[i])
4827 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4830 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4832 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4836 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4838 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4842 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4844 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4848 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4850 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4856 if (cfg->line_outs == 1 &&
4857 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4861 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4862 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4866 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4867 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4876 /* add playback controls for speaker and HP outputs */
4877 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4886 if (alc880_is_fixed_pin(pin)) {
4887 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4888 /* specify the DAC as the extra output */
4889 if (!spec->multiout.hp_nid)
4890 spec->multiout.hp_nid = nid;
4892 spec->multiout.extra_out_nid[0] = nid;
4893 /* control HP volume/switch on the output mixer amp */
4894 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4895 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4896 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4899 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4900 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4903 } else if (alc880_is_multi_pin(pin)) {
4904 /* set manual connection */
4905 /* we have only a switch on HP-out PIN */
4906 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4907 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4914 /* create input playback/capture controls for the given pin */
4915 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4916 const char *ctlname, int ctlidx,
4917 int idx, hda_nid_t mix_nid)
4921 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
4922 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4925 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
4926 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4932 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4934 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4935 return (pincap & AC_PINCAP_IN) != 0;
4938 /* create playback/capture controls for input pins */
4939 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4940 const struct auto_pin_cfg *cfg,
4942 hda_nid_t cap1, hda_nid_t cap2)
4944 struct alc_spec *spec = codec->spec;
4945 struct hda_input_mux *imux = &spec->private_imux[0];
4946 int i, err, idx, type, type_idx = 0;
4948 for (i = 0; i < cfg->num_inputs; i++) {
4952 pin = cfg->inputs[i].pin;
4953 if (!alc_is_input_pin(codec, pin))
4956 type = cfg->inputs[i].type;
4957 if (i > 0 && type == cfg->inputs[i - 1].type)
4961 label = hda_get_autocfg_input_label(codec, cfg, i);
4963 idx = get_connection_index(codec, mixer, pin);
4965 err = new_analog_input(spec, pin,
4975 idx = get_connection_index(codec, cap1, pin);
4976 if (idx < 0 && cap2)
4977 idx = get_connection_index(codec, cap2, pin);
4979 snd_hda_add_imux_item(imux, label, idx, NULL);
4984 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4985 const struct auto_pin_cfg *cfg)
4987 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4990 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4991 unsigned int pin_type)
4993 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4996 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5000 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5001 hda_nid_t nid, int pin_type,
5004 alc_set_pin_output(codec, nid, pin_type);
5005 /* need the manual connection? */
5006 if (alc880_is_multi_pin(nid)) {
5007 struct alc_spec *spec = codec->spec;
5008 int idx = alc880_multi_pin_idx(nid);
5009 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5010 AC_VERB_SET_CONNECT_SEL,
5011 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5015 static int get_pin_type(int line_out_type)
5017 if (line_out_type == AUTO_PIN_HP_OUT)
5023 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5025 struct alc_spec *spec = codec->spec;
5028 for (i = 0; i < spec->autocfg.line_outs; i++) {
5029 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5030 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5031 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5035 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5037 struct alc_spec *spec = codec->spec;
5040 pin = spec->autocfg.speaker_pins[0];
5041 if (pin) /* connect to front */
5042 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5043 pin = spec->autocfg.hp_pins[0];
5044 if (pin) /* connect to front */
5045 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5048 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5050 struct alc_spec *spec = codec->spec;
5051 struct auto_pin_cfg *cfg = &spec->autocfg;
5054 for (i = 0; i < cfg->num_inputs; i++) {
5055 hda_nid_t nid = cfg->inputs[i].pin;
5056 if (alc_is_input_pin(codec, nid)) {
5057 alc_set_input_pin(codec, nid, i);
5058 if (nid != ALC880_PIN_CD_NID &&
5059 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5060 snd_hda_codec_write(codec, nid, 0,
5061 AC_VERB_SET_AMP_GAIN_MUTE,
5067 static void alc880_auto_init_input_src(struct hda_codec *codec)
5069 struct alc_spec *spec = codec->spec;
5072 for (c = 0; c < spec->num_adc_nids; c++) {
5073 unsigned int mux_idx;
5074 const struct hda_input_mux *imux;
5075 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5076 imux = &spec->input_mux[mux_idx];
5077 if (!imux->num_items && mux_idx > 0)
5078 imux = &spec->input_mux[0];
5080 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5081 AC_VERB_SET_CONNECT_SEL,
5082 imux->items[0].index);
5086 /* parse the BIOS configuration and set up the alc_spec */
5087 /* return 1 if successful, 0 if the proper config is not found,
5088 * or a negative error code
5090 static int alc880_parse_auto_config(struct hda_codec *codec)
5092 struct alc_spec *spec = codec->spec;
5094 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5096 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5100 if (!spec->autocfg.line_outs)
5101 return 0; /* can't find valid BIOS pin config */
5103 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5106 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5109 err = alc880_auto_create_extra_out(spec,
5110 spec->autocfg.speaker_pins[0],
5114 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5118 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5122 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5124 alc_auto_parse_digital(codec);
5126 if (spec->kctls.list)
5127 add_mixer(spec, spec->kctls.list);
5129 add_verb(spec, alc880_volume_init_verbs);
5131 spec->num_mux_defs = 1;
5132 spec->input_mux = &spec->private_imux[0];
5134 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5139 /* additional initialization for auto-configuration model */
5140 static void alc880_auto_init(struct hda_codec *codec)
5142 struct alc_spec *spec = codec->spec;
5143 alc880_auto_init_multi_out(codec);
5144 alc880_auto_init_extra_out(codec);
5145 alc880_auto_init_analog_input(codec);
5146 alc880_auto_init_input_src(codec);
5147 alc_auto_init_digital(codec);
5148 if (spec->unsol_event)
5149 alc_inithook(codec);
5152 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5153 * one of two digital mic pins, e.g. on ALC272
5155 static void fixup_automic_adc(struct hda_codec *codec)
5157 struct alc_spec *spec = codec->spec;
5160 for (i = 0; i < spec->num_adc_nids; i++) {
5161 hda_nid_t cap = spec->capsrc_nids ?
5162 spec->capsrc_nids[i] : spec->adc_nids[i];
5165 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5168 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5171 spec->int_mic.mux_idx = iidx;
5172 spec->ext_mic.mux_idx = eidx;
5173 if (spec->capsrc_nids)
5174 spec->capsrc_nids += i;
5175 spec->adc_nids += i;
5176 spec->num_adc_nids = 1;
5179 snd_printd(KERN_INFO "hda_codec: %s: "
5180 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5181 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5182 spec->auto_mic = 0; /* disable auto-mic to be sure */
5185 /* select or unmute the given capsrc route */
5186 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5189 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5190 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5193 snd_hda_codec_write_cache(codec, cap, 0,
5194 AC_VERB_SET_CONNECT_SEL, idx);
5198 /* set the default connection to that pin */
5199 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5201 struct alc_spec *spec = codec->spec;
5204 for (i = 0; i < spec->num_adc_nids; i++) {
5205 hda_nid_t cap = spec->capsrc_nids ?
5206 spec->capsrc_nids[i] : spec->adc_nids[i];
5209 idx = get_connection_index(codec, cap, pin);
5212 select_or_unmute_capsrc(codec, cap, idx);
5213 return i; /* return the found index */
5215 return -1; /* not found */
5218 /* choose the ADC/MUX containing the input pin and initialize the setup */
5219 static void fixup_single_adc(struct hda_codec *codec)
5221 struct alc_spec *spec = codec->spec;
5222 struct auto_pin_cfg *cfg = &spec->autocfg;
5225 /* search for the input pin; there must be only one */
5226 if (cfg->num_inputs != 1)
5228 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5230 /* use only this ADC */
5231 if (spec->capsrc_nids)
5232 spec->capsrc_nids += i;
5233 spec->adc_nids += i;
5234 spec->num_adc_nids = 1;
5238 /* initialize dual adcs */
5239 static void fixup_dual_adc_switch(struct hda_codec *codec)
5241 struct alc_spec *spec = codec->spec;
5242 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5243 init_capsrc_for_pin(codec, spec->int_mic.pin);
5246 static void set_capture_mixer(struct hda_codec *codec)
5248 struct alc_spec *spec = codec->spec;
5249 static struct snd_kcontrol_new *caps[2][3] = {
5250 { alc_capture_mixer_nosrc1,
5251 alc_capture_mixer_nosrc2,
5252 alc_capture_mixer_nosrc3 },
5253 { alc_capture_mixer1,
5255 alc_capture_mixer3 },
5257 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5259 int num_adcs = spec->num_adc_nids;
5260 if (spec->dual_adc_switch)
5261 fixup_dual_adc_switch(codec);
5262 else if (spec->auto_mic)
5263 fixup_automic_adc(codec);
5264 else if (spec->input_mux) {
5265 if (spec->input_mux->num_items > 1)
5267 else if (spec->input_mux->num_items == 1)
5268 fixup_single_adc(codec);
5270 if (spec->dual_adc_switch)
5272 spec->cap_mixer = caps[mux][num_adcs - 1];
5276 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5277 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5280 struct alc_spec *spec = codec->spec;
5281 struct auto_pin_cfg *cfg = &spec->autocfg;
5283 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5285 for (n = 0; n < num_nids; n++) {
5287 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5291 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5294 nconns = snd_hda_get_connections(codec, cap, conn,
5298 nconns = snd_hda_get_connections(codec, cap, conn,
5303 if (!fallback_adc) {
5307 for (i = 0; i < cfg->num_inputs; i++) {
5308 hda_nid_t nid = cfg->inputs[i].pin;
5309 for (j = 0; j < nconns; j++) {
5316 if (i >= cfg->num_inputs) {
5317 int num_adcs = spec->num_adc_nids;
5318 spec->private_adc_nids[num_adcs] = adc;
5319 spec->private_capsrc_nids[num_adcs] = cap;
5320 spec->num_adc_nids++;
5321 spec->adc_nids = spec->private_adc_nids;
5323 spec->capsrc_nids = spec->private_capsrc_nids;
5326 if (!spec->num_adc_nids) {
5327 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5328 " using fallback 0x%x\n",
5329 codec->chip_name, fallback_adc);
5330 spec->private_adc_nids[0] = fallback_adc;
5331 spec->adc_nids = spec->private_adc_nids;
5332 if (fallback_adc != fallback_cap) {
5333 spec->private_capsrc_nids[0] = fallback_cap;
5334 spec->capsrc_nids = spec->private_adc_nids;
5339 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5340 #define set_beep_amp(spec, nid, idx, dir) \
5341 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5343 static struct snd_pci_quirk beep_white_list[] = {
5344 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5345 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5346 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5350 static inline int has_cdefine_beep(struct hda_codec *codec)
5352 struct alc_spec *spec = codec->spec;
5353 const struct snd_pci_quirk *q;
5354 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5357 return spec->cdefine.enable_pcbeep;
5360 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5361 #define has_cdefine_beep(codec) 0
5365 * OK, here we have finally the patch for ALC880
5368 static int patch_alc880(struct hda_codec *codec)
5370 struct alc_spec *spec;
5374 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5380 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5383 if (board_config < 0) {
5384 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5386 board_config = ALC880_AUTO;
5389 if (board_config == ALC880_AUTO) {
5390 /* automatic parse from the BIOS config */
5391 err = alc880_parse_auto_config(codec);
5397 "hda_codec: Cannot set up configuration "
5398 "from BIOS. Using 3-stack mode...\n");
5399 board_config = ALC880_3ST;
5403 err = snd_hda_attach_beep_device(codec, 0x1);
5409 if (board_config != ALC880_AUTO)
5410 setup_preset(codec, &alc880_presets[board_config]);
5412 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5413 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5414 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5416 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5417 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5419 if (!spec->adc_nids && spec->input_mux) {
5420 /* check whether NID 0x07 is valid */
5421 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5423 wcap = get_wcaps_type(wcap);
5424 if (wcap != AC_WID_AUD_IN) {
5425 spec->adc_nids = alc880_adc_nids_alt;
5426 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5428 spec->adc_nids = alc880_adc_nids;
5429 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5432 set_capture_mixer(codec);
5433 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5435 spec->vmaster_nid = 0x0c;
5437 codec->patch_ops = alc_patch_ops;
5438 if (board_config == ALC880_AUTO)
5439 spec->init_hook = alc880_auto_init;
5440 #ifdef CONFIG_SND_HDA_POWER_SAVE
5441 if (!spec->loopback.amplist)
5442 spec->loopback.amplist = alc880_loopbacks;
5453 static hda_nid_t alc260_dac_nids[1] = {
5458 static hda_nid_t alc260_adc_nids[1] = {
5463 static hda_nid_t alc260_adc_nids_alt[1] = {
5468 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5469 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5471 static hda_nid_t alc260_dual_adc_nids[2] = {
5476 #define ALC260_DIGOUT_NID 0x03
5477 #define ALC260_DIGIN_NID 0x06
5479 static struct hda_input_mux alc260_capture_source = {
5483 { "Front Mic", 0x1 },
5489 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5490 * headphone jack and the internal CD lines since these are the only pins at
5491 * which audio can appear. For flexibility, also allow the option of
5492 * recording the mixer output on the second ADC (ADC0 doesn't have a
5493 * connection to the mixer output).
5495 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5499 { "Mic/Line", 0x0 },
5501 { "Headphone", 0x2 },
5507 { "Mic/Line", 0x0 },
5509 { "Headphone", 0x2 },
5516 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5517 * the Fujitsu S702x, but jacks are marked differently.
5519 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5526 { "Headphone", 0x5 },
5535 { "Headphone", 0x6 },
5541 /* Maxdata Favorit 100XS */
5542 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5546 { "Line/Mic", 0x0 },
5553 { "Line/Mic", 0x0 },
5561 * This is just place-holder, so there's something for alc_build_pcms to look
5562 * at when it calculates the maximum number of channels. ALC260 has no mixer
5563 * element which allows changing the channel mode, so the verb list is
5566 static struct hda_channel_mode alc260_modes[1] = {
5571 /* Mixer combinations
5573 * basic: base_output + input + pc_beep + capture
5574 * HP: base_output + input + capture_alt
5575 * HP_3013: hp_3013 + input + capture
5576 * fujitsu: fujitsu + capture
5577 * acer: acer + capture
5580 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5581 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5582 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5584 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5585 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5586 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5590 static struct snd_kcontrol_new alc260_input_mixer[] = {
5591 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5592 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5593 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5594 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5596 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5597 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5598 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5602 /* update HP, line and mono out pins according to the master switch */
5603 static void alc260_hp_master_update(struct hda_codec *codec,
5604 hda_nid_t hp, hda_nid_t line,
5607 struct alc_spec *spec = codec->spec;
5608 unsigned int val = spec->master_sw ? PIN_HP : 0;
5609 /* change HP and line-out pins */
5610 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5612 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5614 /* mono (speaker) depending on the HP jack sense */
5615 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5616 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5620 static int alc260_hp_master_sw_get(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 *ucontrol->value.integer.value = spec->master_sw;
5629 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5630 struct snd_ctl_elem_value *ucontrol)
5632 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5633 struct alc_spec *spec = codec->spec;
5634 int val = !!*ucontrol->value.integer.value;
5635 hda_nid_t hp, line, mono;
5637 if (val == spec->master_sw)
5639 spec->master_sw = val;
5640 hp = (kcontrol->private_value >> 16) & 0xff;
5641 line = (kcontrol->private_value >> 8) & 0xff;
5642 mono = kcontrol->private_value & 0xff;
5643 alc260_hp_master_update(codec, hp, line, mono);
5647 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5649 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5650 .name = "Master Playback Switch",
5651 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5652 .info = snd_ctl_boolean_mono_info,
5653 .get = alc260_hp_master_sw_get,
5654 .put = alc260_hp_master_sw_put,
5655 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5657 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5658 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5659 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5660 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5661 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5663 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5667 static struct hda_verb alc260_hp_unsol_verbs[] = {
5668 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5672 static void alc260_hp_automute(struct hda_codec *codec)
5674 struct alc_spec *spec = codec->spec;
5676 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5677 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5680 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5682 if ((res >> 26) == ALC880_HP_EVENT)
5683 alc260_hp_automute(codec);
5686 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5688 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5689 .name = "Master Playback Switch",
5690 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5691 .info = snd_ctl_boolean_mono_info,
5692 .get = alc260_hp_master_sw_get,
5693 .put = alc260_hp_master_sw_put,
5694 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5696 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5697 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5698 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5699 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5700 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5702 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5703 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5707 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5708 .ops = &snd_hda_bind_vol,
5710 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5711 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5712 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5717 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5718 .ops = &snd_hda_bind_sw,
5720 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5721 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5726 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5727 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5728 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5729 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5734 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5735 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5739 static void alc260_hp_3013_automute(struct hda_codec *codec)
5741 struct alc_spec *spec = codec->spec;
5743 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5744 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5747 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5750 if ((res >> 26) == ALC880_HP_EVENT)
5751 alc260_hp_3013_automute(codec);
5754 static void alc260_hp_3012_automute(struct hda_codec *codec)
5756 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5758 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5760 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5762 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5766 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5769 if ((res >> 26) == ALC880_HP_EVENT)
5770 alc260_hp_3012_automute(codec);
5773 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5774 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5776 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5777 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5778 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5779 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5780 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5781 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5782 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5783 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5784 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5785 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5786 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5790 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5791 * versions of the ALC260 don't act on requests to enable mic bias from NID
5792 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5793 * datasheet doesn't mention this restriction. At this stage it's not clear
5794 * whether this behaviour is intentional or is a hardware bug in chip
5795 * revisions available in early 2006. Therefore for now allow the
5796 * "Headphone Jack Mode" control to span all choices, but if it turns out
5797 * that the lack of mic bias for this NID is intentional we could change the
5798 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5800 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5801 * don't appear to make the mic bias available from the "line" jack, even
5802 * though the NID used for this jack (0x14) can supply it. The theory is
5803 * that perhaps Acer have included blocking capacitors between the ALC260
5804 * and the output jack. If this turns out to be the case for all such
5805 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5806 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5808 * The C20x Tablet series have a mono internal speaker which is controlled
5809 * via the chip's Mono sum widget and pin complex, so include the necessary
5810 * controls for such models. On models without a "mono speaker" the control
5811 * won't do anything.
5813 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5814 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5815 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5816 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5817 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5819 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5821 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5822 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5824 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5825 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5826 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5827 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5828 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5832 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5834 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5835 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5836 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5837 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5838 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5839 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5840 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5844 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5845 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5847 static struct snd_kcontrol_new alc260_will_mixer[] = {
5848 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5849 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5851 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5852 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5853 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5854 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5855 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5856 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5857 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5861 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5862 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5864 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5865 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5866 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5867 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5868 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5869 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5870 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5871 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5872 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5873 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5874 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5879 * initialization verbs
5881 static struct hda_verb alc260_init_verbs[] = {
5882 /* Line In pin widget for input */
5883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5884 /* CD pin widget for input */
5885 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5886 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5887 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5888 /* Mic2 (front panel) pin widget for input and vref at 80% */
5889 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5890 /* LINE-2 is used for line-out in rear */
5891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5892 /* select line-out */
5893 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5895 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5897 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5899 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5900 /* mute capture amp left and right */
5901 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5902 /* set connection select to line in (default select for this ADC) */
5903 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5904 /* mute capture amp left and right */
5905 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5906 /* set connection select to line in (default select for this ADC) */
5907 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5908 /* set vol=0 Line-Out mixer amp left and right */
5909 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5910 /* unmute pin widget amp left and right (no gain on this amp) */
5911 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5912 /* set vol=0 HP mixer amp left and right */
5913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5914 /* unmute pin widget amp left and right (no gain on this amp) */
5915 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5916 /* set vol=0 Mono mixer amp left and right */
5917 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5918 /* unmute pin widget amp left and right (no gain on this amp) */
5919 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5920 /* unmute LINE-2 out pin */
5921 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5922 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5925 /* mute analog inputs */
5926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5931 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5932 /* mute Front out path */
5933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5935 /* mute Headphone out path */
5936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5938 /* mute Mono out path */
5939 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5944 #if 0 /* should be identical with alc260_init_verbs? */
5945 static struct hda_verb alc260_hp_init_verbs[] = {
5946 /* Headphone and output */
5947 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5949 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5950 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5951 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5952 /* Mic2 (front panel) pin widget for input and vref at 80% */
5953 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5954 /* Line In pin widget for input */
5955 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5956 /* Line-2 pin widget for output */
5957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5958 /* CD pin widget for input */
5959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5960 /* unmute amp left and right */
5961 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5962 /* set connection select to line in (default select for this ADC) */
5963 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5964 /* unmute Line-Out mixer amp left and right (volume = 0) */
5965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5966 /* mute pin widget amp left and right (no gain on this amp) */
5967 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5968 /* unmute HP mixer amp left and right (volume = 0) */
5969 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5970 /* mute pin widget amp left and right (no gain on this amp) */
5971 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5972 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5975 /* mute analog inputs */
5976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5981 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5982 /* Unmute Front out path */
5983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5985 /* Unmute Headphone out path */
5986 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5988 /* Unmute Mono out path */
5989 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5990 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5995 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5996 /* Line out and output */
5997 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5999 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6000 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6001 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6002 /* Mic2 (front panel) pin widget for input and vref at 80% */
6003 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6004 /* Line In pin widget for input */
6005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6006 /* Headphone pin widget for output */
6007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6008 /* CD pin widget for input */
6009 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6010 /* unmute amp left and right */
6011 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6012 /* set connection select to line in (default select for this ADC) */
6013 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6014 /* unmute Line-Out mixer amp left and right (volume = 0) */
6015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6016 /* mute pin widget amp left and right (no gain on this amp) */
6017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6018 /* unmute HP mixer amp left and right (volume = 0) */
6019 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6020 /* mute pin widget amp left and right (no gain on this amp) */
6021 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6022 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6025 /* mute analog inputs */
6026 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6027 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6031 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6032 /* Unmute Front out path */
6033 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6034 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6035 /* Unmute Headphone out path */
6036 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6038 /* Unmute Mono out path */
6039 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6040 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6044 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6045 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6046 * audio = 0x16, internal speaker = 0x10.
6048 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6049 /* Disable all GPIOs */
6050 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6051 /* Internal speaker is connected to headphone pin */
6052 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6053 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6054 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6055 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6056 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6057 /* Ensure all other unused pins are disabled and muted. */
6058 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6059 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6060 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6061 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6062 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6063 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6067 /* Disable digital (SPDIF) pins */
6068 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6069 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6071 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6072 * when acting as an output.
6074 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6076 /* Start with output sum widgets muted and their output gains at min */
6077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6078 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6080 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6083 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6084 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6085 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6087 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6088 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6089 /* Unmute Line1 pin widget output buffer since it starts as an output.
6090 * If the pin mode is changed by the user the pin mode control will
6091 * take care of enabling the pin's input/output buffers as needed.
6092 * Therefore there's no need to enable the input buffer at this
6095 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6096 /* Unmute input buffer of pin widget used for Line-in (no equiv
6099 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6101 /* Mute capture amp left and right */
6102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6103 /* Set ADC connection select to match default mixer setting - line
6106 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6108 /* Do the same for the second ADC: mute capture input amp and
6109 * set ADC connection to line in (on mic1 pin)
6111 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6112 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6114 /* Mute all inputs to mixer widget (even unconnected ones) */
6115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6127 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6128 * similar laptops (adapted from Fujitsu init verbs).
6130 static struct hda_verb alc260_acer_init_verbs[] = {
6131 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6132 * the headphone jack. Turn this on and rely on the standard mute
6133 * methods whenever the user wants to turn these outputs off.
6135 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6136 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6137 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6138 /* Internal speaker/Headphone jack is connected to Line-out pin */
6139 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6140 /* Internal microphone/Mic jack is connected to Mic1 pin */
6141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6142 /* Line In jack is connected to Line1 pin */
6143 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6144 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6145 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6146 /* Ensure all other unused pins are disabled and muted. */
6147 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6148 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6149 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6150 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6151 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6152 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6153 /* Disable digital (SPDIF) pins */
6154 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6155 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6157 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6158 * bus when acting as outputs.
6160 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6161 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6163 /* Start with output sum widgets muted and their output gains at min */
6164 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6165 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6166 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6167 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6168 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6170 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6171 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6172 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6174 /* Unmute Line-out pin widget amp left and right
6175 * (no equiv mixer ctrl)
6177 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6178 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6179 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6180 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6181 * inputs. If the pin mode is changed by the user the pin mode control
6182 * will take care of enabling the pin's input/output buffers as needed.
6183 * Therefore there's no need to enable the input buffer at this
6186 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6187 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6189 /* Mute capture amp left and right */
6190 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6191 /* Set ADC connection select to match default mixer setting - mic
6194 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6196 /* Do similar with the second ADC: mute capture input amp and
6197 * set ADC connection to mic to match ALSA's default state.
6199 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6200 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6202 /* Mute all inputs to mixer widget (even unconnected ones) */
6203 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6204 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6205 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6206 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6210 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6215 /* Initialisation sequence for Maxdata Favorit 100XS
6216 * (adapted from Acer init verbs).
6218 static struct hda_verb alc260_favorit100_init_verbs[] = {
6219 /* GPIO 0 enables the output jack.
6220 * Turn this on and rely on the standard mute
6221 * methods whenever the user wants to turn these outputs off.
6223 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6224 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6225 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6226 /* Line/Mic input jack is connected to Mic1 pin */
6227 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6228 /* Ensure all other unused pins are disabled and muted. */
6229 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6230 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6231 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6232 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6234 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6235 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6236 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6239 /* Disable digital (SPDIF) pins */
6240 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6241 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6243 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6244 * bus when acting as outputs.
6246 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6247 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6249 /* Start with output sum widgets muted and their output gains at min */
6250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6251 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6252 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6253 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6255 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6256 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6257 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6258 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6260 /* Unmute Line-out pin widget amp left and right
6261 * (no equiv mixer ctrl)
6263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6264 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6265 * inputs. If the pin mode is changed by the user the pin mode control
6266 * will take care of enabling the pin's input/output buffers as needed.
6267 * Therefore there's no need to enable the input buffer at this
6270 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6272 /* Mute capture amp left and right */
6273 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6274 /* Set ADC connection select to match default mixer setting - mic
6277 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6279 /* Do similar with the second ADC: mute capture input amp and
6280 * set ADC connection to mic to match ALSA's default state.
6282 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6283 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6285 /* Mute all inputs to mixer widget (even unconnected ones) */
6286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6298 static struct hda_verb alc260_will_verbs[] = {
6299 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6300 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6301 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6302 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6303 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6304 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6308 static struct hda_verb alc260_replacer_672v_verbs[] = {
6309 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6310 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6311 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6313 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6314 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6315 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6317 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6321 /* toggle speaker-output according to the hp-jack state */
6322 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6324 unsigned int present;
6326 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6327 present = snd_hda_jack_detect(codec, 0x0f);
6329 snd_hda_codec_write_cache(codec, 0x01, 0,
6330 AC_VERB_SET_GPIO_DATA, 1);
6331 snd_hda_codec_write_cache(codec, 0x0f, 0,
6332 AC_VERB_SET_PIN_WIDGET_CONTROL,
6335 snd_hda_codec_write_cache(codec, 0x01, 0,
6336 AC_VERB_SET_GPIO_DATA, 0);
6337 snd_hda_codec_write_cache(codec, 0x0f, 0,
6338 AC_VERB_SET_PIN_WIDGET_CONTROL,
6343 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6346 if ((res >> 26) == ALC880_HP_EVENT)
6347 alc260_replacer_672v_automute(codec);
6350 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6351 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6353 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6354 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6355 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6357 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6358 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6359 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6364 /* Test configuration for debugging, modelled after the ALC880 test
6367 #ifdef CONFIG_SND_DEBUG
6368 static hda_nid_t alc260_test_dac_nids[1] = {
6371 static hda_nid_t alc260_test_adc_nids[2] = {
6374 /* For testing the ALC260, each input MUX needs its own definition since
6375 * the signal assignments are different. This assumes that the first ADC
6378 static struct hda_input_mux alc260_test_capture_sources[2] = {
6382 { "MIC1 pin", 0x0 },
6383 { "MIC2 pin", 0x1 },
6384 { "LINE1 pin", 0x2 },
6385 { "LINE2 pin", 0x3 },
6387 { "LINE-OUT pin", 0x5 },
6388 { "HP-OUT pin", 0x6 },
6394 { "MIC1 pin", 0x0 },
6395 { "MIC2 pin", 0x1 },
6396 { "LINE1 pin", 0x2 },
6397 { "LINE2 pin", 0x3 },
6400 { "LINE-OUT pin", 0x6 },
6401 { "HP-OUT pin", 0x7 },
6405 static struct snd_kcontrol_new alc260_test_mixer[] = {
6406 /* Output driver widgets */
6407 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6408 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6409 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6410 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6411 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6412 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6414 /* Modes for retasking pin widgets
6415 * Note: the ALC260 doesn't seem to act on requests to enable mic
6416 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6417 * mention this restriction. At this stage it's not clear whether
6418 * this behaviour is intentional or is a hardware bug in chip
6419 * revisions available at least up until early 2006. Therefore for
6420 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6421 * choices, but if it turns out that the lack of mic bias for these
6422 * NIDs is intentional we could change their modes from
6423 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6425 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6426 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6427 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6428 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6429 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6430 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6432 /* Loopback mixer controls */
6433 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6434 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6435 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6436 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6437 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6438 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6439 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6440 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6441 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6442 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6443 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6444 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6445 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6446 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6448 /* Controls for GPIO pins, assuming they are configured as outputs */
6449 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6450 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6451 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6452 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6454 /* Switches to allow the digital IO pins to be enabled. The datasheet
6455 * is ambigious as to which NID is which; testing on laptops which
6456 * make this output available should provide clarification.
6458 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6459 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6461 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6462 * this output to turn on an external amplifier.
6464 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6465 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6469 static struct hda_verb alc260_test_init_verbs[] = {
6470 /* Enable all GPIOs as outputs with an initial value of 0 */
6471 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6472 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6473 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6475 /* Enable retasking pins as output, initially without power amp */
6476 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6477 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6480 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6481 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6483 /* Disable digital (SPDIF) pins initially, but users can enable
6484 * them via a mixer switch. In the case of SPDIF-out, this initverb
6485 * payload also sets the generation to 0, output to be in "consumer"
6486 * PCM format, copyright asserted, no pre-emphasis and no validity
6489 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6490 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6492 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6493 * OUT1 sum bus when acting as an output.
6495 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6496 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6497 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6498 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6500 /* Start with output sum widgets muted and their output gains at min */
6501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6502 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6507 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6508 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6509 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6511 /* Unmute retasking pin widget output buffers since the default
6512 * state appears to be output. As the pin mode is changed by the
6513 * user the pin mode control will take care of enabling the pin's
6514 * input/output buffers as needed.
6516 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6517 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6520 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6521 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6522 /* Also unmute the mono-out pin widget */
6523 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6525 /* Mute capture amp left and right */
6526 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6527 /* Set ADC connection select to match default mixer setting (mic1
6530 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6532 /* Do the same for the second ADC: mute capture input amp and
6533 * set ADC connection to mic1 pin
6535 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6536 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6538 /* Mute all inputs to mixer widget (even unconnected ones) */
6539 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6552 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6553 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6555 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6556 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6559 * for BIOS auto-configuration
6562 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6563 const char *pfx, int *vol_bits)
6566 unsigned long vol_val, sw_val;
6569 if (nid >= 0x0f && nid < 0x11) {
6570 nid_vol = nid - 0x7;
6571 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6572 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6573 } else if (nid == 0x11) {
6574 nid_vol = nid - 0x7;
6575 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6576 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6577 } else if (nid >= 0x12 && nid <= 0x15) {
6579 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6580 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6584 if (!(*vol_bits & (1 << nid_vol))) {
6585 /* first control for the volume widget */
6586 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6589 *vol_bits |= (1 << nid_vol);
6591 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6597 /* add playback controls from the parsed DAC table */
6598 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6599 const struct auto_pin_cfg *cfg)
6605 spec->multiout.num_dacs = 1;
6606 spec->multiout.dac_nids = spec->private_dac_nids;
6607 spec->multiout.dac_nids[0] = 0x02;
6609 nid = cfg->line_out_pins[0];
6612 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6614 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6618 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6623 nid = cfg->speaker_pins[0];
6625 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6630 nid = cfg->hp_pins[0];
6632 err = alc260_add_playback_controls(spec, nid, "Headphone",
6640 /* create playback/capture controls for input pins */
6641 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6642 const struct auto_pin_cfg *cfg)
6644 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6647 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6648 hda_nid_t nid, int pin_type,
6651 alc_set_pin_output(codec, nid, pin_type);
6652 /* need the manual connection? */
6654 int idx = nid - 0x12;
6655 snd_hda_codec_write(codec, idx + 0x0b, 0,
6656 AC_VERB_SET_CONNECT_SEL, sel_idx);
6660 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6662 struct alc_spec *spec = codec->spec;
6665 nid = spec->autocfg.line_out_pins[0];
6667 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6668 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6671 nid = spec->autocfg.speaker_pins[0];
6673 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6675 nid = spec->autocfg.hp_pins[0];
6677 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6680 #define ALC260_PIN_CD_NID 0x16
6681 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6683 struct alc_spec *spec = codec->spec;
6684 struct auto_pin_cfg *cfg = &spec->autocfg;
6687 for (i = 0; i < cfg->num_inputs; i++) {
6688 hda_nid_t nid = cfg->inputs[i].pin;
6690 alc_set_input_pin(codec, nid, i);
6691 if (nid != ALC260_PIN_CD_NID &&
6692 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6693 snd_hda_codec_write(codec, nid, 0,
6694 AC_VERB_SET_AMP_GAIN_MUTE,
6700 #define alc260_auto_init_input_src alc880_auto_init_input_src
6703 * generic initialization of ADC, input mixers and output mixers
6705 static struct hda_verb alc260_volume_init_verbs[] = {
6707 * Unmute ADC0-1 and set the default input to mic-in
6709 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6710 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6711 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6712 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6714 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6716 * Note: PASD motherboards uses the Line In 2 as the input for
6717 * front panel mic (mic 2)
6719 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6720 /* mute analog inputs */
6721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6728 * Set up output mixers (0x08 - 0x0a)
6730 /* set vol=0 to output mixers */
6731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6732 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6733 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6734 /* set up input amps for analog loopback */
6735 /* Amp Indices: DAC = 0, mixer = 1 */
6736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6737 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6739 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6740 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6741 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6746 static int alc260_parse_auto_config(struct hda_codec *codec)
6748 struct alc_spec *spec = codec->spec;
6750 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6752 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6756 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6759 if (!spec->kctls.list)
6760 return 0; /* can't find valid BIOS pin config */
6761 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6765 spec->multiout.max_channels = 2;
6767 if (spec->autocfg.dig_outs)
6768 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6769 if (spec->kctls.list)
6770 add_mixer(spec, spec->kctls.list);
6772 add_verb(spec, alc260_volume_init_verbs);
6774 spec->num_mux_defs = 1;
6775 spec->input_mux = &spec->private_imux[0];
6777 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6782 /* additional initialization for auto-configuration model */
6783 static void alc260_auto_init(struct hda_codec *codec)
6785 struct alc_spec *spec = codec->spec;
6786 alc260_auto_init_multi_out(codec);
6787 alc260_auto_init_analog_input(codec);
6788 alc260_auto_init_input_src(codec);
6789 alc_auto_init_digital(codec);
6790 if (spec->unsol_event)
6791 alc_inithook(codec);
6794 #ifdef CONFIG_SND_HDA_POWER_SAVE
6795 static struct hda_amp_list alc260_loopbacks[] = {
6796 { 0x07, HDA_INPUT, 0 },
6797 { 0x07, HDA_INPUT, 1 },
6798 { 0x07, HDA_INPUT, 2 },
6799 { 0x07, HDA_INPUT, 3 },
6800 { 0x07, HDA_INPUT, 4 },
6812 static const struct alc_fixup alc260_fixups[] = {
6813 [PINFIX_HP_DC5750] = {
6814 .pins = (const struct alc_pincfg[]) {
6815 { 0x11, 0x90130110 }, /* speaker */
6821 static struct snd_pci_quirk alc260_fixup_tbl[] = {
6822 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
6827 * ALC260 configurations
6829 static const char *alc260_models[ALC260_MODEL_LAST] = {
6830 [ALC260_BASIC] = "basic",
6832 [ALC260_HP_3013] = "hp-3013",
6833 [ALC260_HP_DC7600] = "hp-dc7600",
6834 [ALC260_FUJITSU_S702X] = "fujitsu",
6835 [ALC260_ACER] = "acer",
6836 [ALC260_WILL] = "will",
6837 [ALC260_REPLACER_672V] = "replacer",
6838 [ALC260_FAVORIT100] = "favorit100",
6839 #ifdef CONFIG_SND_DEBUG
6840 [ALC260_TEST] = "test",
6842 [ALC260_AUTO] = "auto",
6845 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6846 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6847 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6848 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6849 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6850 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6851 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6852 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6853 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6854 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6855 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6856 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6857 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6858 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6859 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6860 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6861 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6862 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6863 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6864 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6865 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6869 static struct alc_config_preset alc260_presets[] = {
6871 .mixers = { alc260_base_output_mixer,
6872 alc260_input_mixer },
6873 .init_verbs = { alc260_init_verbs },
6874 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6875 .dac_nids = alc260_dac_nids,
6876 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6877 .adc_nids = alc260_dual_adc_nids,
6878 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6879 .channel_mode = alc260_modes,
6880 .input_mux = &alc260_capture_source,
6883 .mixers = { alc260_hp_output_mixer,
6884 alc260_input_mixer },
6885 .init_verbs = { alc260_init_verbs,
6886 alc260_hp_unsol_verbs },
6887 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6888 .dac_nids = alc260_dac_nids,
6889 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6890 .adc_nids = alc260_adc_nids_alt,
6891 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6892 .channel_mode = alc260_modes,
6893 .input_mux = &alc260_capture_source,
6894 .unsol_event = alc260_hp_unsol_event,
6895 .init_hook = alc260_hp_automute,
6897 [ALC260_HP_DC7600] = {
6898 .mixers = { alc260_hp_dc7600_mixer,
6899 alc260_input_mixer },
6900 .init_verbs = { alc260_init_verbs,
6901 alc260_hp_dc7600_verbs },
6902 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6903 .dac_nids = alc260_dac_nids,
6904 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6905 .adc_nids = alc260_adc_nids_alt,
6906 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6907 .channel_mode = alc260_modes,
6908 .input_mux = &alc260_capture_source,
6909 .unsol_event = alc260_hp_3012_unsol_event,
6910 .init_hook = alc260_hp_3012_automute,
6912 [ALC260_HP_3013] = {
6913 .mixers = { alc260_hp_3013_mixer,
6914 alc260_input_mixer },
6915 .init_verbs = { alc260_hp_3013_init_verbs,
6916 alc260_hp_3013_unsol_verbs },
6917 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6918 .dac_nids = alc260_dac_nids,
6919 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6920 .adc_nids = alc260_adc_nids_alt,
6921 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6922 .channel_mode = alc260_modes,
6923 .input_mux = &alc260_capture_source,
6924 .unsol_event = alc260_hp_3013_unsol_event,
6925 .init_hook = alc260_hp_3013_automute,
6927 [ALC260_FUJITSU_S702X] = {
6928 .mixers = { alc260_fujitsu_mixer },
6929 .init_verbs = { alc260_fujitsu_init_verbs },
6930 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6931 .dac_nids = alc260_dac_nids,
6932 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6933 .adc_nids = alc260_dual_adc_nids,
6934 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6935 .channel_mode = alc260_modes,
6936 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6937 .input_mux = alc260_fujitsu_capture_sources,
6940 .mixers = { alc260_acer_mixer },
6941 .init_verbs = { alc260_acer_init_verbs },
6942 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6943 .dac_nids = alc260_dac_nids,
6944 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6945 .adc_nids = alc260_dual_adc_nids,
6946 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6947 .channel_mode = alc260_modes,
6948 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6949 .input_mux = alc260_acer_capture_sources,
6951 [ALC260_FAVORIT100] = {
6952 .mixers = { alc260_favorit100_mixer },
6953 .init_verbs = { alc260_favorit100_init_verbs },
6954 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6955 .dac_nids = alc260_dac_nids,
6956 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6957 .adc_nids = alc260_dual_adc_nids,
6958 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6959 .channel_mode = alc260_modes,
6960 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6961 .input_mux = alc260_favorit100_capture_sources,
6964 .mixers = { alc260_will_mixer },
6965 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6966 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6967 .dac_nids = alc260_dac_nids,
6968 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6969 .adc_nids = alc260_adc_nids,
6970 .dig_out_nid = ALC260_DIGOUT_NID,
6971 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6972 .channel_mode = alc260_modes,
6973 .input_mux = &alc260_capture_source,
6975 [ALC260_REPLACER_672V] = {
6976 .mixers = { alc260_replacer_672v_mixer },
6977 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6978 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6979 .dac_nids = alc260_dac_nids,
6980 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6981 .adc_nids = alc260_adc_nids,
6982 .dig_out_nid = ALC260_DIGOUT_NID,
6983 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6984 .channel_mode = alc260_modes,
6985 .input_mux = &alc260_capture_source,
6986 .unsol_event = alc260_replacer_672v_unsol_event,
6987 .init_hook = alc260_replacer_672v_automute,
6989 #ifdef CONFIG_SND_DEBUG
6991 .mixers = { alc260_test_mixer },
6992 .init_verbs = { alc260_test_init_verbs },
6993 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6994 .dac_nids = alc260_test_dac_nids,
6995 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6996 .adc_nids = alc260_test_adc_nids,
6997 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6998 .channel_mode = alc260_modes,
6999 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7000 .input_mux = alc260_test_capture_sources,
7005 static int patch_alc260(struct hda_codec *codec)
7007 struct alc_spec *spec;
7008 int err, board_config;
7010 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7016 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7019 if (board_config < 0) {
7020 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7022 board_config = ALC260_AUTO;
7025 if (board_config == ALC260_AUTO)
7026 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7028 if (board_config == ALC260_AUTO) {
7029 /* automatic parse from the BIOS config */
7030 err = alc260_parse_auto_config(codec);
7036 "hda_codec: Cannot set up configuration "
7037 "from BIOS. Using base mode...\n");
7038 board_config = ALC260_BASIC;
7042 err = snd_hda_attach_beep_device(codec, 0x1);
7048 if (board_config != ALC260_AUTO)
7049 setup_preset(codec, &alc260_presets[board_config]);
7051 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7052 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7053 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7055 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7056 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7058 if (!spec->adc_nids && spec->input_mux) {
7059 /* check whether NID 0x04 is valid */
7060 unsigned int wcap = get_wcaps(codec, 0x04);
7061 wcap = get_wcaps_type(wcap);
7063 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7064 spec->adc_nids = alc260_adc_nids_alt;
7065 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7067 spec->adc_nids = alc260_adc_nids;
7068 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7071 set_capture_mixer(codec);
7072 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7074 if (board_config == ALC260_AUTO)
7075 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7077 spec->vmaster_nid = 0x08;
7079 codec->patch_ops = alc_patch_ops;
7080 if (board_config == ALC260_AUTO)
7081 spec->init_hook = alc260_auto_init;
7082 #ifdef CONFIG_SND_HDA_POWER_SAVE
7083 if (!spec->loopback.amplist)
7084 spec->loopback.amplist = alc260_loopbacks;
7092 * ALC882/883/885/888/889 support
7094 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7095 * configuration. Each pin widget can choose any input DACs and a mixer.
7096 * Each ADC is connected from a mixer of all inputs. This makes possible
7097 * 6-channel independent captures.
7099 * In addition, an independent DAC for the multi-playback (not used in this
7102 #define ALC882_DIGOUT_NID 0x06
7103 #define ALC882_DIGIN_NID 0x0a
7104 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7105 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7106 #define ALC1200_DIGOUT_NID 0x10
7109 static struct hda_channel_mode alc882_ch_modes[1] = {
7114 static hda_nid_t alc882_dac_nids[4] = {
7115 /* front, rear, clfe, rear_surr */
7116 0x02, 0x03, 0x04, 0x05
7118 #define alc883_dac_nids alc882_dac_nids
7121 #define alc882_adc_nids alc880_adc_nids
7122 #define alc882_adc_nids_alt alc880_adc_nids_alt
7123 #define alc883_adc_nids alc882_adc_nids_alt
7124 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7125 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7126 #define alc889_adc_nids alc880_adc_nids
7128 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7129 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7130 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7131 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7132 #define alc889_capsrc_nids alc882_capsrc_nids
7135 /* FIXME: should be a matrix-type input source selection */
7137 static struct hda_input_mux alc882_capture_source = {
7141 { "Front Mic", 0x1 },
7147 #define alc883_capture_source alc882_capture_source
7149 static struct hda_input_mux alc889_capture_source = {
7152 { "Front Mic", 0x0 },
7158 static struct hda_input_mux mb5_capture_source = {
7167 static struct hda_input_mux macmini3_capture_source = {
7175 static struct hda_input_mux alc883_3stack_6ch_intel = {
7179 { "Front Mic", 0x0 },
7185 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7193 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7203 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7211 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7215 { "Front Mic", 0x1 },
7220 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7228 static struct hda_input_mux alc889A_mb31_capture_source = {
7232 /* Front Mic (0x01) unused */
7234 /* Line 2 (0x03) unused */
7235 /* CD (0x04) unused? */
7239 static struct hda_input_mux alc889A_imac91_capture_source = {
7243 { "Line", 0x2 }, /* Not sure! */
7250 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7257 static struct hda_verb alc882_3ST_ch2_init[] = {
7258 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7259 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7260 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7261 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7268 static struct hda_verb alc882_3ST_ch4_init[] = {
7269 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7270 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7271 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7272 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7273 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7280 static struct hda_verb alc882_3ST_ch6_init[] = {
7281 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7282 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7283 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7284 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7285 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7286 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7290 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7291 { 2, alc882_3ST_ch2_init },
7292 { 4, alc882_3ST_ch4_init },
7293 { 6, alc882_3ST_ch6_init },
7296 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7301 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7302 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7303 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7304 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7305 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7306 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7313 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7314 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7315 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7316 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7317 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7318 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7319 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7326 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7327 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7328 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7329 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7330 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7331 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7332 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7333 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7337 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7338 { 2, alc883_3ST_ch2_clevo_init },
7339 { 4, alc883_3ST_ch4_clevo_init },
7340 { 6, alc883_3ST_ch6_clevo_init },
7347 static struct hda_verb alc882_sixstack_ch6_init[] = {
7348 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7349 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7350 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7351 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7358 static struct hda_verb alc882_sixstack_ch8_init[] = {
7359 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7360 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7361 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7362 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7366 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7367 { 6, alc882_sixstack_ch6_init },
7368 { 8, alc882_sixstack_ch8_init },
7372 /* Macbook Air 2,1 */
7374 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7379 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7385 static struct hda_verb alc885_mbp_ch2_init[] = {
7386 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7387 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7388 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7395 static struct hda_verb alc885_mbp_ch4_init[] = {
7396 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7397 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7398 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7399 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7400 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7404 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7405 { 2, alc885_mbp_ch2_init },
7406 { 4, alc885_mbp_ch4_init },
7411 * Speakers/Woofer/HP = Front
7414 static struct hda_verb alc885_mb5_ch2_init[] = {
7415 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7422 * Speakers/HP = Front
7426 static struct hda_verb alc885_mb5_ch6_init[] = {
7427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7433 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7434 { 2, alc885_mb5_ch2_init },
7435 { 6, alc885_mb5_ch6_init },
7438 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7443 static struct hda_verb alc883_4ST_ch2_init[] = {
7444 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7445 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7446 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7447 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7448 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7449 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7456 static struct hda_verb alc883_4ST_ch4_init[] = {
7457 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7458 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7461 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7462 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7463 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7470 static struct hda_verb alc883_4ST_ch6_init[] = {
7471 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7472 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7473 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7474 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7475 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7476 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7477 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7478 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7485 static struct hda_verb alc883_4ST_ch8_init[] = {
7486 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7487 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7488 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7489 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7490 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7491 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7492 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7493 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7494 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7498 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7499 { 2, alc883_4ST_ch2_init },
7500 { 4, alc883_4ST_ch4_init },
7501 { 6, alc883_4ST_ch6_init },
7502 { 8, alc883_4ST_ch8_init },
7509 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7510 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7511 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7512 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7513 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7520 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7521 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7522 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7523 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7524 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7525 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7532 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7533 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7534 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7535 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7536 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7537 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7538 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7542 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7543 { 2, alc883_3ST_ch2_intel_init },
7544 { 4, alc883_3ST_ch4_intel_init },
7545 { 6, alc883_3ST_ch6_intel_init },
7551 static struct hda_verb alc889_ch2_intel_init[] = {
7552 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7553 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7554 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7555 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7556 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7557 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7564 static struct hda_verb alc889_ch6_intel_init[] = {
7565 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7566 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7567 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7568 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7569 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7570 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7577 static struct hda_verb alc889_ch8_intel_init[] = {
7578 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7579 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7580 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7581 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7582 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7583 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7584 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7588 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7589 { 2, alc889_ch2_intel_init },
7590 { 6, alc889_ch6_intel_init },
7591 { 8, alc889_ch8_intel_init },
7597 static struct hda_verb alc883_sixstack_ch6_init[] = {
7598 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7599 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7600 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7601 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7608 static struct hda_verb alc883_sixstack_ch8_init[] = {
7609 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7610 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7611 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7612 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7616 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7617 { 6, alc883_sixstack_ch6_init },
7618 { 8, alc883_sixstack_ch8_init },
7622 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7623 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7625 static struct snd_kcontrol_new alc882_base_mixer[] = {
7626 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7627 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7628 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7629 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7630 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7631 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7632 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7633 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7634 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7635 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7637 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7638 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7640 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7646 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7650 /* Macbook Air 2,1 same control for HP and internal Speaker */
7652 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7653 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7654 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7659 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7660 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7661 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7662 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7663 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7664 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7666 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7668 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7674 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7675 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7676 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7677 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7678 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7679 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7680 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7681 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7682 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7684 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7686 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7688 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7692 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7693 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7694 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7695 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7696 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7697 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7698 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7699 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7700 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7701 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7702 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7703 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7707 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7708 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7709 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7714 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7715 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7716 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7717 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7718 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7722 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7727 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7728 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7729 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7737 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7739 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7740 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7744 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7745 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7747 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7748 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7749 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7750 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7751 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7752 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7753 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7754 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7755 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7757 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7759 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7764 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7765 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7766 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7767 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7768 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7769 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7770 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7771 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7773 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7778 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7781 .name = "Channel Mode",
7782 .info = alc_ch_mode_info,
7783 .get = alc_ch_mode_get,
7784 .put = alc_ch_mode_put,
7789 static struct hda_verb alc882_base_init_verbs[] = {
7790 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7792 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7794 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7795 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7797 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7798 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7803 /* Front Pin: output 0 (0x0c) */
7804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7806 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7807 /* Rear Pin: output 1 (0x0d) */
7808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7810 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7811 /* CLFE Pin: output 2 (0x0e) */
7812 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7813 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7814 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7815 /* Side Pin: output 3 (0x0f) */
7816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7818 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7819 /* Mic (rear) pin: input vref at 80% */
7820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7822 /* Front Mic pin: input vref at 80% */
7823 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7825 /* Line In pin: input */
7826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7828 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7830 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7831 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7832 /* CD pin widget for input */
7833 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7835 /* FIXME: use matrix-type input source selection */
7836 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7838 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7841 /* ADC2: mute amp left and right */
7842 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7843 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7844 /* ADC3: mute amp left and right */
7845 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7846 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7851 static struct hda_verb alc882_adc1_init_verbs[] = {
7852 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7853 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7854 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7857 /* ADC1: mute amp left and right */
7858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7859 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7863 static struct hda_verb alc882_eapd_verbs[] = {
7864 /* change to EAPD mode */
7865 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7866 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7870 static struct hda_verb alc889_eapd_verbs[] = {
7871 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7872 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7876 static struct hda_verb alc_hp15_unsol_verbs[] = {
7877 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7882 static struct hda_verb alc885_init_verbs[] = {
7883 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7888 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7891 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7893 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7896 /* Front HP Pin: output 0 (0x0c) */
7897 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7899 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7900 /* Front Pin: output 0 (0x0c) */
7901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7903 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7904 /* Rear Pin: output 1 (0x0d) */
7905 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7906 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7907 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7908 /* CLFE Pin: output 2 (0x0e) */
7909 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7910 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7911 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7912 /* Side Pin: output 3 (0x0f) */
7913 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7914 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7915 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7916 /* Mic (rear) pin: input vref at 80% */
7917 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7918 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7919 /* Front Mic pin: input vref at 80% */
7920 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7921 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7922 /* Line In pin: input */
7923 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7924 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7926 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7928 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7930 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7933 /* ADC2: mute amp left and right */
7934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7935 /* ADC3: mute amp left and right */
7936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7941 static struct hda_verb alc885_init_input_verbs[] = {
7942 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7943 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7944 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7949 /* Unmute Selector 24h and set the default input to front mic */
7950 static struct hda_verb alc889_init_input_verbs[] = {
7951 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7957 #define alc883_init_verbs alc882_base_init_verbs
7960 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7961 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7962 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7964 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7965 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7966 /* FIXME: this looks suspicious...
7967 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7968 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7973 static struct hda_verb alc882_macpro_init_verbs[] = {
7974 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7975 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7978 /* Front Pin: output 0 (0x0c) */
7979 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7981 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7982 /* Front Mic pin: input vref at 80% */
7983 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7984 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7985 /* Speaker: output */
7986 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7987 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7988 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7989 /* Headphone output (output 0 - 0x0c) */
7990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7991 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7992 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7994 /* FIXME: use matrix-type input source selection */
7995 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7996 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8007 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8008 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8011 /* ADC1: mute amp left and right */
8012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8013 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8014 /* ADC2: mute amp left and right */
8015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8016 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8017 /* ADC3: mute amp left and right */
8018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8019 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8025 static struct hda_verb alc885_mb5_init_verbs[] = {
8027 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8028 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8029 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8030 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8032 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8033 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8035 /* Surround mixer */
8036 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8038 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8040 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8044 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8045 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8046 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8047 /* Front Pin (0x0c) */
8048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8050 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8051 /* LFE Pin (0x0e) */
8052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8053 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8054 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8058 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8059 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8060 /* Front Mic pin: input vref at 80% */
8061 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8064 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8074 static struct hda_verb alc885_macmini3_init_verbs[] = {
8076 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8077 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8078 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8079 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8081 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8082 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8084 /* Surround mixer */
8085 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8086 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8090 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8091 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8093 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8094 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8095 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8096 /* Front Pin (0x0c) */
8097 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8098 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8099 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8100 /* LFE Pin (0x0e) */
8101 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8102 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8103 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8105 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8106 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8107 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8108 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8121 static struct hda_verb alc885_mba21_init_verbs[] = {
8122 /*Internal and HP Speaker Mixer*/
8123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8126 /*Internal Speaker Pin (0x0c)*/
8127 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8128 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8129 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8130 /* HP Pin: output 0 (0x0e) */
8131 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8132 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8133 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8134 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8135 /* Line in (is hp when jack connected)*/
8136 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8143 /* Macbook Pro rev3 */
8144 static struct hda_verb alc885_mbp3_init_verbs[] = {
8145 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8150 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8155 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8156 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8157 /* Front Pin: output 0 (0x0c) */
8158 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8159 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8160 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8161 /* HP Pin: output 0 (0x0e) */
8162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8163 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8164 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8165 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8166 /* Mic (rear) pin: input vref at 80% */
8167 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8168 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8169 /* Front Mic pin: input vref at 80% */
8170 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8171 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8172 /* Line In pin: use output 1 when in LineOut mode */
8173 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8175 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8177 /* FIXME: use matrix-type input source selection */
8178 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8179 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8185 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8186 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8190 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8191 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8194 /* ADC1: mute amp left and right */
8195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8196 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8197 /* ADC2: mute amp left and right */
8198 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8199 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8200 /* ADC3: mute amp left and right */
8201 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8202 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8208 static struct hda_verb alc885_imac91_init_verbs[] = {
8209 /* Internal Speaker Pin (0x0c) */
8210 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8212 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8213 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8214 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8215 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8218 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8219 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8220 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8224 /* Front Mic pin: input vref at 80% */
8225 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8226 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8228 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8229 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8231 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8235 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8240 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8241 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8245 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8246 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8247 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8250 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8251 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8252 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8253 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8254 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8255 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8256 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8258 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8262 /* iMac 24 mixer. */
8263 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8264 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8265 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8269 /* iMac 24 init verbs. */
8270 static struct hda_verb alc885_imac24_init_verbs[] = {
8271 /* Internal speakers: output 0 (0x0c) */
8272 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8273 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8274 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8275 /* Internal speakers: output 0 (0x0c) */
8276 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8277 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8278 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8279 /* Headphone: output 0 (0x0c) */
8280 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8281 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8282 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8283 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8284 /* Front Mic: input vref at 80% */
8285 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8290 /* Toggle speaker-output according to the hp-jack state */
8291 static void alc885_imac24_setup(struct hda_codec *codec)
8293 struct alc_spec *spec = codec->spec;
8295 spec->autocfg.hp_pins[0] = 0x14;
8296 spec->autocfg.speaker_pins[0] = 0x18;
8297 spec->autocfg.speaker_pins[1] = 0x1a;
8300 #define alc885_mb5_setup alc885_imac24_setup
8301 #define alc885_macmini3_setup alc885_imac24_setup
8303 /* Macbook Air 2,1 */
8304 static void alc885_mba21_setup(struct hda_codec *codec)
8306 struct alc_spec *spec = codec->spec;
8308 spec->autocfg.hp_pins[0] = 0x14;
8309 spec->autocfg.speaker_pins[0] = 0x18;
8314 static void alc885_mbp3_setup(struct hda_codec *codec)
8316 struct alc_spec *spec = codec->spec;
8318 spec->autocfg.hp_pins[0] = 0x15;
8319 spec->autocfg.speaker_pins[0] = 0x14;
8322 static void alc885_imac91_setup(struct hda_codec *codec)
8324 struct alc_spec *spec = codec->spec;
8326 spec->autocfg.hp_pins[0] = 0x14;
8327 spec->autocfg.speaker_pins[0] = 0x18;
8328 spec->autocfg.speaker_pins[1] = 0x1a;
8331 static struct hda_verb alc882_targa_verbs[] = {
8332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8335 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8336 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8338 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8339 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8340 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8342 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8346 /* toggle speaker-output according to the hp-jack state */
8347 static void alc882_targa_automute(struct hda_codec *codec)
8349 struct alc_spec *spec = codec->spec;
8350 alc_automute_amp(codec);
8351 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8352 spec->jack_present ? 1 : 3);
8355 static void alc882_targa_setup(struct hda_codec *codec)
8357 struct alc_spec *spec = codec->spec;
8359 spec->autocfg.hp_pins[0] = 0x14;
8360 spec->autocfg.speaker_pins[0] = 0x1b;
8363 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8365 if ((res >> 26) == ALC880_HP_EVENT)
8366 alc882_targa_automute(codec);
8369 static struct hda_verb alc882_asus_a7j_verbs[] = {
8370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8374 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8375 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8377 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8378 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8379 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8381 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8382 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8383 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8387 static struct hda_verb alc882_asus_a7m_verbs[] = {
8388 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8392 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8393 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8395 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8397 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8399 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8400 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8401 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8405 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8407 unsigned int gpiostate, gpiomask, gpiodir;
8409 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8410 AC_VERB_GET_GPIO_DATA, 0);
8413 gpiostate |= (1 << pin);
8415 gpiostate &= ~(1 << pin);
8417 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8418 AC_VERB_GET_GPIO_MASK, 0);
8419 gpiomask |= (1 << pin);
8421 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8422 AC_VERB_GET_GPIO_DIRECTION, 0);
8423 gpiodir |= (1 << pin);
8426 snd_hda_codec_write(codec, codec->afg, 0,
8427 AC_VERB_SET_GPIO_MASK, gpiomask);
8428 snd_hda_codec_write(codec, codec->afg, 0,
8429 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8433 snd_hda_codec_write(codec, codec->afg, 0,
8434 AC_VERB_SET_GPIO_DATA, gpiostate);
8437 /* set up GPIO at initialization */
8438 static void alc885_macpro_init_hook(struct hda_codec *codec)
8440 alc882_gpio_mute(codec, 0, 0);
8441 alc882_gpio_mute(codec, 1, 0);
8444 /* set up GPIO and update auto-muting at initialization */
8445 static void alc885_imac24_init_hook(struct hda_codec *codec)
8447 alc885_macpro_init_hook(codec);
8448 alc_automute_amp(codec);
8452 * generic initialization of ADC, input mixers and output mixers
8454 static struct hda_verb alc883_auto_init_verbs[] = {
8456 * Unmute ADC0-2 and set the default input to mic-in
8458 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8460 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8464 * Set up output mixers (0x0c - 0x0f)
8466 /* set vol=0 to output mixers */
8467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8471 /* set up input amps for analog loopback */
8472 /* Amp Indices: DAC = 0, mixer = 1 */
8473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8478 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8479 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8480 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8481 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8484 /* FIXME: use matrix-type input source selection */
8485 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8487 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8493 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8494 static struct hda_verb alc889A_mb31_ch2_init[] = {
8495 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8496 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8497 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8498 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8502 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8503 static struct hda_verb alc889A_mb31_ch4_init[] = {
8504 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8505 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8511 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8512 static struct hda_verb alc889A_mb31_ch5_init[] = {
8513 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8520 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8521 static struct hda_verb alc889A_mb31_ch6_init[] = {
8522 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8523 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8529 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8530 { 2, alc889A_mb31_ch2_init },
8531 { 4, alc889A_mb31_ch4_init },
8532 { 5, alc889A_mb31_ch5_init },
8533 { 6, alc889A_mb31_ch6_init },
8536 static struct hda_verb alc883_medion_eapd_verbs[] = {
8537 /* eanable EAPD on medion laptop */
8538 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8539 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8543 #define alc883_base_mixer alc882_base_mixer
8545 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8546 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8547 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8548 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8549 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8550 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8551 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8552 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8553 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8555 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8556 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8557 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8562 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8563 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8564 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8565 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8566 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8568 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8569 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8570 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8571 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8572 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8576 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8577 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8578 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8579 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8580 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8581 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8582 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8584 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8585 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8586 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8590 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8591 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8592 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8594 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8595 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8596 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8597 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8599 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8600 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8601 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8602 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8603 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8607 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8608 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8609 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8610 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8611 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8612 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8613 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8614 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8615 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8616 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8617 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8618 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8619 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8620 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8622 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8624 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8625 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8626 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8630 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8631 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8632 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8633 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8634 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8635 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8637 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8638 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8639 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8640 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8641 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8642 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8643 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8644 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8646 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8647 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8648 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8649 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8650 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8654 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8655 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8656 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8658 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8661 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8662 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8663 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8664 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8665 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8668 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8670 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8673 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8674 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8678 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8679 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8680 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8681 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8682 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8683 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8684 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8685 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8686 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8688 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8689 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8690 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8691 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8693 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8695 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8696 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8697 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8701 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8702 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8703 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8705 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8706 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8707 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8708 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8709 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8710 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8711 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8712 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8713 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8714 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8715 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8717 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8718 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8722 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8723 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8724 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8725 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8726 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8727 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8728 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8729 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8730 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8732 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8733 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8734 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8738 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8739 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8740 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8741 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8742 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8743 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8747 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8748 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8749 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8750 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8751 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8754 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8759 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8760 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8761 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8763 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8764 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8765 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8767 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8768 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8772 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8773 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8774 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8775 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8776 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8777 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8780 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8781 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8785 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8788 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8789 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8790 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8791 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8795 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8796 /* Unmute front mixer */
8797 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8800 /* Set speaker pin to front mixer */
8801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8803 /* Init headphone pin */
8804 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8806 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8807 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8812 /* toggle speaker-output according to the hp-jack state */
8813 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8815 struct alc_spec *spec = codec->spec;
8817 spec->autocfg.hp_pins[0] = 0x1a;
8818 spec->autocfg.speaker_pins[0] = 0x15;
8821 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8822 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8823 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8825 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8826 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8827 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8828 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8829 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8833 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8834 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8835 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8836 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8837 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8838 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8839 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8840 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8841 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8846 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8847 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8848 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8849 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8850 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8851 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8852 0x0d, 1, 0x0, HDA_OUTPUT),
8853 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8854 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8855 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8856 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8857 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8858 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8859 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8861 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8864 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8866 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8867 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8871 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8873 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8874 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8875 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8876 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8877 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8879 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8880 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8881 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8882 /* Output switches */
8883 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8884 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8885 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8887 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8888 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8893 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8897 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8898 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8899 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8901 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8902 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8907 static struct hda_bind_ctls alc883_bind_cap_vol = {
8908 .ops = &snd_hda_bind_vol,
8910 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8911 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8916 static struct hda_bind_ctls alc883_bind_cap_switch = {
8917 .ops = &snd_hda_bind_sw,
8919 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8920 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8925 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8926 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8927 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8929 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8930 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8932 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8933 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8937 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8938 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8939 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8941 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8942 /* .name = "Capture Source", */
8943 .name = "Input Source",
8945 .info = alc_mux_enum_info,
8946 .get = alc_mux_enum_get,
8947 .put = alc_mux_enum_put,
8952 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8954 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8955 .name = "Channel Mode",
8956 .info = alc_ch_mode_info,
8957 .get = alc_ch_mode_get,
8958 .put = alc_ch_mode_put,
8963 /* toggle speaker-output according to the hp-jack state */
8964 static void alc883_mitac_setup(struct hda_codec *codec)
8966 struct alc_spec *spec = codec->spec;
8968 spec->autocfg.hp_pins[0] = 0x15;
8969 spec->autocfg.speaker_pins[0] = 0x14;
8970 spec->autocfg.speaker_pins[1] = 0x17;
8973 /* auto-toggle front mic */
8975 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8977 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8979 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8983 static struct hda_verb alc883_mitac_verbs[] = {
8985 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8988 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8989 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8991 /* enable unsolicited event */
8992 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8993 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8998 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9000 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9001 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9003 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9005 /* enable unsolicited event */
9007 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9008 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9014 static struct hda_verb alc883_clevo_m720_verbs[] = {
9016 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9017 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9019 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9022 /* enable unsolicited event */
9023 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9024 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9029 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9031 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9034 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9035 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9037 /* enable unsolicited event */
9038 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9043 static struct hda_verb alc883_targa_verbs[] = {
9044 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9050 /* Connect Line-Out side jack (SPDIF) to Side */
9051 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9052 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9053 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9054 /* Connect Mic jack to CLFE */
9055 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9056 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9057 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9058 /* Connect Line-in jack to Surround */
9059 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9060 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9061 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9062 /* Connect HP out jack to Front */
9063 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9064 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9065 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9067 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9072 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9074 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9075 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9079 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9080 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9082 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9083 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9087 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9090 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9091 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9092 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9096 static struct hda_verb alc883_haier_w66_verbs[] = {
9097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9100 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9102 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9103 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9104 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9105 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9109 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9110 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9115 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9116 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9117 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9121 static struct hda_verb alc888_6st_dell_verbs[] = {
9122 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9126 static struct hda_verb alc883_vaiott_verbs[] = {
9128 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9131 /* enable unsolicited event */
9132 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9137 static void alc888_3st_hp_setup(struct hda_codec *codec)
9139 struct alc_spec *spec = codec->spec;
9141 spec->autocfg.hp_pins[0] = 0x1b;
9142 spec->autocfg.speaker_pins[0] = 0x14;
9143 spec->autocfg.speaker_pins[1] = 0x16;
9144 spec->autocfg.speaker_pins[2] = 0x18;
9147 static struct hda_verb alc888_3st_hp_verbs[] = {
9148 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9149 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9150 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9151 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9158 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9159 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9160 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9161 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9162 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9169 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9170 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9171 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9172 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9173 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9174 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9181 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9182 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9183 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9184 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9185 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9186 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9187 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9191 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9192 { 2, alc888_3st_hp_2ch_init },
9193 { 4, alc888_3st_hp_4ch_init },
9194 { 6, alc888_3st_hp_6ch_init },
9197 /* toggle front-jack and RCA according to the hp-jack state */
9198 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9200 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9202 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9203 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9204 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9205 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9208 /* toggle RCA according to the front-jack state */
9209 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9211 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9213 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9214 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9217 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9220 if ((res >> 26) == ALC880_HP_EVENT)
9221 alc888_lenovo_ms7195_front_automute(codec);
9222 if ((res >> 26) == ALC880_FRONT_EVENT)
9223 alc888_lenovo_ms7195_rca_automute(codec);
9226 static struct hda_verb alc883_medion_md2_verbs[] = {
9227 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9228 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9230 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9232 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9236 /* toggle speaker-output according to the hp-jack state */
9237 static void alc883_medion_md2_setup(struct hda_codec *codec)
9239 struct alc_spec *spec = codec->spec;
9241 spec->autocfg.hp_pins[0] = 0x14;
9242 spec->autocfg.speaker_pins[0] = 0x15;
9245 /* toggle speaker-output according to the hp-jack state */
9246 #define alc883_targa_init_hook alc882_targa_init_hook
9247 #define alc883_targa_unsol_event alc882_targa_unsol_event
9249 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9251 unsigned int present;
9253 present = snd_hda_jack_detect(codec, 0x18);
9254 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9255 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9258 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9260 struct alc_spec *spec = codec->spec;
9262 spec->autocfg.hp_pins[0] = 0x15;
9263 spec->autocfg.speaker_pins[0] = 0x14;
9266 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9268 alc_automute_amp(codec);
9269 alc883_clevo_m720_mic_automute(codec);
9272 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9275 switch (res >> 26) {
9276 case ALC880_MIC_EVENT:
9277 alc883_clevo_m720_mic_automute(codec);
9280 alc_automute_amp_unsol_event(codec, res);
9285 /* toggle speaker-output according to the hp-jack state */
9286 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9288 struct alc_spec *spec = codec->spec;
9290 spec->autocfg.hp_pins[0] = 0x14;
9291 spec->autocfg.speaker_pins[0] = 0x15;
9294 static void alc883_haier_w66_setup(struct hda_codec *codec)
9296 struct alc_spec *spec = codec->spec;
9298 spec->autocfg.hp_pins[0] = 0x1b;
9299 spec->autocfg.speaker_pins[0] = 0x14;
9302 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9304 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9306 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9307 HDA_AMP_MUTE, bits);
9310 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9312 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9314 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9315 HDA_AMP_MUTE, bits);
9316 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9317 HDA_AMP_MUTE, bits);
9320 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9323 if ((res >> 26) == ALC880_HP_EVENT)
9324 alc883_lenovo_101e_all_automute(codec);
9325 if ((res >> 26) == ALC880_FRONT_EVENT)
9326 alc883_lenovo_101e_ispeaker_automute(codec);
9329 /* toggle speaker-output according to the hp-jack state */
9330 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9332 struct alc_spec *spec = codec->spec;
9334 spec->autocfg.hp_pins[0] = 0x14;
9335 spec->autocfg.speaker_pins[0] = 0x15;
9336 spec->autocfg.speaker_pins[1] = 0x16;
9339 static struct hda_verb alc883_acer_eapd_verbs[] = {
9340 /* HP Pin: output 0 (0x0c) */
9341 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9342 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9343 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9344 /* Front Pin: output 0 (0x0c) */
9345 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9346 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9347 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9348 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9349 /* eanable EAPD on medion laptop */
9350 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9351 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9352 /* enable unsolicited event */
9353 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9357 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9358 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9359 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9364 static void alc888_6st_dell_setup(struct hda_codec *codec)
9366 struct alc_spec *spec = codec->spec;
9368 spec->autocfg.hp_pins[0] = 0x1b;
9369 spec->autocfg.speaker_pins[0] = 0x14;
9370 spec->autocfg.speaker_pins[1] = 0x15;
9371 spec->autocfg.speaker_pins[2] = 0x16;
9372 spec->autocfg.speaker_pins[3] = 0x17;
9375 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9377 struct alc_spec *spec = codec->spec;
9379 spec->autocfg.hp_pins[0] = 0x1b;
9380 spec->autocfg.speaker_pins[0] = 0x14;
9381 spec->autocfg.speaker_pins[1] = 0x15;
9382 spec->autocfg.speaker_pins[2] = 0x16;
9383 spec->autocfg.speaker_pins[3] = 0x17;
9384 spec->autocfg.speaker_pins[4] = 0x1a;
9387 static void alc883_vaiott_setup(struct hda_codec *codec)
9389 struct alc_spec *spec = codec->spec;
9391 spec->autocfg.hp_pins[0] = 0x15;
9392 spec->autocfg.speaker_pins[0] = 0x14;
9393 spec->autocfg.speaker_pins[1] = 0x17;
9396 static struct hda_verb alc888_asus_m90v_verbs[] = {
9397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9399 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9400 /* enable unsolicited event */
9401 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9406 static void alc883_mode2_setup(struct hda_codec *codec)
9408 struct alc_spec *spec = codec->spec;
9410 spec->autocfg.hp_pins[0] = 0x1b;
9411 spec->autocfg.speaker_pins[0] = 0x14;
9412 spec->autocfg.speaker_pins[1] = 0x15;
9413 spec->autocfg.speaker_pins[2] = 0x16;
9414 spec->ext_mic.pin = 0x18;
9415 spec->int_mic.pin = 0x19;
9416 spec->ext_mic.mux_idx = 0;
9417 spec->int_mic.mux_idx = 1;
9421 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9422 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9423 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9427 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9428 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9429 /* enable unsolicited event */
9430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9434 static void alc883_eee1601_inithook(struct hda_codec *codec)
9436 struct alc_spec *spec = codec->spec;
9438 spec->autocfg.hp_pins[0] = 0x14;
9439 spec->autocfg.speaker_pins[0] = 0x1b;
9440 alc_automute_pin(codec);
9443 static struct hda_verb alc889A_mb31_verbs[] = {
9444 /* Init rear pin (used as headphone output) */
9445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9446 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9447 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9448 /* Init line pin (used as output in 4ch and 6ch mode) */
9449 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9450 /* Init line 2 pin (used as headphone out by default) */
9451 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9452 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9456 /* Mute speakers according to the headphone jack state */
9457 static void alc889A_mb31_automute(struct hda_codec *codec)
9459 unsigned int present;
9461 /* Mute only in 2ch or 4ch mode */
9462 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9464 present = snd_hda_jack_detect(codec, 0x15);
9465 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9466 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9467 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9468 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9472 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9474 if ((res >> 26) == ALC880_HP_EVENT)
9475 alc889A_mb31_automute(codec);
9479 #ifdef CONFIG_SND_HDA_POWER_SAVE
9480 #define alc882_loopbacks alc880_loopbacks
9483 /* pcm configuration: identical with ALC880 */
9484 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9485 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9486 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9487 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9489 static hda_nid_t alc883_slave_dig_outs[] = {
9490 ALC1200_DIGOUT_NID, 0,
9493 static hda_nid_t alc1200_slave_dig_outs[] = {
9494 ALC883_DIGOUT_NID, 0,
9498 * configuration and preset
9500 static const char *alc882_models[ALC882_MODEL_LAST] = {
9501 [ALC882_3ST_DIG] = "3stack-dig",
9502 [ALC882_6ST_DIG] = "6stack-dig",
9503 [ALC882_ARIMA] = "arima",
9504 [ALC882_W2JC] = "w2jc",
9505 [ALC882_TARGA] = "targa",
9506 [ALC882_ASUS_A7J] = "asus-a7j",
9507 [ALC882_ASUS_A7M] = "asus-a7m",
9508 [ALC885_MACPRO] = "macpro",
9509 [ALC885_MB5] = "mb5",
9510 [ALC885_MACMINI3] = "macmini3",
9511 [ALC885_MBA21] = "mba21",
9512 [ALC885_MBP3] = "mbp3",
9513 [ALC885_IMAC24] = "imac24",
9514 [ALC885_IMAC91] = "imac91",
9515 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9516 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9517 [ALC883_3ST_6ch] = "3stack-6ch",
9518 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9519 [ALC883_TARGA_DIG] = "targa-dig",
9520 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9521 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9522 [ALC883_ACER] = "acer",
9523 [ALC883_ACER_ASPIRE] = "acer-aspire",
9524 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9525 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9526 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9527 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9528 [ALC883_MEDION] = "medion",
9529 [ALC883_MEDION_MD2] = "medion-md2",
9530 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9531 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9532 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9533 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9534 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9535 [ALC888_LENOVO_SKY] = "lenovo-sky",
9536 [ALC883_HAIER_W66] = "haier-w66",
9537 [ALC888_3ST_HP] = "3stack-hp",
9538 [ALC888_6ST_DELL] = "6stack-dell",
9539 [ALC883_MITAC] = "mitac",
9540 [ALC883_CLEVO_M540R] = "clevo-m540r",
9541 [ALC883_CLEVO_M720] = "clevo-m720",
9542 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9543 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9544 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9545 [ALC889A_INTEL] = "intel-alc889a",
9546 [ALC889_INTEL] = "intel-x58",
9547 [ALC1200_ASUS_P5Q] = "asus-p5q",
9548 [ALC889A_MB31] = "mb31",
9549 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9550 [ALC882_AUTO] = "auto",
9553 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9554 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9556 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9557 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9558 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9559 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9560 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9561 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9562 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9563 ALC888_ACER_ASPIRE_4930G),
9564 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9565 ALC888_ACER_ASPIRE_4930G),
9566 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9567 ALC888_ACER_ASPIRE_8930G),
9568 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9569 ALC888_ACER_ASPIRE_8930G),
9570 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9571 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9572 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9573 ALC888_ACER_ASPIRE_6530G),
9574 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9575 ALC888_ACER_ASPIRE_6530G),
9576 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9577 ALC888_ACER_ASPIRE_7730G),
9578 /* default Acer -- disabled as it causes more problems.
9579 * model=auto should work fine now
9581 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9583 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9585 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9586 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9587 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9588 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9589 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9590 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9592 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9593 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9594 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9595 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9596 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9597 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9598 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9599 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9600 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9601 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9602 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9604 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9605 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9606 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9607 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9608 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9609 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9610 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9611 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9612 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9614 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9615 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9616 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9617 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9618 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9619 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9620 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9621 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9622 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9623 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9624 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9625 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9626 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9627 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9628 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9629 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9630 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9631 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9632 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9633 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9634 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9635 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9636 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9637 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9638 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9639 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9640 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9641 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9642 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9643 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9644 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9646 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9647 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9648 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9649 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9650 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9651 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9652 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9653 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9654 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9655 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9656 ALC883_FUJITSU_PI2515),
9657 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9658 ALC888_FUJITSU_XA3530),
9659 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9660 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9661 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9662 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9663 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9664 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9665 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9666 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9667 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9669 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9670 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9671 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9672 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9673 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9674 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9675 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9680 /* codec SSID table for Intel Mac */
9681 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9682 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9683 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9684 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9685 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9686 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9687 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9688 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9689 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9690 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9691 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9692 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9693 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9694 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9695 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9696 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9697 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9698 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9699 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9700 * so apparently no perfect solution yet
9702 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9703 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9704 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9708 static struct alc_config_preset alc882_presets[] = {
9709 [ALC882_3ST_DIG] = {
9710 .mixers = { alc882_base_mixer },
9711 .init_verbs = { alc882_base_init_verbs,
9712 alc882_adc1_init_verbs },
9713 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9714 .dac_nids = alc882_dac_nids,
9715 .dig_out_nid = ALC882_DIGOUT_NID,
9716 .dig_in_nid = ALC882_DIGIN_NID,
9717 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9718 .channel_mode = alc882_ch_modes,
9720 .input_mux = &alc882_capture_source,
9722 [ALC882_6ST_DIG] = {
9723 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9724 .init_verbs = { alc882_base_init_verbs,
9725 alc882_adc1_init_verbs },
9726 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9727 .dac_nids = alc882_dac_nids,
9728 .dig_out_nid = ALC882_DIGOUT_NID,
9729 .dig_in_nid = ALC882_DIGIN_NID,
9730 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9731 .channel_mode = alc882_sixstack_modes,
9732 .input_mux = &alc882_capture_source,
9735 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9736 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9737 alc882_eapd_verbs },
9738 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9739 .dac_nids = alc882_dac_nids,
9740 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9741 .channel_mode = alc882_sixstack_modes,
9742 .input_mux = &alc882_capture_source,
9745 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9746 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9747 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9748 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9749 .dac_nids = alc882_dac_nids,
9750 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9751 .channel_mode = alc880_threestack_modes,
9753 .input_mux = &alc882_capture_source,
9754 .dig_out_nid = ALC882_DIGOUT_NID,
9757 .mixers = { alc885_mba21_mixer },
9758 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9760 .dac_nids = alc882_dac_nids,
9761 .channel_mode = alc885_mba21_ch_modes,
9762 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9763 .input_mux = &alc882_capture_source,
9764 .unsol_event = alc_automute_amp_unsol_event,
9765 .setup = alc885_mba21_setup,
9766 .init_hook = alc_automute_amp,
9769 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9770 .init_verbs = { alc885_mbp3_init_verbs,
9771 alc880_gpio1_init_verbs },
9773 .dac_nids = alc882_dac_nids,
9775 .channel_mode = alc885_mbp_4ch_modes,
9776 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9777 .input_mux = &alc882_capture_source,
9778 .dig_out_nid = ALC882_DIGOUT_NID,
9779 .dig_in_nid = ALC882_DIGIN_NID,
9780 .unsol_event = alc_automute_amp_unsol_event,
9781 .setup = alc885_mbp3_setup,
9782 .init_hook = alc_automute_amp,
9785 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9786 .init_verbs = { alc885_mb5_init_verbs,
9787 alc880_gpio1_init_verbs },
9788 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9789 .dac_nids = alc882_dac_nids,
9790 .channel_mode = alc885_mb5_6ch_modes,
9791 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9792 .input_mux = &mb5_capture_source,
9793 .dig_out_nid = ALC882_DIGOUT_NID,
9794 .dig_in_nid = ALC882_DIGIN_NID,
9795 .unsol_event = alc_automute_amp_unsol_event,
9796 .setup = alc885_mb5_setup,
9797 .init_hook = alc_automute_amp,
9799 [ALC885_MACMINI3] = {
9800 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9801 .init_verbs = { alc885_macmini3_init_verbs,
9802 alc880_gpio1_init_verbs },
9803 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9804 .dac_nids = alc882_dac_nids,
9805 .channel_mode = alc885_macmini3_6ch_modes,
9806 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9807 .input_mux = &macmini3_capture_source,
9808 .dig_out_nid = ALC882_DIGOUT_NID,
9809 .dig_in_nid = ALC882_DIGIN_NID,
9810 .unsol_event = alc_automute_amp_unsol_event,
9811 .setup = alc885_macmini3_setup,
9812 .init_hook = alc_automute_amp,
9815 .mixers = { alc882_macpro_mixer },
9816 .init_verbs = { alc882_macpro_init_verbs },
9817 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9818 .dac_nids = alc882_dac_nids,
9819 .dig_out_nid = ALC882_DIGOUT_NID,
9820 .dig_in_nid = ALC882_DIGIN_NID,
9821 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9822 .channel_mode = alc882_ch_modes,
9823 .input_mux = &alc882_capture_source,
9824 .init_hook = alc885_macpro_init_hook,
9827 .mixers = { alc885_imac24_mixer },
9828 .init_verbs = { alc885_imac24_init_verbs },
9829 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9830 .dac_nids = alc882_dac_nids,
9831 .dig_out_nid = ALC882_DIGOUT_NID,
9832 .dig_in_nid = ALC882_DIGIN_NID,
9833 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9834 .channel_mode = alc882_ch_modes,
9835 .input_mux = &alc882_capture_source,
9836 .unsol_event = alc_automute_amp_unsol_event,
9837 .setup = alc885_imac24_setup,
9838 .init_hook = alc885_imac24_init_hook,
9841 .mixers = {alc885_imac91_mixer},
9842 .init_verbs = { alc885_imac91_init_verbs,
9843 alc880_gpio1_init_verbs },
9844 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9845 .dac_nids = alc882_dac_nids,
9846 .channel_mode = alc885_mba21_ch_modes,
9847 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9848 .input_mux = &alc889A_imac91_capture_source,
9849 .dig_out_nid = ALC882_DIGOUT_NID,
9850 .dig_in_nid = ALC882_DIGIN_NID,
9851 .unsol_event = alc_automute_amp_unsol_event,
9852 .setup = alc885_imac91_setup,
9853 .init_hook = alc_automute_amp,
9856 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9857 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9858 alc880_gpio3_init_verbs, alc882_targa_verbs},
9859 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9860 .dac_nids = alc882_dac_nids,
9861 .dig_out_nid = ALC882_DIGOUT_NID,
9862 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9863 .adc_nids = alc882_adc_nids,
9864 .capsrc_nids = alc882_capsrc_nids,
9865 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9866 .channel_mode = alc882_3ST_6ch_modes,
9868 .input_mux = &alc882_capture_source,
9869 .unsol_event = alc882_targa_unsol_event,
9870 .setup = alc882_targa_setup,
9871 .init_hook = alc882_targa_automute,
9873 [ALC882_ASUS_A7J] = {
9874 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9875 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9876 alc882_asus_a7j_verbs},
9877 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9878 .dac_nids = alc882_dac_nids,
9879 .dig_out_nid = ALC882_DIGOUT_NID,
9880 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9881 .adc_nids = alc882_adc_nids,
9882 .capsrc_nids = alc882_capsrc_nids,
9883 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9884 .channel_mode = alc882_3ST_6ch_modes,
9886 .input_mux = &alc882_capture_source,
9888 [ALC882_ASUS_A7M] = {
9889 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9890 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9891 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9892 alc882_asus_a7m_verbs },
9893 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9894 .dac_nids = alc882_dac_nids,
9895 .dig_out_nid = ALC882_DIGOUT_NID,
9896 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9897 .channel_mode = alc880_threestack_modes,
9899 .input_mux = &alc882_capture_source,
9901 [ALC883_3ST_2ch_DIG] = {
9902 .mixers = { alc883_3ST_2ch_mixer },
9903 .init_verbs = { alc883_init_verbs },
9904 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9905 .dac_nids = alc883_dac_nids,
9906 .dig_out_nid = ALC883_DIGOUT_NID,
9907 .dig_in_nid = ALC883_DIGIN_NID,
9908 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9909 .channel_mode = alc883_3ST_2ch_modes,
9910 .input_mux = &alc883_capture_source,
9912 [ALC883_3ST_6ch_DIG] = {
9913 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9914 .init_verbs = { alc883_init_verbs },
9915 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9916 .dac_nids = alc883_dac_nids,
9917 .dig_out_nid = ALC883_DIGOUT_NID,
9918 .dig_in_nid = ALC883_DIGIN_NID,
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] = {
9925 .mixers = { alc883_3ST_6ch_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 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9930 .channel_mode = alc883_3ST_6ch_modes,
9932 .input_mux = &alc883_capture_source,
9934 [ALC883_3ST_6ch_INTEL] = {
9935 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9936 .init_verbs = { alc883_init_verbs },
9937 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9938 .dac_nids = alc883_dac_nids,
9939 .dig_out_nid = ALC883_DIGOUT_NID,
9940 .dig_in_nid = ALC883_DIGIN_NID,
9941 .slave_dig_outs = alc883_slave_dig_outs,
9942 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9943 .channel_mode = alc883_3ST_6ch_intel_modes,
9945 .input_mux = &alc883_3stack_6ch_intel,
9948 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9949 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9950 alc_hp15_unsol_verbs },
9951 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9952 .dac_nids = alc883_dac_nids,
9953 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9954 .adc_nids = alc889_adc_nids,
9955 .dig_out_nid = ALC883_DIGOUT_NID,
9956 .dig_in_nid = ALC883_DIGIN_NID,
9957 .slave_dig_outs = alc883_slave_dig_outs,
9958 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9959 .channel_mode = alc889_8ch_intel_modes,
9960 .capsrc_nids = alc889_capsrc_nids,
9961 .input_mux = &alc889_capture_source,
9962 .setup = alc889_automute_setup,
9963 .init_hook = alc_automute_amp,
9964 .unsol_event = alc_automute_amp_unsol_event,
9968 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9969 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9970 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9971 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9972 .dac_nids = alc883_dac_nids,
9973 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9974 .adc_nids = alc889_adc_nids,
9975 .dig_out_nid = ALC883_DIGOUT_NID,
9976 .dig_in_nid = ALC883_DIGIN_NID,
9977 .slave_dig_outs = alc883_slave_dig_outs,
9978 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9979 .channel_mode = alc889_8ch_intel_modes,
9980 .capsrc_nids = alc889_capsrc_nids,
9981 .input_mux = &alc889_capture_source,
9982 .setup = alc889_automute_setup,
9983 .init_hook = alc889_intel_init_hook,
9984 .unsol_event = alc_automute_amp_unsol_event,
9987 [ALC883_6ST_DIG] = {
9988 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9989 .init_verbs = { alc883_init_verbs },
9990 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9991 .dac_nids = alc883_dac_nids,
9992 .dig_out_nid = ALC883_DIGOUT_NID,
9993 .dig_in_nid = ALC883_DIGIN_NID,
9994 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9995 .channel_mode = alc883_sixstack_modes,
9996 .input_mux = &alc883_capture_source,
9998 [ALC883_TARGA_DIG] = {
9999 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10000 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10001 alc883_targa_verbs},
10002 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10003 .dac_nids = alc883_dac_nids,
10004 .dig_out_nid = ALC883_DIGOUT_NID,
10005 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10006 .channel_mode = alc883_3ST_6ch_modes,
10008 .input_mux = &alc883_capture_source,
10009 .unsol_event = alc883_targa_unsol_event,
10010 .setup = alc882_targa_setup,
10011 .init_hook = alc882_targa_automute,
10013 [ALC883_TARGA_2ch_DIG] = {
10014 .mixers = { alc883_targa_2ch_mixer},
10015 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10016 alc883_targa_verbs},
10017 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10018 .dac_nids = alc883_dac_nids,
10019 .adc_nids = alc883_adc_nids_alt,
10020 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10021 .capsrc_nids = alc883_capsrc_nids,
10022 .dig_out_nid = ALC883_DIGOUT_NID,
10023 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10024 .channel_mode = alc883_3ST_2ch_modes,
10025 .input_mux = &alc883_capture_source,
10026 .unsol_event = alc883_targa_unsol_event,
10027 .setup = alc882_targa_setup,
10028 .init_hook = alc882_targa_automute,
10030 [ALC883_TARGA_8ch_DIG] = {
10031 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10032 alc883_chmode_mixer },
10033 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10034 alc883_targa_verbs },
10035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10036 .dac_nids = alc883_dac_nids,
10037 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10038 .adc_nids = alc883_adc_nids_rev,
10039 .capsrc_nids = alc883_capsrc_nids_rev,
10040 .dig_out_nid = ALC883_DIGOUT_NID,
10041 .dig_in_nid = ALC883_DIGIN_NID,
10042 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10043 .channel_mode = alc883_4ST_8ch_modes,
10045 .input_mux = &alc883_capture_source,
10046 .unsol_event = alc883_targa_unsol_event,
10047 .setup = alc882_targa_setup,
10048 .init_hook = alc882_targa_automute,
10051 .mixers = { alc883_base_mixer },
10052 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10053 * and the headphone jack. Turn this on and rely on the
10054 * standard mute methods whenever the user wants to turn
10055 * these outputs off.
10057 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10058 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10059 .dac_nids = alc883_dac_nids,
10060 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10061 .channel_mode = alc883_3ST_2ch_modes,
10062 .input_mux = &alc883_capture_source,
10064 [ALC883_ACER_ASPIRE] = {
10065 .mixers = { alc883_acer_aspire_mixer },
10066 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10067 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10068 .dac_nids = alc883_dac_nids,
10069 .dig_out_nid = ALC883_DIGOUT_NID,
10070 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10071 .channel_mode = alc883_3ST_2ch_modes,
10072 .input_mux = &alc883_capture_source,
10073 .unsol_event = alc_automute_amp_unsol_event,
10074 .setup = alc883_acer_aspire_setup,
10075 .init_hook = alc_automute_amp,
10077 [ALC888_ACER_ASPIRE_4930G] = {
10078 .mixers = { alc888_base_mixer,
10079 alc883_chmode_mixer },
10080 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10081 alc888_acer_aspire_4930g_verbs },
10082 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10083 .dac_nids = alc883_dac_nids,
10084 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10085 .adc_nids = alc883_adc_nids_rev,
10086 .capsrc_nids = alc883_capsrc_nids_rev,
10087 .dig_out_nid = ALC883_DIGOUT_NID,
10088 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10089 .channel_mode = alc883_3ST_6ch_modes,
10091 .const_channel_count = 6,
10093 ARRAY_SIZE(alc888_2_capture_sources),
10094 .input_mux = alc888_2_capture_sources,
10095 .unsol_event = alc_automute_amp_unsol_event,
10096 .setup = alc888_acer_aspire_4930g_setup,
10097 .init_hook = alc_automute_amp,
10099 [ALC888_ACER_ASPIRE_6530G] = {
10100 .mixers = { alc888_acer_aspire_6530_mixer },
10101 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10102 alc888_acer_aspire_6530g_verbs },
10103 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10104 .dac_nids = alc883_dac_nids,
10105 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10106 .adc_nids = alc883_adc_nids_rev,
10107 .capsrc_nids = alc883_capsrc_nids_rev,
10108 .dig_out_nid = ALC883_DIGOUT_NID,
10109 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10110 .channel_mode = alc883_3ST_2ch_modes,
10112 ARRAY_SIZE(alc888_2_capture_sources),
10113 .input_mux = alc888_acer_aspire_6530_sources,
10114 .unsol_event = alc_automute_amp_unsol_event,
10115 .setup = alc888_acer_aspire_6530g_setup,
10116 .init_hook = alc_automute_amp,
10118 [ALC888_ACER_ASPIRE_8930G] = {
10119 .mixers = { alc889_acer_aspire_8930g_mixer,
10120 alc883_chmode_mixer },
10121 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10122 alc889_acer_aspire_8930g_verbs,
10123 alc889_eapd_verbs},
10124 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10125 .dac_nids = alc883_dac_nids,
10126 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10127 .adc_nids = alc889_adc_nids,
10128 .capsrc_nids = alc889_capsrc_nids,
10129 .dig_out_nid = ALC883_DIGOUT_NID,
10130 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10131 .channel_mode = alc883_3ST_6ch_modes,
10133 .const_channel_count = 6,
10135 ARRAY_SIZE(alc889_capture_sources),
10136 .input_mux = alc889_capture_sources,
10137 .unsol_event = alc_automute_amp_unsol_event,
10138 .setup = alc889_acer_aspire_8930g_setup,
10139 .init_hook = alc_automute_amp,
10140 #ifdef CONFIG_SND_HDA_POWER_SAVE
10141 .power_hook = alc_power_eapd,
10144 [ALC888_ACER_ASPIRE_7730G] = {
10145 .mixers = { alc883_3ST_6ch_mixer,
10146 alc883_chmode_mixer },
10147 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10148 alc888_acer_aspire_7730G_verbs },
10149 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10150 .dac_nids = alc883_dac_nids,
10151 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10152 .adc_nids = alc883_adc_nids_rev,
10153 .capsrc_nids = alc883_capsrc_nids_rev,
10154 .dig_out_nid = ALC883_DIGOUT_NID,
10155 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10156 .channel_mode = alc883_3ST_6ch_modes,
10158 .const_channel_count = 6,
10159 .input_mux = &alc883_capture_source,
10160 .unsol_event = alc_automute_amp_unsol_event,
10161 .setup = alc888_acer_aspire_6530g_setup,
10162 .init_hook = alc_automute_amp,
10164 [ALC883_MEDION] = {
10165 .mixers = { alc883_fivestack_mixer,
10166 alc883_chmode_mixer },
10167 .init_verbs = { alc883_init_verbs,
10168 alc883_medion_eapd_verbs },
10169 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10170 .dac_nids = alc883_dac_nids,
10171 .adc_nids = alc883_adc_nids_alt,
10172 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10173 .capsrc_nids = alc883_capsrc_nids,
10174 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10175 .channel_mode = alc883_sixstack_modes,
10176 .input_mux = &alc883_capture_source,
10178 [ALC883_MEDION_MD2] = {
10179 .mixers = { alc883_medion_md2_mixer},
10180 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10181 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10182 .dac_nids = alc883_dac_nids,
10183 .dig_out_nid = ALC883_DIGOUT_NID,
10184 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10185 .channel_mode = alc883_3ST_2ch_modes,
10186 .input_mux = &alc883_capture_source,
10187 .unsol_event = alc_automute_amp_unsol_event,
10188 .setup = alc883_medion_md2_setup,
10189 .init_hook = alc_automute_amp,
10191 [ALC883_MEDION_WIM2160] = {
10192 .mixers = { alc883_medion_wim2160_mixer },
10193 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10194 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10195 .dac_nids = alc883_dac_nids,
10196 .dig_out_nid = ALC883_DIGOUT_NID,
10197 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10198 .adc_nids = alc883_adc_nids,
10199 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10200 .channel_mode = alc883_3ST_2ch_modes,
10201 .input_mux = &alc883_capture_source,
10202 .unsol_event = alc_automute_amp_unsol_event,
10203 .setup = alc883_medion_wim2160_setup,
10204 .init_hook = alc_automute_amp,
10206 [ALC883_LAPTOP_EAPD] = {
10207 .mixers = { alc883_base_mixer },
10208 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10209 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10210 .dac_nids = alc883_dac_nids,
10211 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10212 .channel_mode = alc883_3ST_2ch_modes,
10213 .input_mux = &alc883_capture_source,
10215 [ALC883_CLEVO_M540R] = {
10216 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10217 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10218 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10219 .dac_nids = alc883_dac_nids,
10220 .dig_out_nid = ALC883_DIGOUT_NID,
10221 .dig_in_nid = ALC883_DIGIN_NID,
10222 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10223 .channel_mode = alc883_3ST_6ch_clevo_modes,
10225 .input_mux = &alc883_capture_source,
10226 /* This machine has the hardware HP auto-muting, thus
10227 * we need no software mute via unsol event
10230 [ALC883_CLEVO_M720] = {
10231 .mixers = { alc883_clevo_m720_mixer },
10232 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10233 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10234 .dac_nids = alc883_dac_nids,
10235 .dig_out_nid = ALC883_DIGOUT_NID,
10236 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10237 .channel_mode = alc883_3ST_2ch_modes,
10238 .input_mux = &alc883_capture_source,
10239 .unsol_event = alc883_clevo_m720_unsol_event,
10240 .setup = alc883_clevo_m720_setup,
10241 .init_hook = alc883_clevo_m720_init_hook,
10243 [ALC883_LENOVO_101E_2ch] = {
10244 .mixers = { alc883_lenovo_101e_2ch_mixer},
10245 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10246 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10247 .dac_nids = alc883_dac_nids,
10248 .adc_nids = alc883_adc_nids_alt,
10249 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10250 .capsrc_nids = alc883_capsrc_nids,
10251 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10252 .channel_mode = alc883_3ST_2ch_modes,
10253 .input_mux = &alc883_lenovo_101e_capture_source,
10254 .unsol_event = alc883_lenovo_101e_unsol_event,
10255 .init_hook = alc883_lenovo_101e_all_automute,
10257 [ALC883_LENOVO_NB0763] = {
10258 .mixers = { alc883_lenovo_nb0763_mixer },
10259 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10260 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10261 .dac_nids = alc883_dac_nids,
10262 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10263 .channel_mode = alc883_3ST_2ch_modes,
10265 .input_mux = &alc883_lenovo_nb0763_capture_source,
10266 .unsol_event = alc_automute_amp_unsol_event,
10267 .setup = alc883_medion_md2_setup,
10268 .init_hook = alc_automute_amp,
10270 [ALC888_LENOVO_MS7195_DIG] = {
10271 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10272 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10274 .dac_nids = alc883_dac_nids,
10275 .dig_out_nid = ALC883_DIGOUT_NID,
10276 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10277 .channel_mode = alc883_3ST_6ch_modes,
10279 .input_mux = &alc883_capture_source,
10280 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10281 .init_hook = alc888_lenovo_ms7195_front_automute,
10283 [ALC883_HAIER_W66] = {
10284 .mixers = { alc883_targa_2ch_mixer},
10285 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10287 .dac_nids = alc883_dac_nids,
10288 .dig_out_nid = ALC883_DIGOUT_NID,
10289 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10290 .channel_mode = alc883_3ST_2ch_modes,
10291 .input_mux = &alc883_capture_source,
10292 .unsol_event = alc_automute_amp_unsol_event,
10293 .setup = alc883_haier_w66_setup,
10294 .init_hook = alc_automute_amp,
10296 [ALC888_3ST_HP] = {
10297 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10298 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10299 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10300 .dac_nids = alc883_dac_nids,
10301 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10302 .channel_mode = alc888_3st_hp_modes,
10304 .input_mux = &alc883_capture_source,
10305 .unsol_event = alc_automute_amp_unsol_event,
10306 .setup = alc888_3st_hp_setup,
10307 .init_hook = alc_automute_amp,
10309 [ALC888_6ST_DELL] = {
10310 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10311 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10312 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10313 .dac_nids = alc883_dac_nids,
10314 .dig_out_nid = ALC883_DIGOUT_NID,
10315 .dig_in_nid = ALC883_DIGIN_NID,
10316 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10317 .channel_mode = alc883_sixstack_modes,
10318 .input_mux = &alc883_capture_source,
10319 .unsol_event = alc_automute_amp_unsol_event,
10320 .setup = alc888_6st_dell_setup,
10321 .init_hook = alc_automute_amp,
10324 .mixers = { alc883_mitac_mixer },
10325 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10327 .dac_nids = alc883_dac_nids,
10328 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10329 .channel_mode = alc883_3ST_2ch_modes,
10330 .input_mux = &alc883_capture_source,
10331 .unsol_event = alc_automute_amp_unsol_event,
10332 .setup = alc883_mitac_setup,
10333 .init_hook = alc_automute_amp,
10335 [ALC883_FUJITSU_PI2515] = {
10336 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10337 .init_verbs = { alc883_init_verbs,
10338 alc883_2ch_fujitsu_pi2515_verbs},
10339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10340 .dac_nids = alc883_dac_nids,
10341 .dig_out_nid = ALC883_DIGOUT_NID,
10342 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10343 .channel_mode = alc883_3ST_2ch_modes,
10344 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10345 .unsol_event = alc_automute_amp_unsol_event,
10346 .setup = alc883_2ch_fujitsu_pi2515_setup,
10347 .init_hook = alc_automute_amp,
10349 [ALC888_FUJITSU_XA3530] = {
10350 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10351 .init_verbs = { alc883_init_verbs,
10352 alc888_fujitsu_xa3530_verbs },
10353 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10354 .dac_nids = alc883_dac_nids,
10355 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10356 .adc_nids = alc883_adc_nids_rev,
10357 .capsrc_nids = alc883_capsrc_nids_rev,
10358 .dig_out_nid = ALC883_DIGOUT_NID,
10359 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10360 .channel_mode = alc888_4ST_8ch_intel_modes,
10362 ARRAY_SIZE(alc888_2_capture_sources),
10363 .input_mux = alc888_2_capture_sources,
10364 .unsol_event = alc_automute_amp_unsol_event,
10365 .setup = alc888_fujitsu_xa3530_setup,
10366 .init_hook = alc_automute_amp,
10368 [ALC888_LENOVO_SKY] = {
10369 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10370 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10371 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10372 .dac_nids = alc883_dac_nids,
10373 .dig_out_nid = ALC883_DIGOUT_NID,
10374 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10375 .channel_mode = alc883_sixstack_modes,
10377 .input_mux = &alc883_lenovo_sky_capture_source,
10378 .unsol_event = alc_automute_amp_unsol_event,
10379 .setup = alc888_lenovo_sky_setup,
10380 .init_hook = alc_automute_amp,
10382 [ALC888_ASUS_M90V] = {
10383 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10384 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10385 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10386 .dac_nids = alc883_dac_nids,
10387 .dig_out_nid = ALC883_DIGOUT_NID,
10388 .dig_in_nid = ALC883_DIGIN_NID,
10389 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10390 .channel_mode = alc883_3ST_6ch_modes,
10392 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10393 .unsol_event = alc_sku_unsol_event,
10394 .setup = alc883_mode2_setup,
10395 .init_hook = alc_inithook,
10397 [ALC888_ASUS_EEE1601] = {
10398 .mixers = { alc883_asus_eee1601_mixer },
10399 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10400 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10401 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10402 .dac_nids = alc883_dac_nids,
10403 .dig_out_nid = ALC883_DIGOUT_NID,
10404 .dig_in_nid = ALC883_DIGIN_NID,
10405 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10406 .channel_mode = alc883_3ST_2ch_modes,
10408 .input_mux = &alc883_asus_eee1601_capture_source,
10409 .unsol_event = alc_sku_unsol_event,
10410 .init_hook = alc883_eee1601_inithook,
10412 [ALC1200_ASUS_P5Q] = {
10413 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10414 .init_verbs = { alc883_init_verbs },
10415 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10416 .dac_nids = alc883_dac_nids,
10417 .dig_out_nid = ALC1200_DIGOUT_NID,
10418 .dig_in_nid = ALC883_DIGIN_NID,
10419 .slave_dig_outs = alc1200_slave_dig_outs,
10420 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10421 .channel_mode = alc883_sixstack_modes,
10422 .input_mux = &alc883_capture_source,
10425 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10426 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10427 alc880_gpio1_init_verbs },
10428 .adc_nids = alc883_adc_nids,
10429 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10430 .capsrc_nids = alc883_capsrc_nids,
10431 .dac_nids = alc883_dac_nids,
10432 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10433 .channel_mode = alc889A_mb31_6ch_modes,
10434 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10435 .input_mux = &alc889A_mb31_capture_source,
10436 .dig_out_nid = ALC883_DIGOUT_NID,
10437 .unsol_event = alc889A_mb31_unsol_event,
10438 .init_hook = alc889A_mb31_automute,
10440 [ALC883_SONY_VAIO_TT] = {
10441 .mixers = { alc883_vaiott_mixer },
10442 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10444 .dac_nids = alc883_dac_nids,
10445 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10446 .channel_mode = alc883_3ST_2ch_modes,
10447 .input_mux = &alc883_capture_source,
10448 .unsol_event = alc_automute_amp_unsol_event,
10449 .setup = alc883_vaiott_setup,
10450 .init_hook = alc_automute_amp,
10459 PINFIX_ABIT_AW9D_MAX,
10463 static const struct alc_fixup alc882_fixups[] = {
10464 [PINFIX_ABIT_AW9D_MAX] = {
10465 .pins = (const struct alc_pincfg[]) {
10466 { 0x15, 0x01080104 }, /* side */
10467 { 0x16, 0x01011012 }, /* rear */
10468 { 0x17, 0x01016011 }, /* clfe */
10472 [PINFIX_PB_M5210] = {
10473 .verbs = (const struct hda_verb[]) {
10474 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10480 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10481 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10482 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10487 * BIOS auto configuration
10489 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10490 const struct auto_pin_cfg *cfg)
10492 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10495 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10496 hda_nid_t nid, int pin_type,
10501 /* set as output */
10502 alc_set_pin_output(codec, nid, pin_type);
10506 else if (dac >= 0x02 && dac <= 0x05)
10510 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10513 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10515 struct alc_spec *spec = codec->spec;
10518 for (i = 0; i <= HDA_SIDE; i++) {
10519 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10520 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10522 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10523 spec->multiout.dac_nids[i]);
10527 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10529 struct alc_spec *spec = codec->spec;
10530 hda_nid_t pin, dac;
10532 pin = spec->autocfg.hp_pins[0];
10534 dac = spec->multiout.hp_nid;
10536 dac = spec->multiout.dac_nids[0]; /* to front */
10537 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10539 pin = spec->autocfg.speaker_pins[0];
10541 dac = spec->multiout.extra_out_nid[0];
10543 dac = spec->multiout.dac_nids[0]; /* to front */
10544 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10548 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10550 struct alc_spec *spec = codec->spec;
10551 struct auto_pin_cfg *cfg = &spec->autocfg;
10554 for (i = 0; i < cfg->num_inputs; i++) {
10555 hda_nid_t nid = cfg->inputs[i].pin;
10556 alc_set_input_pin(codec, nid, i);
10557 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10558 snd_hda_codec_write(codec, nid, 0,
10559 AC_VERB_SET_AMP_GAIN_MUTE,
10564 static void alc882_auto_init_input_src(struct hda_codec *codec)
10566 struct alc_spec *spec = codec->spec;
10569 for (c = 0; c < spec->num_adc_nids; c++) {
10570 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10571 hda_nid_t nid = spec->capsrc_nids[c];
10572 unsigned int mux_idx;
10573 const struct hda_input_mux *imux;
10574 int conns, mute, idx, item;
10576 conns = snd_hda_get_connections(codec, nid, conn_list,
10577 ARRAY_SIZE(conn_list));
10580 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10581 imux = &spec->input_mux[mux_idx];
10582 if (!imux->num_items && mux_idx > 0)
10583 imux = &spec->input_mux[0];
10584 for (idx = 0; idx < conns; idx++) {
10585 /* if the current connection is the selected one,
10586 * unmute it as default - otherwise mute it
10588 mute = AMP_IN_MUTE(idx);
10589 for (item = 0; item < imux->num_items; item++) {
10590 if (imux->items[item].index == idx) {
10591 if (spec->cur_mux[c] == item)
10592 mute = AMP_IN_UNMUTE(idx);
10596 /* check if we have a selector or mixer
10597 * we could check for the widget type instead, but
10598 * just check for Amp-In presence (in case of mixer
10599 * without amp-in there is something wrong, this
10600 * function shouldn't be used or capsrc nid is wrong)
10602 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10603 snd_hda_codec_write(codec, nid, 0,
10604 AC_VERB_SET_AMP_GAIN_MUTE,
10606 else if (mute != AMP_IN_MUTE(idx))
10607 snd_hda_codec_write(codec, nid, 0,
10608 AC_VERB_SET_CONNECT_SEL,
10614 /* add mic boosts if needed */
10615 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10617 struct alc_spec *spec = codec->spec;
10618 struct auto_pin_cfg *cfg = &spec->autocfg;
10622 for (i = 0; i < cfg->num_inputs; i++) {
10623 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10625 nid = cfg->inputs[i].pin;
10626 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10628 snprintf(label, sizeof(label), "%s Boost",
10629 hda_get_autocfg_input_label(codec, cfg, i));
10630 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10631 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10639 /* almost identical with ALC880 parser... */
10640 static int alc882_parse_auto_config(struct hda_codec *codec)
10642 struct alc_spec *spec = codec->spec;
10643 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10646 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10650 if (!spec->autocfg.line_outs)
10651 return 0; /* can't find valid BIOS pin config */
10653 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10656 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10659 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10663 err = alc880_auto_create_extra_out(spec,
10664 spec->autocfg.speaker_pins[0],
10668 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10672 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10674 alc_auto_parse_digital(codec);
10676 if (spec->kctls.list)
10677 add_mixer(spec, spec->kctls.list);
10679 add_verb(spec, alc883_auto_init_verbs);
10680 /* if ADC 0x07 is available, initialize it, too */
10681 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10682 add_verb(spec, alc882_adc1_init_verbs);
10684 spec->num_mux_defs = 1;
10685 spec->input_mux = &spec->private_imux[0];
10687 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10689 err = alc_auto_add_mic_boost(codec);
10693 return 1; /* config found */
10696 /* additional initialization for auto-configuration model */
10697 static void alc882_auto_init(struct hda_codec *codec)
10699 struct alc_spec *spec = codec->spec;
10700 alc882_auto_init_multi_out(codec);
10701 alc882_auto_init_hp_out(codec);
10702 alc882_auto_init_analog_input(codec);
10703 alc882_auto_init_input_src(codec);
10704 alc_auto_init_digital(codec);
10705 if (spec->unsol_event)
10706 alc_inithook(codec);
10709 static int patch_alc882(struct hda_codec *codec)
10711 struct alc_spec *spec;
10712 int err, board_config;
10714 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10718 codec->spec = spec;
10720 alc_auto_parse_customize_define(codec);
10722 switch (codec->vendor_id) {
10727 /* ALC883 and variants */
10728 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10732 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10736 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10737 board_config = snd_hda_check_board_codec_sid_config(codec,
10738 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10740 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10741 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10743 board_config = ALC882_AUTO;
10746 if (board_config == ALC882_AUTO)
10747 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10749 if (board_config == ALC882_AUTO) {
10750 /* automatic parse from the BIOS config */
10751 err = alc882_parse_auto_config(codec);
10757 "hda_codec: Cannot set up configuration "
10758 "from BIOS. Using base mode...\n");
10759 board_config = ALC882_3ST_DIG;
10763 if (has_cdefine_beep(codec)) {
10764 err = snd_hda_attach_beep_device(codec, 0x1);
10771 if (board_config != ALC882_AUTO)
10772 setup_preset(codec, &alc882_presets[board_config]);
10774 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10775 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10776 /* FIXME: setup DAC5 */
10777 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10778 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10780 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10781 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10783 if (!spec->adc_nids && spec->input_mux) {
10785 spec->num_adc_nids = 0;
10786 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10787 const struct hda_input_mux *imux = spec->input_mux;
10789 hda_nid_t items[16];
10790 hda_nid_t nid = alc882_adc_nids[i];
10791 unsigned int wcap = get_wcaps(codec, nid);
10793 wcap = get_wcaps_type(wcap);
10794 if (wcap != AC_WID_AUD_IN)
10796 spec->private_adc_nids[spec->num_adc_nids] = nid;
10797 err = snd_hda_get_connections(codec, nid, &cap, 1);
10800 err = snd_hda_get_connections(codec, cap, items,
10801 ARRAY_SIZE(items));
10804 for (j = 0; j < imux->num_items; j++)
10805 if (imux->items[j].index >= err)
10807 if (j < imux->num_items)
10809 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10810 spec->num_adc_nids++;
10812 spec->adc_nids = spec->private_adc_nids;
10813 spec->capsrc_nids = spec->private_capsrc_nids;
10816 set_capture_mixer(codec);
10818 if (has_cdefine_beep(codec))
10819 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10821 if (board_config == ALC882_AUTO)
10822 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10824 spec->vmaster_nid = 0x0c;
10826 codec->patch_ops = alc_patch_ops;
10827 if (board_config == ALC882_AUTO)
10828 spec->init_hook = alc882_auto_init;
10829 #ifdef CONFIG_SND_HDA_POWER_SAVE
10830 if (!spec->loopback.amplist)
10831 spec->loopback.amplist = alc882_loopbacks;
10842 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10843 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10845 #define alc262_dac_nids alc260_dac_nids
10846 #define alc262_adc_nids alc882_adc_nids
10847 #define alc262_adc_nids_alt alc882_adc_nids_alt
10848 #define alc262_capsrc_nids alc882_capsrc_nids
10849 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10851 #define alc262_modes alc260_modes
10852 #define alc262_capture_source alc882_capture_source
10854 static hda_nid_t alc262_dmic_adc_nids[1] = {
10859 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10861 static struct snd_kcontrol_new alc262_base_mixer[] = {
10862 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10863 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10864 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10865 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10866 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10867 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10868 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10869 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10870 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10871 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10872 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10873 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10874 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10875 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10876 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10877 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10881 /* update HP, line and mono-out pins according to the master switch */
10882 static void alc262_hp_master_update(struct hda_codec *codec)
10884 struct alc_spec *spec = codec->spec;
10885 int val = spec->master_sw;
10887 /* HP & line-out */
10888 snd_hda_codec_write_cache(codec, 0x1b, 0,
10889 AC_VERB_SET_PIN_WIDGET_CONTROL,
10891 snd_hda_codec_write_cache(codec, 0x15, 0,
10892 AC_VERB_SET_PIN_WIDGET_CONTROL,
10894 /* mono (speaker) depending on the HP jack sense */
10895 val = val && !spec->jack_present;
10896 snd_hda_codec_write_cache(codec, 0x16, 0,
10897 AC_VERB_SET_PIN_WIDGET_CONTROL,
10898 val ? PIN_OUT : 0);
10901 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10903 struct alc_spec *spec = codec->spec;
10905 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10906 alc262_hp_master_update(codec);
10909 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10911 if ((res >> 26) != ALC880_HP_EVENT)
10913 alc262_hp_bpc_automute(codec);
10916 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10918 struct alc_spec *spec = codec->spec;
10920 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10921 alc262_hp_master_update(codec);
10924 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10927 if ((res >> 26) != ALC880_HP_EVENT)
10929 alc262_hp_wildwest_automute(codec);
10932 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10934 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10935 struct snd_ctl_elem_value *ucontrol)
10937 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10938 struct alc_spec *spec = codec->spec;
10939 int val = !!*ucontrol->value.integer.value;
10941 if (val == spec->master_sw)
10943 spec->master_sw = val;
10944 alc262_hp_master_update(codec);
10948 #define ALC262_HP_MASTER_SWITCH \
10950 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10951 .name = "Master Playback Switch", \
10952 .info = snd_ctl_boolean_mono_info, \
10953 .get = alc262_hp_master_sw_get, \
10954 .put = alc262_hp_master_sw_put, \
10957 .iface = NID_MAPPING, \
10958 .name = "Master Playback Switch", \
10959 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10963 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10964 ALC262_HP_MASTER_SWITCH,
10965 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10966 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10968 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10970 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10974 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10975 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10977 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10978 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10979 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10980 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10981 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10982 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10983 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10987 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10988 ALC262_HP_MASTER_SWITCH,
10989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10990 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10991 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10993 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10995 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10997 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10998 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10999 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11007 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11008 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11009 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11010 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11014 /* mute/unmute internal speaker according to the hp jack and mute state */
11015 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11017 struct alc_spec *spec = codec->spec;
11019 spec->autocfg.hp_pins[0] = 0x15;
11020 spec->autocfg.speaker_pins[0] = 0x14;
11023 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11024 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11025 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11026 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11027 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11028 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11029 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11030 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11034 static struct hda_verb alc262_hp_t5735_verbs[] = {
11035 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11038 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11042 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11043 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11045 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11046 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11047 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11048 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11052 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11053 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11054 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11055 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11056 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11057 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11058 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11066 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11073 /* bind hp and internal speaker mute (with plug check) as master switch */
11074 static void alc262_hippo_master_update(struct hda_codec *codec)
11076 struct alc_spec *spec = codec->spec;
11077 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11078 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11079 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11083 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11084 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11085 HDA_AMP_MUTE, mute);
11086 /* mute internal speaker per jack sense */
11087 if (spec->jack_present)
11088 mute = HDA_AMP_MUTE;
11090 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11091 HDA_AMP_MUTE, mute);
11092 if (speaker_nid && speaker_nid != line_nid)
11093 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11094 HDA_AMP_MUTE, mute);
11097 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11099 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11100 struct snd_ctl_elem_value *ucontrol)
11102 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11103 struct alc_spec *spec = codec->spec;
11104 int val = !!*ucontrol->value.integer.value;
11106 if (val == spec->master_sw)
11108 spec->master_sw = val;
11109 alc262_hippo_master_update(codec);
11113 #define ALC262_HIPPO_MASTER_SWITCH \
11115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11116 .name = "Master Playback Switch", \
11117 .info = snd_ctl_boolean_mono_info, \
11118 .get = alc262_hippo_master_sw_get, \
11119 .put = alc262_hippo_master_sw_put, \
11122 .iface = NID_MAPPING, \
11123 .name = "Master Playback Switch", \
11124 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11125 (SUBDEV_SPEAKER(0) << 16), \
11128 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11129 ALC262_HIPPO_MASTER_SWITCH,
11130 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11133 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11134 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11136 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11138 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11139 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11140 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11141 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11145 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11146 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11147 ALC262_HIPPO_MASTER_SWITCH,
11148 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11149 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11151 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11154 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11155 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11156 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11157 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11161 /* mute/unmute internal speaker according to the hp jack and mute state */
11162 static void alc262_hippo_automute(struct hda_codec *codec)
11164 struct alc_spec *spec = codec->spec;
11165 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11167 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11168 alc262_hippo_master_update(codec);
11171 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11173 if ((res >> 26) != ALC880_HP_EVENT)
11175 alc262_hippo_automute(codec);
11178 static void alc262_hippo_setup(struct hda_codec *codec)
11180 struct alc_spec *spec = codec->spec;
11182 spec->autocfg.hp_pins[0] = 0x15;
11183 spec->autocfg.speaker_pins[0] = 0x14;
11186 static void alc262_hippo1_setup(struct hda_codec *codec)
11188 struct alc_spec *spec = codec->spec;
11190 spec->autocfg.hp_pins[0] = 0x1b;
11191 spec->autocfg.speaker_pins[0] = 0x14;
11195 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11196 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11197 ALC262_HIPPO_MASTER_SWITCH,
11198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11200 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11201 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11205 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11206 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11207 ALC262_HIPPO_MASTER_SWITCH,
11208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11210 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11211 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11212 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11216 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11217 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11218 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11219 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11220 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11225 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11227 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11228 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11232 static struct hda_verb alc262_tyan_verbs[] = {
11233 /* Headphone automute */
11234 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11235 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11238 /* P11 AUX_IN, white 4-pin connector */
11239 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11240 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11241 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11242 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11247 /* unsolicited event for HP jack sensing */
11248 static void alc262_tyan_setup(struct hda_codec *codec)
11250 struct alc_spec *spec = codec->spec;
11252 spec->autocfg.hp_pins[0] = 0x1b;
11253 spec->autocfg.speaker_pins[0] = 0x15;
11257 #define alc262_capture_mixer alc882_capture_mixer
11258 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11261 * generic initialization of ADC, input mixers and output mixers
11263 static struct hda_verb alc262_init_verbs[] = {
11265 * Unmute ADC0-2 and set the default input to mic-in
11267 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11269 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11270 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11271 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11274 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11276 * Note: PASD motherboards uses the Line In 2 as the input for
11277 * front panel mic (mic 2)
11279 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11287 * Set up output mixers (0x0c - 0x0e)
11289 /* set vol=0 to output mixers */
11290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11293 /* set up input amps for analog loopback */
11294 /* Amp Indices: DAC = 0, mixer = 1 */
11295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11303 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11304 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11306 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11307 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11311 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11315 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11318 /* FIXME: use matrix-type input source selection */
11319 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11320 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11339 static struct hda_verb alc262_eapd_verbs[] = {
11340 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11341 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11345 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11346 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11347 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11348 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11350 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11351 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11355 static struct hda_verb alc262_sony_unsol_verbs[] = {
11356 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11358 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11365 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11366 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11367 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11368 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11369 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11370 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11374 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11375 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11377 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11378 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11379 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11380 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11382 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11386 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11388 struct alc_spec *spec = codec->spec;
11390 spec->autocfg.hp_pins[0] = 0x15;
11391 spec->autocfg.speaker_pins[0] = 0x14;
11392 spec->ext_mic.pin = 0x18;
11393 spec->ext_mic.mux_idx = 0;
11394 spec->int_mic.pin = 0x12;
11395 spec->int_mic.mux_idx = 9;
11396 spec->auto_mic = 1;
11402 * 0x16 = internal speaker
11403 * 0x18 = external mic
11406 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11407 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11408 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11411 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11412 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11414 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11419 static struct hda_verb alc262_nec_verbs[] = {
11420 /* Unmute Speaker */
11421 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11424 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11427 /* External mic to headphone */
11428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11429 /* External mic to speaker */
11430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11436 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11437 * 0x1b = port replicator headphone out
11440 #define ALC_HP_EVENT 0x37
11442 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11443 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11445 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11446 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11450 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11451 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11452 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11456 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11457 /* Front Mic pin: input vref at 50% */
11458 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11459 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11463 static struct hda_input_mux alc262_fujitsu_capture_source = {
11467 { "Int Mic", 0x1 },
11472 static struct hda_input_mux alc262_HP_capture_source = {
11476 { "Front Mic", 0x1 },
11483 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11487 { "Front Mic", 0x2 },
11493 /* mute/unmute internal speaker according to the hp jacks and mute state */
11494 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11496 struct alc_spec *spec = codec->spec;
11499 if (force || !spec->sense_updated) {
11500 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11501 snd_hda_jack_detect(codec, 0x1b);
11502 spec->sense_updated = 1;
11504 /* unmute internal speaker only if both HPs are unplugged and
11505 * master switch is on
11507 if (spec->jack_present)
11508 mute = HDA_AMP_MUTE;
11510 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11511 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11512 HDA_AMP_MUTE, mute);
11515 /* unsolicited event for HP jack sensing */
11516 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11519 if ((res >> 26) != ALC_HP_EVENT)
11521 alc262_fujitsu_automute(codec, 1);
11524 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11526 alc262_fujitsu_automute(codec, 1);
11529 /* bind volumes of both NID 0x0c and 0x0d */
11530 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11531 .ops = &snd_hda_bind_vol,
11533 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11534 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11539 /* mute/unmute internal speaker according to the hp jack and mute state */
11540 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11542 struct alc_spec *spec = codec->spec;
11545 if (force || !spec->sense_updated) {
11546 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11547 spec->sense_updated = 1;
11549 if (spec->jack_present) {
11550 /* mute internal speaker */
11551 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11552 HDA_AMP_MUTE, HDA_AMP_MUTE);
11553 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11554 HDA_AMP_MUTE, HDA_AMP_MUTE);
11556 /* unmute internal speaker if necessary */
11557 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11558 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11559 HDA_AMP_MUTE, mute);
11560 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11561 HDA_AMP_MUTE, mute);
11565 /* unsolicited event for HP jack sensing */
11566 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11569 if ((res >> 26) != ALC_HP_EVENT)
11571 alc262_lenovo_3000_automute(codec, 1);
11574 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11575 int dir, int idx, long *valp)
11579 for (i = 0; i < 2; i++, valp++)
11580 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11582 *valp ? 0 : HDA_AMP_MUTE);
11586 /* bind hp and internal speaker mute (with plug check) */
11587 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11588 struct snd_ctl_elem_value *ucontrol)
11590 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11591 long *valp = ucontrol->value.integer.value;
11594 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11595 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11597 alc262_fujitsu_automute(codec, 0);
11601 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11602 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11605 .name = "Master Playback Switch",
11606 .subdevice = HDA_SUBDEV_AMP_FLAG,
11607 .info = snd_hda_mixer_amp_switch_info,
11608 .get = snd_hda_mixer_amp_switch_get,
11609 .put = alc262_fujitsu_master_sw_put,
11610 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11613 .iface = NID_MAPPING,
11614 .name = "Master Playback Switch",
11615 .private_value = 0x1b,
11617 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11618 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11619 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11620 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11622 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11623 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11624 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11628 /* bind hp and internal speaker mute (with plug check) */
11629 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11630 struct snd_ctl_elem_value *ucontrol)
11632 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11633 long *valp = ucontrol->value.integer.value;
11636 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11638 alc262_lenovo_3000_automute(codec, 0);
11642 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11643 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11645 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11646 .name = "Master Playback Switch",
11647 .subdevice = HDA_SUBDEV_AMP_FLAG,
11648 .info = snd_hda_mixer_amp_switch_info,
11649 .get = snd_hda_mixer_amp_switch_get,
11650 .put = alc262_lenovo_3000_master_sw_put,
11651 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11655 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11656 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11657 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11658 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11659 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11660 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11664 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11665 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11666 ALC262_HIPPO_MASTER_SWITCH,
11667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11670 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11671 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11672 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11676 /* additional init verbs for Benq laptops */
11677 static struct hda_verb alc262_EAPD_verbs[] = {
11678 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11679 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11683 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11684 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11685 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11687 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11688 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11692 /* Samsung Q1 Ultra Vista model setup */
11693 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11694 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11695 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11698 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11699 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11703 static struct hda_verb alc262_ultra_verbs[] = {
11705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11710 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11711 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11712 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11715 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11718 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11721 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11722 /* ADC, choose mic */
11723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11724 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11725 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11726 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11729 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11736 /* mute/unmute internal speaker according to the hp jack and mute state */
11737 static void alc262_ultra_automute(struct hda_codec *codec)
11739 struct alc_spec *spec = codec->spec;
11743 /* auto-mute only when HP is used as HP */
11744 if (!spec->cur_mux[0]) {
11745 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11746 if (spec->jack_present)
11747 mute = HDA_AMP_MUTE;
11749 /* mute/unmute internal speaker */
11750 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11751 HDA_AMP_MUTE, mute);
11752 /* mute/unmute HP */
11753 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11754 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11757 /* unsolicited event for HP jack sensing */
11758 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11761 if ((res >> 26) != ALC880_HP_EVENT)
11763 alc262_ultra_automute(codec);
11766 static struct hda_input_mux alc262_ultra_capture_source = {
11770 { "Headphone", 0x7 },
11774 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11775 struct snd_ctl_elem_value *ucontrol)
11777 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11778 struct alc_spec *spec = codec->spec;
11781 ret = alc_mux_enum_put(kcontrol, ucontrol);
11784 /* reprogram the HP pin as mic or HP according to the input source */
11785 snd_hda_codec_write_cache(codec, 0x15, 0,
11786 AC_VERB_SET_PIN_WIDGET_CONTROL,
11787 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11788 alc262_ultra_automute(codec); /* mute/unmute HP */
11792 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11793 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11794 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11796 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11797 .name = "Capture Source",
11798 .info = alc_mux_enum_info,
11799 .get = alc_mux_enum_get,
11800 .put = alc262_ultra_mux_enum_put,
11803 .iface = NID_MAPPING,
11804 .name = "Capture Source",
11805 .private_value = 0x15,
11810 /* We use two mixers depending on the output pin; 0x16 is a mono output
11811 * and thus it's bound with a different mixer.
11812 * This function returns which mixer amp should be used.
11814 static int alc262_check_volbit(hda_nid_t nid)
11818 else if (nid == 0x16)
11824 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11825 const char *pfx, int *vbits, int idx)
11830 vbit = alc262_check_volbit(nid);
11833 if (*vbits & vbit) /* a volume control for this mixer already there */
11837 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11839 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11840 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
11843 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11844 const char *pfx, int idx)
11851 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11853 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11854 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
11857 /* add playback controls from the parsed DAC table */
11858 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11859 const struct auto_pin_cfg *cfg)
11865 spec->multiout.num_dacs = 1; /* only use one dac */
11866 spec->multiout.dac_nids = spec->private_dac_nids;
11867 spec->multiout.dac_nids[0] = 2;
11869 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11871 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11873 else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
11877 for (i = 0; i < 2; i++) {
11878 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
11881 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
11882 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
11887 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
11888 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
11895 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11896 alc262_check_volbit(cfg->speaker_pins[0]) |
11897 alc262_check_volbit(cfg->hp_pins[0]);
11898 if (vbits == 1 || vbits == 2)
11899 pfx = "Master"; /* only one mixer is used */
11901 for (i = 0; i < 2; i++) {
11902 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
11906 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
11907 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
11908 "Speaker", &vbits, i);
11912 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
11913 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
11914 "Headphone", &vbits, i);
11922 #define alc262_auto_create_input_ctls \
11923 alc882_auto_create_input_ctls
11926 * generic initialization of ADC, input mixers and output mixers
11928 static struct hda_verb alc262_volume_init_verbs[] = {
11930 * Unmute ADC0-2 and set the default input to mic-in
11932 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11933 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11934 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11935 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11936 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11939 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11941 * Note: PASD motherboards uses the Line In 2 as the input for
11942 * front panel mic (mic 2)
11944 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11952 * Set up output mixers (0x0c - 0x0f)
11954 /* set vol=0 to output mixers */
11955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11959 /* set up input amps for analog loopback */
11960 /* Amp Indices: DAC = 0, mixer = 1 */
11961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11963 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11964 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11965 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11966 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11968 /* FIXME: use matrix-type input source selection */
11969 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11970 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11974 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11978 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11979 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11989 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11991 * Unmute ADC0-2 and set the default input to mic-in
11993 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11995 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11996 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11997 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11998 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12000 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12002 * Note: PASD motherboards uses the Line In 2 as the input for
12003 * front panel mic (mic 2)
12005 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12015 * Set up output mixers (0x0c - 0x0e)
12017 /* set vol=0 to output mixers */
12018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12022 /* set up input amps for analog loopback */
12023 /* Amp Indices: DAC = 0, mixer = 1 */
12024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12028 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12029 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12035 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12036 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12038 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12039 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12042 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12043 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12044 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12045 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12048 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12049 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12050 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12051 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12052 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12055 /* FIXME: use matrix-type input source selection */
12056 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12057 /* Input mixer1: only unmute Mic */
12058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12061 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12069 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12071 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12082 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12088 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12093 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12095 * Unmute ADC0-2 and set the default input to mic-in
12097 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12099 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12100 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12101 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12102 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12104 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12106 * Note: PASD motherboards uses the Line In 2 as the input for front
12107 * panel mic (mic 2)
12109 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12115 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12116 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12117 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12119 * Set up output mixers (0x0c - 0x0e)
12121 /* set vol=0 to output mixers */
12122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12123 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12126 /* set up input amps for analog loopback */
12127 /* Amp Indices: DAC = 0, mixer = 1 */
12128 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12129 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12130 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12131 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12133 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12136 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12137 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12138 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12139 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12140 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12141 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12142 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12144 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12145 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12147 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12148 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12150 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12151 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12152 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12154 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12155 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12157 /* FIXME: use matrix-type input source selection */
12158 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12159 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12160 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12161 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12162 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12163 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12164 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12165 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12166 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12168 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12169 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12170 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12171 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12173 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12181 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12182 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12184 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12189 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12191 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12192 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12193 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12195 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12196 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12197 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12198 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12202 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12213 static const struct alc_fixup alc262_fixups[] = {
12214 [PINFIX_FSC_H270] = {
12215 .pins = (const struct alc_pincfg[]) {
12216 { 0x14, 0x99130110 }, /* speaker */
12217 { 0x15, 0x0221142f }, /* front HP */
12218 { 0x1b, 0x0121141f }, /* rear HP */
12222 [PINFIX_PB_M5210] = {
12223 .verbs = (const struct hda_verb[]) {
12224 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12230 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12231 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12236 #ifdef CONFIG_SND_HDA_POWER_SAVE
12237 #define alc262_loopbacks alc880_loopbacks
12240 /* pcm configuration: identical with ALC880 */
12241 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12242 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12243 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12244 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12247 * BIOS auto configuration
12249 static int alc262_parse_auto_config(struct hda_codec *codec)
12251 struct alc_spec *spec = codec->spec;
12253 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12255 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12259 if (!spec->autocfg.line_outs) {
12260 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12261 spec->multiout.max_channels = 2;
12262 spec->no_analog = 1;
12265 return 0; /* can't find valid BIOS pin config */
12267 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12270 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12274 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12277 alc_auto_parse_digital(codec);
12279 if (spec->kctls.list)
12280 add_mixer(spec, spec->kctls.list);
12282 add_verb(spec, alc262_volume_init_verbs);
12283 spec->num_mux_defs = 1;
12284 spec->input_mux = &spec->private_imux[0];
12286 err = alc_auto_add_mic_boost(codec);
12290 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12295 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12296 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12297 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12298 #define alc262_auto_init_input_src alc882_auto_init_input_src
12301 /* init callback for auto-configuration model -- overriding the default init */
12302 static void alc262_auto_init(struct hda_codec *codec)
12304 struct alc_spec *spec = codec->spec;
12305 alc262_auto_init_multi_out(codec);
12306 alc262_auto_init_hp_out(codec);
12307 alc262_auto_init_analog_input(codec);
12308 alc262_auto_init_input_src(codec);
12309 alc_auto_init_digital(codec);
12310 if (spec->unsol_event)
12311 alc_inithook(codec);
12315 * configuration and preset
12317 static const char *alc262_models[ALC262_MODEL_LAST] = {
12318 [ALC262_BASIC] = "basic",
12319 [ALC262_HIPPO] = "hippo",
12320 [ALC262_HIPPO_1] = "hippo_1",
12321 [ALC262_FUJITSU] = "fujitsu",
12322 [ALC262_HP_BPC] = "hp-bpc",
12323 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12324 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12325 [ALC262_HP_RP5700] = "hp-rp5700",
12326 [ALC262_BENQ_ED8] = "benq",
12327 [ALC262_BENQ_T31] = "benq-t31",
12328 [ALC262_SONY_ASSAMD] = "sony-assamd",
12329 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12330 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12331 [ALC262_ULTRA] = "ultra",
12332 [ALC262_LENOVO_3000] = "lenovo-3000",
12333 [ALC262_NEC] = "nec",
12334 [ALC262_TYAN] = "tyan",
12335 [ALC262_AUTO] = "auto",
12338 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12339 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12340 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12341 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12343 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12345 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12347 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12348 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12349 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12350 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12351 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12352 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12353 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12354 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12355 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12356 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12357 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12358 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12359 ALC262_HP_TC_T5735),
12360 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12361 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12362 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12363 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12364 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12365 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12366 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12367 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12368 #if 0 /* disable the quirk since model=auto works better in recent versions */
12369 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12370 ALC262_SONY_ASSAMD),
12372 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12373 ALC262_TOSHIBA_RX1),
12374 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12375 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12376 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12377 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12378 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12380 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12381 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12382 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12383 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12384 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12388 static struct alc_config_preset alc262_presets[] = {
12390 .mixers = { alc262_base_mixer },
12391 .init_verbs = { alc262_init_verbs },
12392 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12393 .dac_nids = alc262_dac_nids,
12395 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12396 .channel_mode = alc262_modes,
12397 .input_mux = &alc262_capture_source,
12400 .mixers = { alc262_hippo_mixer },
12401 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12402 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12403 .dac_nids = alc262_dac_nids,
12405 .dig_out_nid = ALC262_DIGOUT_NID,
12406 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12407 .channel_mode = alc262_modes,
12408 .input_mux = &alc262_capture_source,
12409 .unsol_event = alc262_hippo_unsol_event,
12410 .setup = alc262_hippo_setup,
12411 .init_hook = alc262_hippo_automute,
12413 [ALC262_HIPPO_1] = {
12414 .mixers = { alc262_hippo1_mixer },
12415 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12416 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12417 .dac_nids = alc262_dac_nids,
12419 .dig_out_nid = ALC262_DIGOUT_NID,
12420 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12421 .channel_mode = alc262_modes,
12422 .input_mux = &alc262_capture_source,
12423 .unsol_event = alc262_hippo_unsol_event,
12424 .setup = alc262_hippo1_setup,
12425 .init_hook = alc262_hippo_automute,
12427 [ALC262_FUJITSU] = {
12428 .mixers = { alc262_fujitsu_mixer },
12429 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12430 alc262_fujitsu_unsol_verbs },
12431 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12432 .dac_nids = alc262_dac_nids,
12434 .dig_out_nid = ALC262_DIGOUT_NID,
12435 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12436 .channel_mode = alc262_modes,
12437 .input_mux = &alc262_fujitsu_capture_source,
12438 .unsol_event = alc262_fujitsu_unsol_event,
12439 .init_hook = alc262_fujitsu_init_hook,
12441 [ALC262_HP_BPC] = {
12442 .mixers = { alc262_HP_BPC_mixer },
12443 .init_verbs = { alc262_HP_BPC_init_verbs },
12444 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12445 .dac_nids = alc262_dac_nids,
12447 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12448 .channel_mode = alc262_modes,
12449 .input_mux = &alc262_HP_capture_source,
12450 .unsol_event = alc262_hp_bpc_unsol_event,
12451 .init_hook = alc262_hp_bpc_automute,
12453 [ALC262_HP_BPC_D7000_WF] = {
12454 .mixers = { alc262_HP_BPC_WildWest_mixer },
12455 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12456 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12457 .dac_nids = alc262_dac_nids,
12459 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12460 .channel_mode = alc262_modes,
12461 .input_mux = &alc262_HP_D7000_capture_source,
12462 .unsol_event = alc262_hp_wildwest_unsol_event,
12463 .init_hook = alc262_hp_wildwest_automute,
12465 [ALC262_HP_BPC_D7000_WL] = {
12466 .mixers = { alc262_HP_BPC_WildWest_mixer,
12467 alc262_HP_BPC_WildWest_option_mixer },
12468 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12469 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12470 .dac_nids = alc262_dac_nids,
12472 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12473 .channel_mode = alc262_modes,
12474 .input_mux = &alc262_HP_D7000_capture_source,
12475 .unsol_event = alc262_hp_wildwest_unsol_event,
12476 .init_hook = alc262_hp_wildwest_automute,
12478 [ALC262_HP_TC_T5735] = {
12479 .mixers = { alc262_hp_t5735_mixer },
12480 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12481 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12482 .dac_nids = alc262_dac_nids,
12484 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12485 .channel_mode = alc262_modes,
12486 .input_mux = &alc262_capture_source,
12487 .unsol_event = alc_sku_unsol_event,
12488 .setup = alc262_hp_t5735_setup,
12489 .init_hook = alc_inithook,
12491 [ALC262_HP_RP5700] = {
12492 .mixers = { alc262_hp_rp5700_mixer },
12493 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12494 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12495 .dac_nids = alc262_dac_nids,
12496 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12497 .channel_mode = alc262_modes,
12498 .input_mux = &alc262_hp_rp5700_capture_source,
12500 [ALC262_BENQ_ED8] = {
12501 .mixers = { alc262_base_mixer },
12502 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12503 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12504 .dac_nids = alc262_dac_nids,
12506 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12507 .channel_mode = alc262_modes,
12508 .input_mux = &alc262_capture_source,
12510 [ALC262_SONY_ASSAMD] = {
12511 .mixers = { alc262_sony_mixer },
12512 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12513 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12514 .dac_nids = alc262_dac_nids,
12516 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12517 .channel_mode = alc262_modes,
12518 .input_mux = &alc262_capture_source,
12519 .unsol_event = alc262_hippo_unsol_event,
12520 .setup = alc262_hippo_setup,
12521 .init_hook = alc262_hippo_automute,
12523 [ALC262_BENQ_T31] = {
12524 .mixers = { alc262_benq_t31_mixer },
12525 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12526 alc_hp15_unsol_verbs },
12527 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12528 .dac_nids = alc262_dac_nids,
12530 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12531 .channel_mode = alc262_modes,
12532 .input_mux = &alc262_capture_source,
12533 .unsol_event = alc262_hippo_unsol_event,
12534 .setup = alc262_hippo_setup,
12535 .init_hook = alc262_hippo_automute,
12538 .mixers = { alc262_ultra_mixer },
12539 .cap_mixer = alc262_ultra_capture_mixer,
12540 .init_verbs = { alc262_ultra_verbs },
12541 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12542 .dac_nids = alc262_dac_nids,
12543 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12544 .channel_mode = alc262_modes,
12545 .input_mux = &alc262_ultra_capture_source,
12546 .adc_nids = alc262_adc_nids, /* ADC0 */
12547 .capsrc_nids = alc262_capsrc_nids,
12548 .num_adc_nids = 1, /* single ADC */
12549 .unsol_event = alc262_ultra_unsol_event,
12550 .init_hook = alc262_ultra_automute,
12552 [ALC262_LENOVO_3000] = {
12553 .mixers = { alc262_lenovo_3000_mixer },
12554 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12555 alc262_lenovo_3000_unsol_verbs,
12556 alc262_lenovo_3000_init_verbs },
12557 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12558 .dac_nids = alc262_dac_nids,
12560 .dig_out_nid = ALC262_DIGOUT_NID,
12561 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12562 .channel_mode = alc262_modes,
12563 .input_mux = &alc262_fujitsu_capture_source,
12564 .unsol_event = alc262_lenovo_3000_unsol_event,
12567 .mixers = { alc262_nec_mixer },
12568 .init_verbs = { alc262_nec_verbs },
12569 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12570 .dac_nids = alc262_dac_nids,
12572 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12573 .channel_mode = alc262_modes,
12574 .input_mux = &alc262_capture_source,
12576 [ALC262_TOSHIBA_S06] = {
12577 .mixers = { alc262_toshiba_s06_mixer },
12578 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12579 alc262_eapd_verbs },
12580 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12581 .capsrc_nids = alc262_dmic_capsrc_nids,
12582 .dac_nids = alc262_dac_nids,
12583 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12584 .num_adc_nids = 1, /* single ADC */
12585 .dig_out_nid = ALC262_DIGOUT_NID,
12586 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12587 .channel_mode = alc262_modes,
12588 .unsol_event = alc_sku_unsol_event,
12589 .setup = alc262_toshiba_s06_setup,
12590 .init_hook = alc_inithook,
12592 [ALC262_TOSHIBA_RX1] = {
12593 .mixers = { alc262_toshiba_rx1_mixer },
12594 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12595 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12596 .dac_nids = alc262_dac_nids,
12598 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12599 .channel_mode = alc262_modes,
12600 .input_mux = &alc262_capture_source,
12601 .unsol_event = alc262_hippo_unsol_event,
12602 .setup = alc262_hippo_setup,
12603 .init_hook = alc262_hippo_automute,
12606 .mixers = { alc262_tyan_mixer },
12607 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12608 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12609 .dac_nids = alc262_dac_nids,
12611 .dig_out_nid = ALC262_DIGOUT_NID,
12612 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12613 .channel_mode = alc262_modes,
12614 .input_mux = &alc262_capture_source,
12615 .unsol_event = alc_automute_amp_unsol_event,
12616 .setup = alc262_tyan_setup,
12617 .init_hook = alc_automute_amp,
12621 static int patch_alc262(struct hda_codec *codec)
12623 struct alc_spec *spec;
12627 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12631 codec->spec = spec;
12633 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12638 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12639 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12640 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12641 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12644 alc_auto_parse_customize_define(codec);
12646 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12648 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12652 if (board_config < 0) {
12653 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12655 board_config = ALC262_AUTO;
12658 if (board_config == ALC262_AUTO)
12659 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12661 if (board_config == ALC262_AUTO) {
12662 /* automatic parse from the BIOS config */
12663 err = alc262_parse_auto_config(codec);
12669 "hda_codec: Cannot set up configuration "
12670 "from BIOS. Using base mode...\n");
12671 board_config = ALC262_BASIC;
12675 if (!spec->no_analog && has_cdefine_beep(codec)) {
12676 err = snd_hda_attach_beep_device(codec, 0x1);
12683 if (board_config != ALC262_AUTO)
12684 setup_preset(codec, &alc262_presets[board_config]);
12686 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12687 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12689 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12690 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12692 if (!spec->adc_nids && spec->input_mux) {
12694 /* check whether the digital-mic has to be supported */
12695 for (i = 0; i < spec->input_mux->num_items; i++) {
12696 if (spec->input_mux->items[i].index >= 9)
12699 if (i < spec->input_mux->num_items) {
12700 /* use only ADC0 */
12701 spec->adc_nids = alc262_dmic_adc_nids;
12702 spec->num_adc_nids = 1;
12703 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12705 /* all analog inputs */
12706 /* check whether NID 0x07 is valid */
12707 unsigned int wcap = get_wcaps(codec, 0x07);
12710 wcap = get_wcaps_type(wcap);
12711 if (wcap != AC_WID_AUD_IN) {
12712 spec->adc_nids = alc262_adc_nids_alt;
12713 spec->num_adc_nids =
12714 ARRAY_SIZE(alc262_adc_nids_alt);
12715 spec->capsrc_nids = alc262_capsrc_nids_alt;
12717 spec->adc_nids = alc262_adc_nids;
12718 spec->num_adc_nids =
12719 ARRAY_SIZE(alc262_adc_nids);
12720 spec->capsrc_nids = alc262_capsrc_nids;
12724 if (!spec->cap_mixer && !spec->no_analog)
12725 set_capture_mixer(codec);
12726 if (!spec->no_analog && has_cdefine_beep(codec))
12727 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12729 if (board_config == ALC262_AUTO)
12730 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12732 spec->vmaster_nid = 0x0c;
12734 codec->patch_ops = alc_patch_ops;
12735 if (board_config == ALC262_AUTO)
12736 spec->init_hook = alc262_auto_init;
12737 #ifdef CONFIG_SND_HDA_POWER_SAVE
12738 if (!spec->loopback.amplist)
12739 spec->loopback.amplist = alc262_loopbacks;
12746 * ALC268 channel source setting (2 channel)
12748 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12749 #define alc268_modes alc260_modes
12751 static hda_nid_t alc268_dac_nids[2] = {
12756 static hda_nid_t alc268_adc_nids[2] = {
12761 static hda_nid_t alc268_adc_nids_alt[1] = {
12766 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12768 static struct snd_kcontrol_new alc268_base_mixer[] = {
12769 /* output mixer control */
12770 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12771 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12772 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12773 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12775 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12776 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12780 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12781 /* output mixer control */
12782 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12784 ALC262_HIPPO_MASTER_SWITCH,
12785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12786 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12787 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12791 /* bind Beep switches of both NID 0x0f and 0x10 */
12792 static struct hda_bind_ctls alc268_bind_beep_sw = {
12793 .ops = &snd_hda_bind_sw,
12795 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12796 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12801 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12802 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12803 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12807 static struct hda_verb alc268_eapd_verbs[] = {
12808 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12809 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12813 /* Toshiba specific */
12814 static struct hda_verb alc268_toshiba_verbs[] = {
12815 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12819 /* Acer specific */
12820 /* bind volumes of both NID 0x02 and 0x03 */
12821 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12822 .ops = &snd_hda_bind_vol,
12824 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12825 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12830 /* mute/unmute internal speaker according to the hp jack and mute state */
12831 static void alc268_acer_automute(struct hda_codec *codec, int force)
12833 struct alc_spec *spec = codec->spec;
12836 if (force || !spec->sense_updated) {
12837 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12838 spec->sense_updated = 1;
12840 if (spec->jack_present)
12841 mute = HDA_AMP_MUTE; /* mute internal speaker */
12842 else /* unmute internal speaker if necessary */
12843 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12844 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12845 HDA_AMP_MUTE, mute);
12849 /* bind hp and internal speaker mute (with plug check) */
12850 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12851 struct snd_ctl_elem_value *ucontrol)
12853 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12854 long *valp = ucontrol->value.integer.value;
12857 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12859 alc268_acer_automute(codec, 0);
12863 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12864 /* output mixer control */
12865 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12867 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12868 .name = "Master Playback Switch",
12869 .subdevice = HDA_SUBDEV_AMP_FLAG,
12870 .info = snd_hda_mixer_amp_switch_info,
12871 .get = snd_hda_mixer_amp_switch_get,
12872 .put = alc268_acer_master_sw_put,
12873 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12875 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12879 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12880 /* output mixer control */
12881 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12883 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12884 .name = "Master Playback Switch",
12885 .subdevice = HDA_SUBDEV_AMP_FLAG,
12886 .info = snd_hda_mixer_amp_switch_info,
12887 .get = snd_hda_mixer_amp_switch_get,
12888 .put = alc268_acer_master_sw_put,
12889 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12891 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12892 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12893 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12897 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12898 /* output mixer control */
12899 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12902 .name = "Master Playback Switch",
12903 .subdevice = HDA_SUBDEV_AMP_FLAG,
12904 .info = snd_hda_mixer_amp_switch_info,
12905 .get = snd_hda_mixer_amp_switch_get,
12906 .put = alc268_acer_master_sw_put,
12907 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12909 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12910 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12914 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12915 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12916 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12917 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12918 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12919 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12924 static struct hda_verb alc268_acer_verbs[] = {
12925 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12926 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12927 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12928 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12929 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12931 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12935 /* unsolicited event for HP jack sensing */
12936 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12937 #define alc268_toshiba_setup alc262_hippo_setup
12938 #define alc268_toshiba_automute alc262_hippo_automute
12940 static void alc268_acer_unsol_event(struct hda_codec *codec,
12943 if ((res >> 26) != ALC880_HP_EVENT)
12945 alc268_acer_automute(codec, 1);
12948 static void alc268_acer_init_hook(struct hda_codec *codec)
12950 alc268_acer_automute(codec, 1);
12953 /* toggle speaker-output according to the hp-jack state */
12954 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12956 unsigned int present;
12957 unsigned char bits;
12959 present = snd_hda_jack_detect(codec, 0x15);
12960 bits = present ? HDA_AMP_MUTE : 0;
12961 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12962 HDA_AMP_MUTE, bits);
12963 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12964 HDA_AMP_MUTE, bits);
12967 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12970 switch (res >> 26) {
12971 case ALC880_HP_EVENT:
12972 alc268_aspire_one_speaker_automute(codec);
12974 case ALC880_MIC_EVENT:
12975 alc_mic_automute(codec);
12980 static void alc268_acer_lc_setup(struct hda_codec *codec)
12982 struct alc_spec *spec = codec->spec;
12983 spec->ext_mic.pin = 0x18;
12984 spec->ext_mic.mux_idx = 0;
12985 spec->int_mic.pin = 0x12;
12986 spec->int_mic.mux_idx = 6;
12987 spec->auto_mic = 1;
12990 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12992 alc268_aspire_one_speaker_automute(codec);
12993 alc_mic_automute(codec);
12996 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12997 /* output mixer control */
12998 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12999 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13000 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13002 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13003 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13007 static struct hda_verb alc268_dell_verbs[] = {
13008 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13010 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13015 /* mute/unmute internal speaker according to the hp jack and mute state */
13016 static void alc268_dell_setup(struct hda_codec *codec)
13018 struct alc_spec *spec = codec->spec;
13020 spec->autocfg.hp_pins[0] = 0x15;
13021 spec->autocfg.speaker_pins[0] = 0x14;
13022 spec->ext_mic.pin = 0x18;
13023 spec->ext_mic.mux_idx = 0;
13024 spec->int_mic.pin = 0x19;
13025 spec->int_mic.mux_idx = 1;
13026 spec->auto_mic = 1;
13029 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13030 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13031 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13032 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13034 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13035 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13036 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13037 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13041 static struct hda_verb alc267_quanta_il1_verbs[] = {
13042 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13043 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13047 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13049 struct alc_spec *spec = codec->spec;
13050 spec->autocfg.hp_pins[0] = 0x15;
13051 spec->autocfg.speaker_pins[0] = 0x14;
13052 spec->ext_mic.pin = 0x18;
13053 spec->ext_mic.mux_idx = 0;
13054 spec->int_mic.pin = 0x19;
13055 spec->int_mic.mux_idx = 1;
13056 spec->auto_mic = 1;
13060 * generic initialization of ADC, input mixers and output mixers
13062 static struct hda_verb alc268_base_init_verbs[] = {
13063 /* Unmute DAC0-1 and set vol = 0 */
13064 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13065 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13068 * Set up output mixers (0x0c - 0x0e)
13070 /* set vol=0 to output mixers */
13071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13072 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13074 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13075 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13078 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13079 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13080 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13081 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13082 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13083 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13084 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13087 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13088 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13089 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13090 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13092 /* set PCBEEP vol = 0, mute connections */
13093 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13094 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13095 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13097 /* Unmute Selector 23h,24h and set the default input to mic-in */
13099 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13101 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13102 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13108 * generic initialization of ADC, input mixers and output mixers
13110 static struct hda_verb alc268_volume_init_verbs[] = {
13111 /* set output DAC */
13112 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13113 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13115 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13116 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13117 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13118 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13119 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13122 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13123 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13125 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13126 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13128 /* set PCBEEP vol = 0, mute connections */
13129 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13130 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13131 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13136 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13137 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13138 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13142 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13143 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13144 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13149 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13150 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13151 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13152 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13153 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13158 static struct hda_input_mux alc268_capture_source = {
13162 { "Front Mic", 0x1 },
13168 static struct hda_input_mux alc268_acer_capture_source = {
13172 { "Internal Mic", 0x1 },
13177 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13181 { "Internal Mic", 0x6 },
13186 #ifdef CONFIG_SND_DEBUG
13187 static struct snd_kcontrol_new alc268_test_mixer[] = {
13188 /* Volume widgets */
13189 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13190 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13191 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13192 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13193 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13194 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13195 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13196 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13197 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13198 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13199 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13200 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13201 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13202 /* The below appears problematic on some hardwares */
13203 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13204 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13205 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13206 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13207 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13209 /* Modes for retasking pin widgets */
13210 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13211 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13212 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13213 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13215 /* Controls for GPIO pins, assuming they are configured as outputs */
13216 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13217 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13218 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13219 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13221 /* Switches to allow the digital SPDIF output pin to be enabled.
13222 * The ALC268 does not have an SPDIF input.
13224 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13226 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13227 * this output to turn on an external amplifier.
13229 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13230 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13236 /* create input playback/capture controls for the given pin */
13237 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13238 const char *ctlname, int idx)
13249 case 0x1a: /* ALC259/269 only */
13250 case 0x1b: /* ALC259/269 only */
13251 case 0x21: /* ALC269vb has this pin, too */
13255 snd_printd(KERN_WARNING "hda_codec: "
13256 "ignoring pin 0x%x as unknown\n", nid);
13259 if (spec->multiout.dac_nids[0] != dac &&
13260 spec->multiout.dac_nids[1] != dac) {
13261 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13262 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13266 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13270 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13271 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13273 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13274 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13280 /* add playback controls from the parsed DAC table */
13281 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13282 const struct auto_pin_cfg *cfg)
13287 spec->multiout.dac_nids = spec->private_dac_nids;
13289 nid = cfg->line_out_pins[0];
13292 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13296 err = alc268_new_analog_output(spec, nid, name, 0);
13301 nid = cfg->speaker_pins[0];
13303 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13304 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13308 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13312 nid = cfg->hp_pins[0];
13314 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13319 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13321 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13322 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13329 /* create playback/capture controls for input pins */
13330 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13331 const struct auto_pin_cfg *cfg)
13333 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13336 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13337 hda_nid_t nid, int pin_type)
13341 alc_set_pin_output(codec, nid, pin_type);
13342 if (nid == 0x14 || nid == 0x16)
13346 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13349 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13351 struct alc_spec *spec = codec->spec;
13352 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13354 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13355 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13359 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13361 struct alc_spec *spec = codec->spec;
13364 pin = spec->autocfg.hp_pins[0];
13366 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13367 pin = spec->autocfg.speaker_pins[0];
13369 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13372 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13374 struct alc_spec *spec = codec->spec;
13375 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13376 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13377 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13378 unsigned int dac_vol1, dac_vol2;
13380 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13381 snd_hda_codec_write(codec, speaker_nid, 0,
13382 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13383 /* mute mixer inputs from 0x1d */
13384 snd_hda_codec_write(codec, 0x0f, 0,
13385 AC_VERB_SET_AMP_GAIN_MUTE,
13387 snd_hda_codec_write(codec, 0x10, 0,
13388 AC_VERB_SET_AMP_GAIN_MUTE,
13391 /* unmute mixer inputs from 0x1d */
13392 snd_hda_codec_write(codec, 0x0f, 0,
13393 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13394 snd_hda_codec_write(codec, 0x10, 0,
13395 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13398 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13399 if (line_nid == 0x14)
13400 dac_vol2 = AMP_OUT_ZERO;
13401 else if (line_nid == 0x15)
13402 dac_vol1 = AMP_OUT_ZERO;
13403 if (hp_nid == 0x14)
13404 dac_vol2 = AMP_OUT_ZERO;
13405 else if (hp_nid == 0x15)
13406 dac_vol1 = AMP_OUT_ZERO;
13407 if (line_nid != 0x16 || hp_nid != 0x16 ||
13408 spec->autocfg.line_out_pins[1] != 0x16 ||
13409 spec->autocfg.line_out_pins[2] != 0x16)
13410 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13412 snd_hda_codec_write(codec, 0x02, 0,
13413 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13414 snd_hda_codec_write(codec, 0x03, 0,
13415 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13418 /* pcm configuration: identical with ALC880 */
13419 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13420 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13421 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13422 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13425 * BIOS auto configuration
13427 static int alc268_parse_auto_config(struct hda_codec *codec)
13429 struct alc_spec *spec = codec->spec;
13431 static hda_nid_t alc268_ignore[] = { 0 };
13433 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13437 if (!spec->autocfg.line_outs) {
13438 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13439 spec->multiout.max_channels = 2;
13440 spec->no_analog = 1;
13443 return 0; /* can't find valid BIOS pin config */
13445 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13448 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13452 spec->multiout.max_channels = 2;
13455 /* digital only support output */
13456 alc_auto_parse_digital(codec);
13457 if (spec->kctls.list)
13458 add_mixer(spec, spec->kctls.list);
13460 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13461 add_mixer(spec, alc268_beep_mixer);
13463 add_verb(spec, alc268_volume_init_verbs);
13464 spec->num_mux_defs = 2;
13465 spec->input_mux = &spec->private_imux[0];
13467 err = alc_auto_add_mic_boost(codec);
13471 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13476 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13478 /* init callback for auto-configuration model -- overriding the default init */
13479 static void alc268_auto_init(struct hda_codec *codec)
13481 struct alc_spec *spec = codec->spec;
13482 alc268_auto_init_multi_out(codec);
13483 alc268_auto_init_hp_out(codec);
13484 alc268_auto_init_mono_speaker_out(codec);
13485 alc268_auto_init_analog_input(codec);
13486 alc_auto_init_digital(codec);
13487 if (spec->unsol_event)
13488 alc_inithook(codec);
13492 * configuration and preset
13494 static const char *alc268_models[ALC268_MODEL_LAST] = {
13495 [ALC267_QUANTA_IL1] = "quanta-il1",
13496 [ALC268_3ST] = "3stack",
13497 [ALC268_TOSHIBA] = "toshiba",
13498 [ALC268_ACER] = "acer",
13499 [ALC268_ACER_DMIC] = "acer-dmic",
13500 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13501 [ALC268_DELL] = "dell",
13502 [ALC268_ZEPTO] = "zepto",
13503 #ifdef CONFIG_SND_DEBUG
13504 [ALC268_TEST] = "test",
13506 [ALC268_AUTO] = "auto",
13509 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13510 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13511 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13512 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13513 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13514 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13515 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13516 ALC268_ACER_ASPIRE_ONE),
13517 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13518 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13519 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13520 /* almost compatible with toshiba but with optional digital outs;
13521 * auto-probing seems working fine
13523 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13525 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13526 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13527 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13528 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13529 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13533 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13534 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13535 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13536 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13537 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13542 static struct alc_config_preset alc268_presets[] = {
13543 [ALC267_QUANTA_IL1] = {
13544 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13545 alc268_capture_nosrc_mixer },
13546 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13547 alc267_quanta_il1_verbs },
13548 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13549 .dac_nids = alc268_dac_nids,
13550 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13551 .adc_nids = alc268_adc_nids_alt,
13553 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13554 .channel_mode = alc268_modes,
13555 .unsol_event = alc_sku_unsol_event,
13556 .setup = alc267_quanta_il1_setup,
13557 .init_hook = alc_inithook,
13560 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13561 alc268_beep_mixer },
13562 .init_verbs = { alc268_base_init_verbs },
13563 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13564 .dac_nids = alc268_dac_nids,
13565 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13566 .adc_nids = alc268_adc_nids_alt,
13567 .capsrc_nids = alc268_capsrc_nids,
13569 .dig_out_nid = ALC268_DIGOUT_NID,
13570 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13571 .channel_mode = alc268_modes,
13572 .input_mux = &alc268_capture_source,
13574 [ALC268_TOSHIBA] = {
13575 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13576 alc268_beep_mixer },
13577 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13578 alc268_toshiba_verbs },
13579 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13580 .dac_nids = alc268_dac_nids,
13581 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13582 .adc_nids = alc268_adc_nids_alt,
13583 .capsrc_nids = alc268_capsrc_nids,
13585 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13586 .channel_mode = alc268_modes,
13587 .input_mux = &alc268_capture_source,
13588 .unsol_event = alc268_toshiba_unsol_event,
13589 .setup = alc268_toshiba_setup,
13590 .init_hook = alc268_toshiba_automute,
13593 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13594 alc268_beep_mixer },
13595 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13596 alc268_acer_verbs },
13597 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13598 .dac_nids = alc268_dac_nids,
13599 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13600 .adc_nids = alc268_adc_nids_alt,
13601 .capsrc_nids = alc268_capsrc_nids,
13603 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13604 .channel_mode = alc268_modes,
13605 .input_mux = &alc268_acer_capture_source,
13606 .unsol_event = alc268_acer_unsol_event,
13607 .init_hook = alc268_acer_init_hook,
13609 [ALC268_ACER_DMIC] = {
13610 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13611 alc268_beep_mixer },
13612 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13613 alc268_acer_verbs },
13614 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13615 .dac_nids = alc268_dac_nids,
13616 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13617 .adc_nids = alc268_adc_nids_alt,
13618 .capsrc_nids = alc268_capsrc_nids,
13620 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13621 .channel_mode = alc268_modes,
13622 .input_mux = &alc268_acer_dmic_capture_source,
13623 .unsol_event = alc268_acer_unsol_event,
13624 .init_hook = alc268_acer_init_hook,
13626 [ALC268_ACER_ASPIRE_ONE] = {
13627 .mixers = { alc268_acer_aspire_one_mixer,
13629 alc268_capture_nosrc_mixer },
13630 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13631 alc268_acer_aspire_one_verbs },
13632 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13633 .dac_nids = alc268_dac_nids,
13634 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13635 .adc_nids = alc268_adc_nids_alt,
13636 .capsrc_nids = alc268_capsrc_nids,
13638 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13639 .channel_mode = alc268_modes,
13640 .unsol_event = alc268_acer_lc_unsol_event,
13641 .setup = alc268_acer_lc_setup,
13642 .init_hook = alc268_acer_lc_init_hook,
13645 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13646 alc268_capture_nosrc_mixer },
13647 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13648 alc268_dell_verbs },
13649 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13650 .dac_nids = alc268_dac_nids,
13651 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13652 .adc_nids = alc268_adc_nids_alt,
13653 .capsrc_nids = alc268_capsrc_nids,
13655 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13656 .channel_mode = alc268_modes,
13657 .unsol_event = alc_sku_unsol_event,
13658 .setup = alc268_dell_setup,
13659 .init_hook = alc_inithook,
13662 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13663 alc268_beep_mixer },
13664 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13665 alc268_toshiba_verbs },
13666 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13667 .dac_nids = alc268_dac_nids,
13668 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13669 .adc_nids = alc268_adc_nids_alt,
13670 .capsrc_nids = alc268_capsrc_nids,
13672 .dig_out_nid = ALC268_DIGOUT_NID,
13673 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13674 .channel_mode = alc268_modes,
13675 .input_mux = &alc268_capture_source,
13676 .setup = alc268_toshiba_setup,
13677 .init_hook = alc268_toshiba_automute,
13679 #ifdef CONFIG_SND_DEBUG
13681 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13682 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13683 alc268_volume_init_verbs },
13684 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13685 .dac_nids = alc268_dac_nids,
13686 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13687 .adc_nids = alc268_adc_nids_alt,
13688 .capsrc_nids = alc268_capsrc_nids,
13690 .dig_out_nid = ALC268_DIGOUT_NID,
13691 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13692 .channel_mode = alc268_modes,
13693 .input_mux = &alc268_capture_source,
13698 static int patch_alc268(struct hda_codec *codec)
13700 struct alc_spec *spec;
13702 int i, has_beep, err;
13704 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13708 codec->spec = spec;
13710 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13714 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13715 board_config = snd_hda_check_board_codec_sid_config(codec,
13716 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13718 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13719 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13721 board_config = ALC268_AUTO;
13724 if (board_config == ALC268_AUTO) {
13725 /* automatic parse from the BIOS config */
13726 err = alc268_parse_auto_config(codec);
13732 "hda_codec: Cannot set up configuration "
13733 "from BIOS. Using base mode...\n");
13734 board_config = ALC268_3ST;
13738 if (board_config != ALC268_AUTO)
13739 setup_preset(codec, &alc268_presets[board_config]);
13741 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13742 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13743 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13745 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13748 for (i = 0; i < spec->num_mixers; i++) {
13749 if (spec->mixers[i] == alc268_beep_mixer) {
13756 err = snd_hda_attach_beep_device(codec, 0x1);
13761 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13762 /* override the amp caps for beep generator */
13763 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13764 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13765 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13766 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13767 (0 << AC_AMPCAP_MUTE_SHIFT));
13770 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13771 /* check whether NID 0x07 is valid */
13772 unsigned int wcap = get_wcaps(codec, 0x07);
13775 spec->capsrc_nids = alc268_capsrc_nids;
13777 wcap = get_wcaps_type(wcap);
13778 if (spec->auto_mic ||
13779 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13780 spec->adc_nids = alc268_adc_nids_alt;
13781 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13782 if (spec->auto_mic)
13783 fixup_automic_adc(codec);
13784 if (spec->auto_mic || spec->input_mux->num_items == 1)
13785 add_mixer(spec, alc268_capture_nosrc_mixer);
13787 add_mixer(spec, alc268_capture_alt_mixer);
13789 spec->adc_nids = alc268_adc_nids;
13790 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13791 add_mixer(spec, alc268_capture_mixer);
13793 /* set default input source */
13794 for (i = 0; i < spec->num_adc_nids; i++)
13795 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13796 0, AC_VERB_SET_CONNECT_SEL,
13797 i < spec->num_mux_defs ?
13798 spec->input_mux[i].items[0].index :
13799 spec->input_mux->items[0].index);
13802 spec->vmaster_nid = 0x02;
13804 codec->patch_ops = alc_patch_ops;
13805 if (board_config == ALC268_AUTO)
13806 spec->init_hook = alc268_auto_init;
13812 * ALC269 channel source setting (2 channel)
13814 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13816 #define alc269_dac_nids alc260_dac_nids
13818 static hda_nid_t alc269_adc_nids[1] = {
13823 static hda_nid_t alc269_capsrc_nids[1] = {
13827 static hda_nid_t alc269vb_adc_nids[1] = {
13832 static hda_nid_t alc269vb_capsrc_nids[1] = {
13836 static hda_nid_t alc269_adc_candidates[] = {
13840 #define alc269_modes alc260_modes
13841 #define alc269_capture_source alc880_lg_lw_capture_source
13843 static struct snd_kcontrol_new alc269_base_mixer[] = {
13844 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13845 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13846 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13847 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13849 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13850 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13851 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13852 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13853 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13855 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13859 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13860 /* output mixer control */
13861 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13864 .name = "Master Playback Switch",
13865 .subdevice = HDA_SUBDEV_AMP_FLAG,
13866 .info = snd_hda_mixer_amp_switch_info,
13867 .get = snd_hda_mixer_amp_switch_get,
13868 .put = alc268_acer_master_sw_put,
13869 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13873 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13874 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13875 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13876 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13880 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13881 /* output mixer control */
13882 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13884 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13885 .name = "Master Playback Switch",
13886 .subdevice = HDA_SUBDEV_AMP_FLAG,
13887 .info = snd_hda_mixer_amp_switch_info,
13888 .get = snd_hda_mixer_amp_switch_get,
13889 .put = alc268_acer_master_sw_put,
13890 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13895 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13896 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13897 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13898 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13899 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13900 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13904 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13905 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13906 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13912 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13913 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13914 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13915 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13916 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13920 static struct snd_kcontrol_new alc269_asus_mixer[] = {
13921 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13922 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
13926 /* capture mixer elements */
13927 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13928 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13929 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13930 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13931 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13935 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13936 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13937 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13938 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13942 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13943 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13944 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13945 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13946 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13950 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13951 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13952 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13953 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13958 #define alc269_fujitsu_mixer alc269_laptop_mixer
13960 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13961 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13964 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13965 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13966 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13970 static struct hda_verb alc269_lifebook_verbs[] = {
13971 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13972 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13973 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13978 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13979 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13980 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13984 /* toggle speaker-output according to the hp-jack state */
13985 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13987 unsigned int present;
13988 unsigned char bits;
13990 present = snd_hda_jack_detect(codec, 0x15);
13991 bits = present ? HDA_AMP_MUTE : 0;
13992 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13993 HDA_AMP_MUTE, bits);
13994 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13995 HDA_AMP_MUTE, bits);
13997 snd_hda_codec_write(codec, 0x20, 0,
13998 AC_VERB_SET_COEF_INDEX, 0x0c);
13999 snd_hda_codec_write(codec, 0x20, 0,
14000 AC_VERB_SET_PROC_COEF, 0x680);
14002 snd_hda_codec_write(codec, 0x20, 0,
14003 AC_VERB_SET_COEF_INDEX, 0x0c);
14004 snd_hda_codec_write(codec, 0x20, 0,
14005 AC_VERB_SET_PROC_COEF, 0x480);
14008 /* toggle speaker-output according to the hp-jacks state */
14009 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14011 unsigned int present;
14012 unsigned char bits;
14014 /* Check laptop headphone socket */
14015 present = snd_hda_jack_detect(codec, 0x15);
14017 /* Check port replicator headphone socket */
14018 present |= snd_hda_jack_detect(codec, 0x1a);
14020 bits = present ? HDA_AMP_MUTE : 0;
14021 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14022 HDA_AMP_MUTE, bits);
14023 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14024 HDA_AMP_MUTE, bits);
14026 snd_hda_codec_write(codec, 0x20, 0,
14027 AC_VERB_SET_COEF_INDEX, 0x0c);
14028 snd_hda_codec_write(codec, 0x20, 0,
14029 AC_VERB_SET_PROC_COEF, 0x680);
14031 snd_hda_codec_write(codec, 0x20, 0,
14032 AC_VERB_SET_COEF_INDEX, 0x0c);
14033 snd_hda_codec_write(codec, 0x20, 0,
14034 AC_VERB_SET_PROC_COEF, 0x480);
14037 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14039 unsigned int present_laptop;
14040 unsigned int present_dock;
14042 present_laptop = snd_hda_jack_detect(codec, 0x18);
14043 present_dock = snd_hda_jack_detect(codec, 0x1b);
14045 /* Laptop mic port overrides dock mic port, design decision */
14047 snd_hda_codec_write(codec, 0x23, 0,
14048 AC_VERB_SET_CONNECT_SEL, 0x3);
14049 if (present_laptop)
14050 snd_hda_codec_write(codec, 0x23, 0,
14051 AC_VERB_SET_CONNECT_SEL, 0x0);
14052 if (!present_dock && !present_laptop)
14053 snd_hda_codec_write(codec, 0x23, 0,
14054 AC_VERB_SET_CONNECT_SEL, 0x1);
14057 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14060 switch (res >> 26) {
14061 case ALC880_HP_EVENT:
14062 alc269_quanta_fl1_speaker_automute(codec);
14064 case ALC880_MIC_EVENT:
14065 alc_mic_automute(codec);
14070 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14073 if ((res >> 26) == ALC880_HP_EVENT)
14074 alc269_lifebook_speaker_automute(codec);
14075 if ((res >> 26) == ALC880_MIC_EVENT)
14076 alc269_lifebook_mic_autoswitch(codec);
14079 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14081 struct alc_spec *spec = codec->spec;
14082 spec->autocfg.hp_pins[0] = 0x15;
14083 spec->autocfg.speaker_pins[0] = 0x14;
14084 spec->ext_mic.pin = 0x18;
14085 spec->ext_mic.mux_idx = 0;
14086 spec->int_mic.pin = 0x19;
14087 spec->int_mic.mux_idx = 1;
14088 spec->auto_mic = 1;
14091 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14093 alc269_quanta_fl1_speaker_automute(codec);
14094 alc_mic_automute(codec);
14097 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14099 alc269_lifebook_speaker_automute(codec);
14100 alc269_lifebook_mic_autoswitch(codec);
14103 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14104 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14105 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14106 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14107 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14108 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14110 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14114 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14116 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14117 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14119 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14120 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14124 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14125 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14126 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14127 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14128 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14129 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14130 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14131 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14135 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14136 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14137 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14138 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14139 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14140 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14141 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14142 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14146 static struct hda_verb alc271_acer_dmic_verbs[] = {
14147 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14148 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14149 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14151 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14152 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14153 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14154 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14156 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14160 /* toggle speaker-output according to the hp-jack state */
14161 static void alc269_speaker_automute(struct hda_codec *codec)
14163 struct alc_spec *spec = codec->spec;
14164 unsigned int nid = spec->autocfg.hp_pins[0];
14165 unsigned int present;
14166 unsigned char bits;
14168 present = snd_hda_jack_detect(codec, nid);
14169 bits = present ? HDA_AMP_MUTE : 0;
14170 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14171 HDA_AMP_MUTE, bits);
14172 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14173 HDA_AMP_MUTE, bits);
14176 /* unsolicited event for HP jack sensing */
14177 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14180 switch (res >> 26) {
14181 case ALC880_HP_EVENT:
14182 alc269_speaker_automute(codec);
14184 case ALC880_MIC_EVENT:
14185 alc_mic_automute(codec);
14190 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14192 struct alc_spec *spec = codec->spec;
14193 spec->autocfg.hp_pins[0] = 0x15;
14194 spec->autocfg.speaker_pins[0] = 0x14;
14195 spec->ext_mic.pin = 0x18;
14196 spec->ext_mic.mux_idx = 0;
14197 spec->int_mic.pin = 0x19;
14198 spec->int_mic.mux_idx = 1;
14199 spec->auto_mic = 1;
14202 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14204 struct alc_spec *spec = codec->spec;
14205 spec->autocfg.hp_pins[0] = 0x15;
14206 spec->autocfg.speaker_pins[0] = 0x14;
14207 spec->ext_mic.pin = 0x18;
14208 spec->ext_mic.mux_idx = 0;
14209 spec->int_mic.pin = 0x12;
14210 spec->int_mic.mux_idx = 5;
14211 spec->auto_mic = 1;
14214 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14216 struct alc_spec *spec = codec->spec;
14217 spec->autocfg.hp_pins[0] = 0x21;
14218 spec->autocfg.speaker_pins[0] = 0x14;
14219 spec->ext_mic.pin = 0x18;
14220 spec->ext_mic.mux_idx = 0;
14221 spec->int_mic.pin = 0x19;
14222 spec->int_mic.mux_idx = 1;
14223 spec->auto_mic = 1;
14226 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14228 struct alc_spec *spec = codec->spec;
14229 spec->autocfg.hp_pins[0] = 0x21;
14230 spec->autocfg.speaker_pins[0] = 0x14;
14231 spec->ext_mic.pin = 0x18;
14232 spec->ext_mic.mux_idx = 0;
14233 spec->int_mic.pin = 0x12;
14234 spec->int_mic.mux_idx = 6;
14235 spec->auto_mic = 1;
14238 static void alc269_laptop_inithook(struct hda_codec *codec)
14240 alc269_speaker_automute(codec);
14241 alc_mic_automute(codec);
14245 * generic initialization of ADC, input mixers and output mixers
14247 static struct hda_verb alc269_init_verbs[] = {
14249 * Unmute ADC0 and set the default input to mic-in
14251 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14254 * Set up output mixers (0x02 - 0x03)
14256 /* set vol=0 to output mixers */
14257 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14258 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14260 /* set up input amps for analog loopback */
14261 /* Amp Indices: DAC = 0, mixer = 1 */
14262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14266 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14271 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14272 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14273 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14274 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14275 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14278 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14280 /* FIXME: use Mux-type input source selection */
14281 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14282 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14283 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14286 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14290 static struct hda_verb alc269vb_init_verbs[] = {
14292 * Unmute ADC0 and set the default input to mic-in
14294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14297 * Set up output mixers (0x02 - 0x03)
14299 /* set vol=0 to output mixers */
14300 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14301 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14303 /* set up input amps for analog loopback */
14304 /* Amp Indices: DAC = 0, mixer = 1 */
14305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14310 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14313 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14314 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14315 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14316 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14317 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14318 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14320 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14321 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14323 /* FIXME: use Mux-type input source selection */
14324 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14325 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14326 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14329 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14333 #define alc269_auto_create_multi_out_ctls \
14334 alc268_auto_create_multi_out_ctls
14335 #define alc269_auto_create_input_ctls \
14336 alc268_auto_create_input_ctls
14338 #ifdef CONFIG_SND_HDA_POWER_SAVE
14339 #define alc269_loopbacks alc880_loopbacks
14342 /* pcm configuration: identical with ALC880 */
14343 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14344 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14345 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14346 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14348 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14352 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14353 /* NID is set in alc_build_pcms */
14355 .open = alc880_playback_pcm_open,
14356 .prepare = alc880_playback_pcm_prepare,
14357 .cleanup = alc880_playback_pcm_cleanup
14361 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14365 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14366 /* NID is set in alc_build_pcms */
14369 #ifdef CONFIG_SND_HDA_POWER_SAVE
14370 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14372 switch (codec->subsystem_id) {
14379 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14381 /* update mute-LED according to the speaker mute state */
14382 if (nid == 0x01 || nid == 0x14) {
14384 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14389 /* mic2 vref pin is used for mute LED control */
14390 snd_hda_codec_update_cache(codec, 0x19, 0,
14391 AC_VERB_SET_PIN_WIDGET_CONTROL,
14394 return alc_check_power_status(codec, nid);
14396 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14398 static int alc275_setup_dual_adc(struct hda_codec *codec)
14400 struct alc_spec *spec = codec->spec;
14402 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14404 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14405 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14406 if (spec->ext_mic.pin <= 0x12) {
14407 spec->private_adc_nids[0] = 0x08;
14408 spec->private_adc_nids[1] = 0x11;
14409 spec->private_capsrc_nids[0] = 0x23;
14410 spec->private_capsrc_nids[1] = 0x22;
14412 spec->private_adc_nids[0] = 0x11;
14413 spec->private_adc_nids[1] = 0x08;
14414 spec->private_capsrc_nids[0] = 0x22;
14415 spec->private_capsrc_nids[1] = 0x23;
14417 spec->adc_nids = spec->private_adc_nids;
14418 spec->capsrc_nids = spec->private_capsrc_nids;
14419 spec->num_adc_nids = 2;
14420 spec->dual_adc_switch = 1;
14421 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14422 spec->adc_nids[0], spec->adc_nids[1]);
14429 * BIOS auto configuration
14431 static int alc269_parse_auto_config(struct hda_codec *codec)
14433 struct alc_spec *spec = codec->spec;
14435 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14437 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14442 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14445 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14449 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14451 alc_auto_parse_digital(codec);
14453 if (spec->kctls.list)
14454 add_mixer(spec, spec->kctls.list);
14456 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14457 add_verb(spec, alc269vb_init_verbs);
14458 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14460 add_verb(spec, alc269_init_verbs);
14461 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14464 spec->num_mux_defs = 1;
14465 spec->input_mux = &spec->private_imux[0];
14467 if (!alc275_setup_dual_adc(codec))
14468 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14469 sizeof(alc269_adc_candidates));
14471 /* set default input source */
14472 if (!spec->dual_adc_switch)
14473 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14474 spec->input_mux->items[0].index);
14476 err = alc_auto_add_mic_boost(codec);
14480 if (!spec->cap_mixer && !spec->no_analog)
14481 set_capture_mixer(codec);
14486 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14487 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14488 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14491 /* init callback for auto-configuration model -- overriding the default init */
14492 static void alc269_auto_init(struct hda_codec *codec)
14494 struct alc_spec *spec = codec->spec;
14495 alc269_auto_init_multi_out(codec);
14496 alc269_auto_init_hp_out(codec);
14497 alc269_auto_init_analog_input(codec);
14498 alc_auto_init_digital(codec);
14499 if (spec->unsol_event)
14500 alc_inithook(codec);
14504 ALC269_FIXUP_SONY_VAIO,
14507 static const struct alc_fixup alc269_fixups[] = {
14508 [ALC269_FIXUP_SONY_VAIO] = {
14509 .verbs = (const struct hda_verb[]) {
14510 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14516 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14517 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14518 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14524 * configuration and preset
14526 static const char *alc269_models[ALC269_MODEL_LAST] = {
14527 [ALC269_BASIC] = "basic",
14528 [ALC269_QUANTA_FL1] = "quanta",
14529 [ALC269_AMIC] = "laptop-amic",
14530 [ALC269_DMIC] = "laptop-dmic",
14531 [ALC269_FUJITSU] = "fujitsu",
14532 [ALC269_LIFEBOOK] = "lifebook",
14533 [ALC269_AUTO] = "auto",
14536 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14537 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14538 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14539 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14541 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14542 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14543 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14544 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14545 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14546 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14547 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14548 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14549 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14550 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14551 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14552 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14553 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14554 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14555 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14556 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14557 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14558 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14559 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14560 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14561 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14562 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14563 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14564 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14565 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14566 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14567 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14568 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14569 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14570 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14571 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14572 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14573 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14574 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14575 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14576 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14577 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14579 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14581 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14582 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14583 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14584 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14585 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14586 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14587 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14588 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14589 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14590 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14594 static struct alc_config_preset alc269_presets[] = {
14596 .mixers = { alc269_base_mixer },
14597 .init_verbs = { alc269_init_verbs },
14598 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14599 .dac_nids = alc269_dac_nids,
14601 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14602 .channel_mode = alc269_modes,
14603 .input_mux = &alc269_capture_source,
14605 [ALC269_QUANTA_FL1] = {
14606 .mixers = { alc269_quanta_fl1_mixer },
14607 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14608 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14609 .dac_nids = alc269_dac_nids,
14611 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14612 .channel_mode = alc269_modes,
14613 .input_mux = &alc269_capture_source,
14614 .unsol_event = alc269_quanta_fl1_unsol_event,
14615 .setup = alc269_quanta_fl1_setup,
14616 .init_hook = alc269_quanta_fl1_init_hook,
14619 .mixers = { alc269_laptop_mixer },
14620 .cap_mixer = alc269_laptop_analog_capture_mixer,
14621 .init_verbs = { alc269_init_verbs,
14622 alc269_laptop_amic_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_amic_setup,
14630 .init_hook = alc269_laptop_inithook,
14633 .mixers = { alc269_laptop_mixer },
14634 .cap_mixer = alc269_laptop_digital_capture_mixer,
14635 .init_verbs = { alc269_init_verbs,
14636 alc269_laptop_dmic_init_verbs },
14637 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14638 .dac_nids = alc269_dac_nids,
14640 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14641 .channel_mode = alc269_modes,
14642 .unsol_event = alc269_laptop_unsol_event,
14643 .setup = alc269_laptop_dmic_setup,
14644 .init_hook = alc269_laptop_inithook,
14646 [ALC269VB_AMIC] = {
14647 .mixers = { alc269vb_laptop_mixer },
14648 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14649 .init_verbs = { alc269vb_init_verbs,
14650 alc269vb_laptop_amic_init_verbs },
14651 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14652 .dac_nids = alc269_dac_nids,
14654 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14655 .channel_mode = alc269_modes,
14656 .unsol_event = alc269_laptop_unsol_event,
14657 .setup = alc269vb_laptop_amic_setup,
14658 .init_hook = alc269_laptop_inithook,
14660 [ALC269VB_DMIC] = {
14661 .mixers = { alc269vb_laptop_mixer },
14662 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14663 .init_verbs = { alc269vb_init_verbs,
14664 alc269vb_laptop_dmic_init_verbs },
14665 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14666 .dac_nids = alc269_dac_nids,
14668 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14669 .channel_mode = alc269_modes,
14670 .unsol_event = alc269_laptop_unsol_event,
14671 .setup = alc269vb_laptop_dmic_setup,
14672 .init_hook = alc269_laptop_inithook,
14674 [ALC269_FUJITSU] = {
14675 .mixers = { alc269_fujitsu_mixer },
14676 .cap_mixer = alc269_laptop_digital_capture_mixer,
14677 .init_verbs = { alc269_init_verbs,
14678 alc269_laptop_dmic_init_verbs },
14679 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14680 .dac_nids = alc269_dac_nids,
14682 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14683 .channel_mode = alc269_modes,
14684 .unsol_event = alc269_laptop_unsol_event,
14685 .setup = alc269_laptop_dmic_setup,
14686 .init_hook = alc269_laptop_inithook,
14688 [ALC269_LIFEBOOK] = {
14689 .mixers = { alc269_lifebook_mixer },
14690 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14691 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14692 .dac_nids = alc269_dac_nids,
14694 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14695 .channel_mode = alc269_modes,
14696 .input_mux = &alc269_capture_source,
14697 .unsol_event = alc269_lifebook_unsol_event,
14698 .init_hook = alc269_lifebook_init_hook,
14701 .mixers = { alc269_asus_mixer },
14702 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14703 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
14704 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14705 .dac_nids = alc269_dac_nids,
14706 .adc_nids = alc262_dmic_adc_nids,
14707 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
14708 .capsrc_nids = alc262_dmic_capsrc_nids,
14709 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14710 .channel_mode = alc269_modes,
14711 .input_mux = &alc269_capture_source,
14712 .dig_out_nid = ALC880_DIGOUT_NID,
14713 .unsol_event = alc_sku_unsol_event,
14714 .setup = alc269vb_laptop_dmic_setup,
14715 .init_hook = alc_inithook,
14719 static int patch_alc269(struct hda_codec *codec)
14721 struct alc_spec *spec;
14724 int is_alc269vb = 0;
14726 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14730 codec->spec = spec;
14732 alc_auto_parse_customize_define(codec);
14734 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14735 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14736 spec->cdefine.platform_type == 1)
14737 alc_codec_rename(codec, "ALC271X");
14739 alc_codec_rename(codec, "ALC259");
14742 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14744 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14748 if (board_config < 0) {
14749 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14751 board_config = ALC269_AUTO;
14754 if (board_config == ALC269_AUTO)
14755 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14757 if (board_config == ALC269_AUTO) {
14758 /* automatic parse from the BIOS config */
14759 err = alc269_parse_auto_config(codec);
14765 "hda_codec: Cannot set up configuration "
14766 "from BIOS. Using base mode...\n");
14767 board_config = ALC269_BASIC;
14771 if (has_cdefine_beep(codec)) {
14772 err = snd_hda_attach_beep_device(codec, 0x1);
14779 if (board_config != ALC269_AUTO)
14780 setup_preset(codec, &alc269_presets[board_config]);
14782 if (board_config == ALC269_QUANTA_FL1) {
14783 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14784 * fix the sample rate of analog I/O to 44.1kHz
14786 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14787 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14788 } else if (spec->dual_adc_switch) {
14789 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14790 /* switch ADC dynamically */
14791 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14793 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14794 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14796 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14797 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14799 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14800 if (!is_alc269vb) {
14801 spec->adc_nids = alc269_adc_nids;
14802 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14803 spec->capsrc_nids = alc269_capsrc_nids;
14805 spec->adc_nids = alc269vb_adc_nids;
14806 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14807 spec->capsrc_nids = alc269vb_capsrc_nids;
14811 if (!spec->cap_mixer)
14812 set_capture_mixer(codec);
14813 if (has_cdefine_beep(codec))
14814 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14816 if (board_config == ALC269_AUTO)
14817 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14819 spec->vmaster_nid = 0x02;
14821 codec->patch_ops = alc_patch_ops;
14822 if (board_config == ALC269_AUTO)
14823 spec->init_hook = alc269_auto_init;
14824 #ifdef CONFIG_SND_HDA_POWER_SAVE
14825 if (!spec->loopback.amplist)
14826 spec->loopback.amplist = alc269_loopbacks;
14827 if (alc269_mic2_for_mute_led(codec))
14828 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14835 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14839 * set the path ways for 2 channel output
14840 * need to set the codec line out and mic 1 pin widgets to inputs
14842 static struct hda_verb alc861_threestack_ch2_init[] = {
14843 /* set pin widget 1Ah (line in) for input */
14844 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14845 /* set pin widget 18h (mic1/2) for input, for mic also enable
14848 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14850 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14852 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14853 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14859 * need to set the codec line out and mic 1 pin widgets to outputs
14861 static struct hda_verb alc861_threestack_ch6_init[] = {
14862 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14863 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14864 /* set pin widget 18h (mic1) for output (CLFE)*/
14865 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14867 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14868 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14870 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14872 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14873 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14878 static struct hda_channel_mode alc861_threestack_modes[2] = {
14879 { 2, alc861_threestack_ch2_init },
14880 { 6, alc861_threestack_ch6_init },
14882 /* Set mic1 as input and unmute the mixer */
14883 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14884 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14885 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14888 /* Set mic1 as output and mute mixer */
14889 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14890 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14891 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14895 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14896 { 2, alc861_uniwill_m31_ch2_init },
14897 { 4, alc861_uniwill_m31_ch4_init },
14900 /* Set mic1 and line-in as input and unmute the mixer */
14901 static struct hda_verb alc861_asus_ch2_init[] = {
14902 /* set pin widget 1Ah (line in) for input */
14903 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14904 /* set pin widget 18h (mic1/2) for input, for mic also enable
14907 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14909 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14911 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14912 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14916 /* Set mic1 nad line-in as output and mute mixer */
14917 static struct hda_verb alc861_asus_ch6_init[] = {
14918 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14919 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14920 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14921 /* set pin widget 18h (mic1) for output (CLFE)*/
14922 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14923 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14924 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14925 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14927 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14929 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14930 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14935 static struct hda_channel_mode alc861_asus_modes[2] = {
14936 { 2, alc861_asus_ch2_init },
14937 { 6, alc861_asus_ch6_init },
14942 static struct snd_kcontrol_new alc861_base_mixer[] = {
14943 /* output mixer control */
14944 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14945 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14946 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14947 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14948 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14950 /*Input mixer control */
14951 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14952 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14953 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14954 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14955 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14956 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14957 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14958 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14965 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14966 /* output mixer control */
14967 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14968 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14969 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14970 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14971 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14973 /* Input mixer control */
14974 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14975 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14976 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14977 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14978 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14979 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14981 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14982 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14983 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14986 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14987 .name = "Channel Mode",
14988 .info = alc_ch_mode_info,
14989 .get = alc_ch_mode_get,
14990 .put = alc_ch_mode_put,
14991 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14996 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14997 /* output mixer control */
14998 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14999 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15000 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15005 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15006 /* output mixer control */
15007 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15008 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15009 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15010 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15011 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15013 /* Input mixer control */
15014 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15015 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15016 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15017 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15018 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15019 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15021 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15022 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15023 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15026 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15027 .name = "Channel Mode",
15028 .info = alc_ch_mode_info,
15029 .get = alc_ch_mode_get,
15030 .put = alc_ch_mode_put,
15031 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15036 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15037 /* output mixer control */
15038 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15039 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15040 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15041 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15042 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15044 /* Input mixer control */
15045 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15046 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15047 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15048 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15049 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15050 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15052 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15054 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15057 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15058 .name = "Channel Mode",
15059 .info = alc_ch_mode_info,
15060 .get = alc_ch_mode_get,
15061 .put = alc_ch_mode_put,
15062 .private_value = ARRAY_SIZE(alc861_asus_modes),
15067 /* additional mixer */
15068 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15069 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15070 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15075 * generic initialization of ADC, input mixers and output mixers
15077 static struct hda_verb alc861_base_init_verbs[] = {
15079 * Unmute ADC0 and set the default input to mic-in
15081 /* port-A for surround (rear panel) */
15082 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15083 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15084 /* port-B for mic-in (rear panel) with vref */
15085 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15086 /* port-C for line-in (rear panel) */
15087 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15088 /* port-D for Front */
15089 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15090 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15091 /* port-E for HP out (front panel) */
15092 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15093 /* route front PCM to HP */
15094 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15095 /* port-F for mic-in (front panel) with vref */
15096 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15097 /* port-G for CLFE (rear panel) */
15098 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15099 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15100 /* port-H for side (rear panel) */
15101 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15102 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15104 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15105 /* route front mic to ADC1*/
15106 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15107 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15109 /* Unmute DAC0~3 & spdif out*/
15110 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15111 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15112 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15113 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15116 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15117 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15118 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15119 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15120 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15122 /* Unmute Stereo Mixer 15 */
15123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15124 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15125 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15128 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15129 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15130 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15131 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15132 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15133 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15134 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15135 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15136 /* hp used DAC 3 (Front) */
15137 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15138 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15143 static struct hda_verb alc861_threestack_init_verbs[] = {
15145 * Unmute ADC0 and set the default input to mic-in
15147 /* port-A for surround (rear panel) */
15148 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15149 /* port-B for mic-in (rear panel) with vref */
15150 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15151 /* port-C for line-in (rear panel) */
15152 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15153 /* port-D for Front */
15154 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15155 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15156 /* port-E for HP out (front panel) */
15157 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15158 /* route front PCM to HP */
15159 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15160 /* port-F for mic-in (front panel) with vref */
15161 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15162 /* port-G for CLFE (rear panel) */
15163 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15164 /* port-H for side (rear panel) */
15165 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15167 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15168 /* route front mic to ADC1*/
15169 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15170 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15171 /* Unmute DAC0~3 & spdif out*/
15172 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15173 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15174 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15175 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15178 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15179 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15180 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15181 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15182 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15184 /* Unmute Stereo Mixer 15 */
15185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15186 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15190 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15191 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15192 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15193 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15194 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15195 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15196 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15197 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15198 /* hp used DAC 3 (Front) */
15199 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15200 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15204 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15206 * Unmute ADC0 and set the default input to mic-in
15208 /* port-A for surround (rear panel) */
15209 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15210 /* port-B for mic-in (rear panel) with vref */
15211 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15212 /* port-C for line-in (rear panel) */
15213 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15214 /* port-D for Front */
15215 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15216 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15217 /* port-E for HP out (front panel) */
15218 /* this has to be set to VREF80 */
15219 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15220 /* route front PCM to HP */
15221 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15222 /* port-F for mic-in (front panel) with vref */
15223 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15224 /* port-G for CLFE (rear panel) */
15225 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15226 /* port-H for side (rear panel) */
15227 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15229 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15230 /* route front mic to ADC1*/
15231 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15232 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15233 /* Unmute DAC0~3 & spdif out*/
15234 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15235 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15236 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15237 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15240 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15241 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15242 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15243 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15244 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15246 /* Unmute Stereo Mixer 15 */
15247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15252 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15253 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15254 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15255 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15257 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15258 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15259 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15260 /* hp used DAC 3 (Front) */
15261 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15266 static struct hda_verb alc861_asus_init_verbs[] = {
15268 * Unmute ADC0 and set the default input to mic-in
15270 /* port-A for surround (rear panel)
15271 * according to codec#0 this is the HP jack
15273 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15274 /* route front PCM to HP */
15275 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15276 /* port-B for mic-in (rear panel) with vref */
15277 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15278 /* port-C for line-in (rear panel) */
15279 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15280 /* port-D for Front */
15281 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15282 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15283 /* port-E for HP out (front panel) */
15284 /* this has to be set to VREF80 */
15285 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15286 /* route front PCM to HP */
15287 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15288 /* port-F for mic-in (front panel) with vref */
15289 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15290 /* port-G for CLFE (rear panel) */
15291 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15292 /* port-H for side (rear panel) */
15293 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15295 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15296 /* route front mic to ADC1*/
15297 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15298 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15299 /* Unmute DAC0~3 & spdif out*/
15300 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15301 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15302 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15303 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15305 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15306 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15307 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15308 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15309 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15311 /* Unmute Stereo Mixer 15 */
15312 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15314 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15317 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15318 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15319 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15320 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15321 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15323 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15324 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15325 /* hp used DAC 3 (Front) */
15326 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15327 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15331 /* additional init verbs for ASUS laptops */
15332 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15333 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15334 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15339 * generic initialization of ADC, input mixers and output mixers
15341 static struct hda_verb alc861_auto_init_verbs[] = {
15343 * Unmute ADC0 and set the default input to mic-in
15345 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15346 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15348 /* Unmute DAC0~3 & spdif out*/
15349 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15350 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15351 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15352 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15355 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15356 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15357 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15358 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15359 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15361 /* Unmute Stereo Mixer 15 */
15362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15363 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15367 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15369 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15370 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15374 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15379 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15380 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15381 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15382 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15383 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15385 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15390 static struct hda_verb alc861_toshiba_init_verbs[] = {
15391 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15396 /* toggle speaker-output according to the hp-jack state */
15397 static void alc861_toshiba_automute(struct hda_codec *codec)
15399 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15401 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15402 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15403 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15404 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15407 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15410 if ((res >> 26) == ALC880_HP_EVENT)
15411 alc861_toshiba_automute(codec);
15414 /* pcm configuration: identical with ALC880 */
15415 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15416 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15417 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15418 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15421 #define ALC861_DIGOUT_NID 0x07
15423 static struct hda_channel_mode alc861_8ch_modes[1] = {
15427 static hda_nid_t alc861_dac_nids[4] = {
15428 /* front, surround, clfe, side */
15429 0x03, 0x06, 0x05, 0x04
15432 static hda_nid_t alc660_dac_nids[3] = {
15433 /* front, clfe, surround */
15437 static hda_nid_t alc861_adc_nids[1] = {
15442 static struct hda_input_mux alc861_capture_source = {
15446 { "Front Mic", 0x3 },
15453 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15455 struct alc_spec *spec = codec->spec;
15456 hda_nid_t mix, srcs[5];
15459 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15461 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15464 for (i = 0; i < num; i++) {
15466 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15467 if (type != AC_WID_AUD_OUT)
15469 for (j = 0; j < spec->multiout.num_dacs; j++)
15470 if (spec->multiout.dac_nids[j] == srcs[i])
15472 if (j >= spec->multiout.num_dacs)
15478 /* fill in the dac_nids table from the parsed pin configuration */
15479 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15480 const struct auto_pin_cfg *cfg)
15482 struct alc_spec *spec = codec->spec;
15484 hda_nid_t nid, dac;
15486 spec->multiout.dac_nids = spec->private_dac_nids;
15487 for (i = 0; i < cfg->line_outs; i++) {
15488 nid = cfg->line_out_pins[i];
15489 dac = alc861_look_for_dac(codec, nid);
15492 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15497 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15498 hda_nid_t nid, unsigned int chs)
15500 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15501 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15504 /* add playback controls from the parsed DAC table */
15505 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15506 const struct auto_pin_cfg *cfg)
15508 struct alc_spec *spec = codec->spec;
15509 static const char *chname[4] = {
15510 "Front", "Surround", NULL /*CLFE*/, "Side"
15515 if (cfg->line_outs == 1) {
15516 const char *pfx = NULL;
15519 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15522 nid = spec->multiout.dac_nids[0];
15523 return alc861_create_out_sw(codec, pfx, nid, 3);
15527 for (i = 0; i < cfg->line_outs; i++) {
15528 nid = spec->multiout.dac_nids[i];
15533 err = alc861_create_out_sw(codec, "Center", nid, 1);
15536 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15540 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15548 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15550 struct alc_spec *spec = codec->spec;
15557 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15558 nid = alc861_look_for_dac(codec, pin);
15560 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15563 spec->multiout.hp_nid = nid;
15569 /* create playback/capture controls for input pins */
15570 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15571 const struct auto_pin_cfg *cfg)
15573 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15576 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15578 int pin_type, hda_nid_t dac)
15580 hda_nid_t mix, srcs[5];
15583 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15585 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15587 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15589 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15592 for (i = 0; i < num; i++) {
15594 if (srcs[i] == dac || srcs[i] == 0x15)
15595 mute = AMP_IN_UNMUTE(i);
15597 mute = AMP_IN_MUTE(i);
15598 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15603 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15605 struct alc_spec *spec = codec->spec;
15608 for (i = 0; i < spec->autocfg.line_outs; i++) {
15609 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15610 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15612 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15613 spec->multiout.dac_nids[i]);
15617 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15619 struct alc_spec *spec = codec->spec;
15621 if (spec->autocfg.hp_outs)
15622 alc861_auto_set_output_and_unmute(codec,
15623 spec->autocfg.hp_pins[0],
15625 spec->multiout.hp_nid);
15626 if (spec->autocfg.speaker_outs)
15627 alc861_auto_set_output_and_unmute(codec,
15628 spec->autocfg.speaker_pins[0],
15630 spec->multiout.dac_nids[0]);
15633 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15635 struct alc_spec *spec = codec->spec;
15636 struct auto_pin_cfg *cfg = &spec->autocfg;
15639 for (i = 0; i < cfg->num_inputs; i++) {
15640 hda_nid_t nid = cfg->inputs[i].pin;
15641 if (nid >= 0x0c && nid <= 0x11)
15642 alc_set_input_pin(codec, nid, i);
15646 /* parse the BIOS configuration and set up the alc_spec */
15647 /* return 1 if successful, 0 if the proper config is not found,
15648 * or a negative error code
15650 static int alc861_parse_auto_config(struct hda_codec *codec)
15652 struct alc_spec *spec = codec->spec;
15654 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15656 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15660 if (!spec->autocfg.line_outs)
15661 return 0; /* can't find valid BIOS pin config */
15663 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15666 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15669 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15672 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15676 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15678 alc_auto_parse_digital(codec);
15680 if (spec->kctls.list)
15681 add_mixer(spec, spec->kctls.list);
15683 add_verb(spec, alc861_auto_init_verbs);
15685 spec->num_mux_defs = 1;
15686 spec->input_mux = &spec->private_imux[0];
15688 spec->adc_nids = alc861_adc_nids;
15689 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15690 set_capture_mixer(codec);
15692 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15697 /* additional initialization for auto-configuration model */
15698 static void alc861_auto_init(struct hda_codec *codec)
15700 struct alc_spec *spec = codec->spec;
15701 alc861_auto_init_multi_out(codec);
15702 alc861_auto_init_hp_out(codec);
15703 alc861_auto_init_analog_input(codec);
15704 alc_auto_init_digital(codec);
15705 if (spec->unsol_event)
15706 alc_inithook(codec);
15709 #ifdef CONFIG_SND_HDA_POWER_SAVE
15710 static struct hda_amp_list alc861_loopbacks[] = {
15711 { 0x15, HDA_INPUT, 0 },
15712 { 0x15, HDA_INPUT, 1 },
15713 { 0x15, HDA_INPUT, 2 },
15714 { 0x15, HDA_INPUT, 3 },
15721 * configuration and preset
15723 static const char *alc861_models[ALC861_MODEL_LAST] = {
15724 [ALC861_3ST] = "3stack",
15725 [ALC660_3ST] = "3stack-660",
15726 [ALC861_3ST_DIG] = "3stack-dig",
15727 [ALC861_6ST_DIG] = "6stack-dig",
15728 [ALC861_UNIWILL_M31] = "uniwill-m31",
15729 [ALC861_TOSHIBA] = "toshiba",
15730 [ALC861_ASUS] = "asus",
15731 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15732 [ALC861_AUTO] = "auto",
15735 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15736 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15737 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15738 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15739 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15740 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15741 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15742 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15743 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15744 * Any other models that need this preset?
15746 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15747 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15748 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15749 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15750 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15751 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15752 /* FIXME: the below seems conflict */
15753 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15754 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15755 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15759 static struct alc_config_preset alc861_presets[] = {
15761 .mixers = { alc861_3ST_mixer },
15762 .init_verbs = { alc861_threestack_init_verbs },
15763 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15764 .dac_nids = alc861_dac_nids,
15765 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15766 .channel_mode = alc861_threestack_modes,
15768 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15769 .adc_nids = alc861_adc_nids,
15770 .input_mux = &alc861_capture_source,
15772 [ALC861_3ST_DIG] = {
15773 .mixers = { alc861_base_mixer },
15774 .init_verbs = { alc861_threestack_init_verbs },
15775 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15776 .dac_nids = alc861_dac_nids,
15777 .dig_out_nid = ALC861_DIGOUT_NID,
15778 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15779 .channel_mode = alc861_threestack_modes,
15781 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15782 .adc_nids = alc861_adc_nids,
15783 .input_mux = &alc861_capture_source,
15785 [ALC861_6ST_DIG] = {
15786 .mixers = { alc861_base_mixer },
15787 .init_verbs = { alc861_base_init_verbs },
15788 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15789 .dac_nids = alc861_dac_nids,
15790 .dig_out_nid = ALC861_DIGOUT_NID,
15791 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15792 .channel_mode = alc861_8ch_modes,
15793 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15794 .adc_nids = alc861_adc_nids,
15795 .input_mux = &alc861_capture_source,
15798 .mixers = { alc861_3ST_mixer },
15799 .init_verbs = { alc861_threestack_init_verbs },
15800 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15801 .dac_nids = alc660_dac_nids,
15802 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15803 .channel_mode = alc861_threestack_modes,
15805 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15806 .adc_nids = alc861_adc_nids,
15807 .input_mux = &alc861_capture_source,
15809 [ALC861_UNIWILL_M31] = {
15810 .mixers = { alc861_uniwill_m31_mixer },
15811 .init_verbs = { alc861_uniwill_m31_init_verbs },
15812 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15813 .dac_nids = alc861_dac_nids,
15814 .dig_out_nid = ALC861_DIGOUT_NID,
15815 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15816 .channel_mode = alc861_uniwill_m31_modes,
15818 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15819 .adc_nids = alc861_adc_nids,
15820 .input_mux = &alc861_capture_source,
15822 [ALC861_TOSHIBA] = {
15823 .mixers = { alc861_toshiba_mixer },
15824 .init_verbs = { alc861_base_init_verbs,
15825 alc861_toshiba_init_verbs },
15826 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15827 .dac_nids = alc861_dac_nids,
15828 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15829 .channel_mode = alc883_3ST_2ch_modes,
15830 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15831 .adc_nids = alc861_adc_nids,
15832 .input_mux = &alc861_capture_source,
15833 .unsol_event = alc861_toshiba_unsol_event,
15834 .init_hook = alc861_toshiba_automute,
15837 .mixers = { alc861_asus_mixer },
15838 .init_verbs = { alc861_asus_init_verbs },
15839 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15840 .dac_nids = alc861_dac_nids,
15841 .dig_out_nid = ALC861_DIGOUT_NID,
15842 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15843 .channel_mode = alc861_asus_modes,
15846 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15847 .adc_nids = alc861_adc_nids,
15848 .input_mux = &alc861_capture_source,
15850 [ALC861_ASUS_LAPTOP] = {
15851 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15852 .init_verbs = { alc861_asus_init_verbs,
15853 alc861_asus_laptop_init_verbs },
15854 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15855 .dac_nids = alc861_dac_nids,
15856 .dig_out_nid = ALC861_DIGOUT_NID,
15857 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15858 .channel_mode = alc883_3ST_2ch_modes,
15860 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15861 .adc_nids = alc861_adc_nids,
15862 .input_mux = &alc861_capture_source,
15866 /* Pin config fixes */
15868 PINFIX_FSC_AMILO_PI1505,
15871 static const struct alc_fixup alc861_fixups[] = {
15872 [PINFIX_FSC_AMILO_PI1505] = {
15873 .pins = (const struct alc_pincfg[]) {
15874 { 0x0b, 0x0221101f }, /* HP */
15875 { 0x0f, 0x90170310 }, /* speaker */
15881 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15882 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15886 static int patch_alc861(struct hda_codec *codec)
15888 struct alc_spec *spec;
15892 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15896 codec->spec = spec;
15898 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15902 if (board_config < 0) {
15903 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15905 board_config = ALC861_AUTO;
15908 if (board_config == ALC861_AUTO)
15909 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15911 if (board_config == ALC861_AUTO) {
15912 /* automatic parse from the BIOS config */
15913 err = alc861_parse_auto_config(codec);
15919 "hda_codec: Cannot set up configuration "
15920 "from BIOS. Using base mode...\n");
15921 board_config = ALC861_3ST_DIG;
15925 err = snd_hda_attach_beep_device(codec, 0x23);
15931 if (board_config != ALC861_AUTO)
15932 setup_preset(codec, &alc861_presets[board_config]);
15934 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15935 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15937 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15938 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15940 if (!spec->cap_mixer)
15941 set_capture_mixer(codec);
15942 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15944 spec->vmaster_nid = 0x03;
15946 if (board_config == ALC861_AUTO)
15947 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15949 codec->patch_ops = alc_patch_ops;
15950 if (board_config == ALC861_AUTO) {
15951 spec->init_hook = alc861_auto_init;
15952 #ifdef CONFIG_SND_HDA_POWER_SAVE
15953 spec->power_hook = alc_power_eapd;
15956 #ifdef CONFIG_SND_HDA_POWER_SAVE
15957 if (!spec->loopback.amplist)
15958 spec->loopback.amplist = alc861_loopbacks;
15965 * ALC861-VD support
15969 * In addition, an independent DAC
15971 #define ALC861VD_DIGOUT_NID 0x06
15973 static hda_nid_t alc861vd_dac_nids[4] = {
15974 /* front, surr, clfe, side surr */
15975 0x02, 0x03, 0x04, 0x05
15978 /* dac_nids for ALC660vd are in a different order - according to
15979 * Realtek's driver.
15980 * This should probably result in a different mixer for 6stack models
15981 * of ALC660vd codecs, but for now there is only 3stack mixer
15982 * - and it is the same as in 861vd.
15983 * adc_nids in ALC660vd are (is) the same as in 861vd
15985 static hda_nid_t alc660vd_dac_nids[3] = {
15986 /* front, rear, clfe, rear_surr */
15990 static hda_nid_t alc861vd_adc_nids[1] = {
15995 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15998 /* FIXME: should be a matrix-type input source selection */
15999 static struct hda_input_mux alc861vd_capture_source = {
16003 { "Front Mic", 0x1 },
16009 static struct hda_input_mux alc861vd_dallas_capture_source = {
16012 { "Ext Mic", 0x0 },
16013 { "Int Mic", 0x1 },
16017 static struct hda_input_mux alc861vd_hp_capture_source = {
16020 { "Front Mic", 0x0 },
16021 { "ATAPI Mic", 0x1 },
16028 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16035 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16036 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16037 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16038 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16039 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16046 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16047 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16048 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16049 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16050 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16054 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16055 { 6, alc861vd_6stack_ch6_init },
16056 { 8, alc861vd_6stack_ch8_init },
16059 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16061 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16062 .name = "Channel Mode",
16063 .info = alc_ch_mode_info,
16064 .get = alc_ch_mode_get,
16065 .put = alc_ch_mode_put,
16070 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16071 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16073 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16074 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16075 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16077 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16078 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16080 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16082 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16084 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16085 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16087 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16088 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16092 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16096 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16097 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16098 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16100 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16101 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16109 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16110 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16111 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16115 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16119 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16123 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16124 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16126 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16127 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16132 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16133 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16134 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16135 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16139 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16143 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16147 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16148 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16153 /* Pin assignment: Speaker=0x14, HP = 0x15,
16154 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16156 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16157 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16158 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16159 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16160 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16161 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16162 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16163 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16164 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16165 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16166 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16170 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16171 * Front Mic=0x18, ATAPI Mic = 0x19,
16173 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16174 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16175 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16177 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16178 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16179 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16180 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16181 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16187 * generic initialization of ADC, input mixers and output mixers
16189 static struct hda_verb alc861vd_volume_init_verbs[] = {
16191 * Unmute ADC0 and set the default input to mic-in
16193 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16194 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16196 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16197 * the analog-loopback mixer widget
16199 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16200 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16206 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16209 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16213 * Set up output mixers (0x02 - 0x05)
16215 /* set vol=0 to output mixers */
16216 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16217 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16218 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16219 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16221 /* set up input amps for analog loopback */
16222 /* Amp Indices: DAC = 0, mixer = 1 */
16223 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16224 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16225 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16226 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16227 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16228 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16229 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16230 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16236 * 3-stack pin configuration:
16237 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16239 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16241 * Set pin mode and muting
16243 /* set front pin widgets 0x14 for output */
16244 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16245 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16246 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16248 /* Mic (rear) pin: input vref at 80% */
16249 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16250 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16251 /* Front Mic pin: input vref at 80% */
16252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16254 /* Line In pin: input */
16255 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16257 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16259 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16260 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16261 /* CD pin widget for input */
16262 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16268 * 6-stack pin configuration:
16270 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16272 * Set pin mode and muting
16274 /* set front pin widgets 0x14 for output */
16275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16276 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16277 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16279 /* Rear Pin: output 1 (0x0d) */
16280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16282 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16283 /* CLFE Pin: output 2 (0x0e) */
16284 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16285 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16286 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16287 /* Side Pin: output 3 (0x0f) */
16288 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16289 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16290 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16292 /* Mic (rear) pin: input vref at 80% */
16293 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16294 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16295 /* Front Mic pin: input vref at 80% */
16296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16298 /* Line In pin: input */
16299 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16301 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16302 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16303 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16304 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16305 /* CD pin widget for input */
16306 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16311 static struct hda_verb alc861vd_eapd_verbs[] = {
16312 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16316 static struct hda_verb alc660vd_eapd_verbs[] = {
16317 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16318 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16322 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16326 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16327 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16331 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16333 unsigned int present;
16334 unsigned char bits;
16336 present = snd_hda_jack_detect(codec, 0x18);
16337 bits = present ? HDA_AMP_MUTE : 0;
16339 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16340 HDA_AMP_MUTE, bits);
16343 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16345 struct alc_spec *spec = codec->spec;
16346 spec->autocfg.hp_pins[0] = 0x1b;
16347 spec->autocfg.speaker_pins[0] = 0x14;
16350 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16352 alc_automute_amp(codec);
16353 alc861vd_lenovo_mic_automute(codec);
16356 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16359 switch (res >> 26) {
16360 case ALC880_MIC_EVENT:
16361 alc861vd_lenovo_mic_automute(codec);
16364 alc_automute_amp_unsol_event(codec, res);
16369 static struct hda_verb alc861vd_dallas_verbs[] = {
16370 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16371 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16372 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16373 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16377 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16378 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16379 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16380 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16381 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16382 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16385 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16388 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16389 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16390 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16391 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16393 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16394 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16395 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16396 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16398 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16399 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16400 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16407 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16408 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16409 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16414 /* toggle speaker-output according to the hp-jack state */
16415 static void alc861vd_dallas_setup(struct hda_codec *codec)
16417 struct alc_spec *spec = codec->spec;
16419 spec->autocfg.hp_pins[0] = 0x15;
16420 spec->autocfg.speaker_pins[0] = 0x14;
16423 #ifdef CONFIG_SND_HDA_POWER_SAVE
16424 #define alc861vd_loopbacks alc880_loopbacks
16427 /* pcm configuration: identical with ALC880 */
16428 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16429 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16430 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16431 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16434 * configuration and preset
16436 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16437 [ALC660VD_3ST] = "3stack-660",
16438 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16439 [ALC660VD_ASUS_V1S] = "asus-v1s",
16440 [ALC861VD_3ST] = "3stack",
16441 [ALC861VD_3ST_DIG] = "3stack-digout",
16442 [ALC861VD_6ST_DIG] = "6stack-digout",
16443 [ALC861VD_LENOVO] = "lenovo",
16444 [ALC861VD_DALLAS] = "dallas",
16445 [ALC861VD_HP] = "hp",
16446 [ALC861VD_AUTO] = "auto",
16449 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16450 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16451 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16452 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16453 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16454 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16455 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16456 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16457 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16458 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16459 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16460 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16461 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16462 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16463 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16464 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16468 static struct alc_config_preset alc861vd_presets[] = {
16470 .mixers = { alc861vd_3st_mixer },
16471 .init_verbs = { alc861vd_volume_init_verbs,
16472 alc861vd_3stack_init_verbs },
16473 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16474 .dac_nids = alc660vd_dac_nids,
16475 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16476 .channel_mode = alc861vd_3stack_2ch_modes,
16477 .input_mux = &alc861vd_capture_source,
16479 [ALC660VD_3ST_DIG] = {
16480 .mixers = { alc861vd_3st_mixer },
16481 .init_verbs = { alc861vd_volume_init_verbs,
16482 alc861vd_3stack_init_verbs },
16483 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16484 .dac_nids = alc660vd_dac_nids,
16485 .dig_out_nid = ALC861VD_DIGOUT_NID,
16486 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16487 .channel_mode = alc861vd_3stack_2ch_modes,
16488 .input_mux = &alc861vd_capture_source,
16491 .mixers = { alc861vd_3st_mixer },
16492 .init_verbs = { alc861vd_volume_init_verbs,
16493 alc861vd_3stack_init_verbs },
16494 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16495 .dac_nids = alc861vd_dac_nids,
16496 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16497 .channel_mode = alc861vd_3stack_2ch_modes,
16498 .input_mux = &alc861vd_capture_source,
16500 [ALC861VD_3ST_DIG] = {
16501 .mixers = { alc861vd_3st_mixer },
16502 .init_verbs = { alc861vd_volume_init_verbs,
16503 alc861vd_3stack_init_verbs },
16504 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16505 .dac_nids = alc861vd_dac_nids,
16506 .dig_out_nid = ALC861VD_DIGOUT_NID,
16507 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16508 .channel_mode = alc861vd_3stack_2ch_modes,
16509 .input_mux = &alc861vd_capture_source,
16511 [ALC861VD_6ST_DIG] = {
16512 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16513 .init_verbs = { alc861vd_volume_init_verbs,
16514 alc861vd_6stack_init_verbs },
16515 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16516 .dac_nids = alc861vd_dac_nids,
16517 .dig_out_nid = ALC861VD_DIGOUT_NID,
16518 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16519 .channel_mode = alc861vd_6stack_modes,
16520 .input_mux = &alc861vd_capture_source,
16522 [ALC861VD_LENOVO] = {
16523 .mixers = { alc861vd_lenovo_mixer },
16524 .init_verbs = { alc861vd_volume_init_verbs,
16525 alc861vd_3stack_init_verbs,
16526 alc861vd_eapd_verbs,
16527 alc861vd_lenovo_unsol_verbs },
16528 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16529 .dac_nids = alc660vd_dac_nids,
16530 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16531 .channel_mode = alc861vd_3stack_2ch_modes,
16532 .input_mux = &alc861vd_capture_source,
16533 .unsol_event = alc861vd_lenovo_unsol_event,
16534 .setup = alc861vd_lenovo_setup,
16535 .init_hook = alc861vd_lenovo_init_hook,
16537 [ALC861VD_DALLAS] = {
16538 .mixers = { alc861vd_dallas_mixer },
16539 .init_verbs = { alc861vd_dallas_verbs },
16540 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16541 .dac_nids = alc861vd_dac_nids,
16542 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16543 .channel_mode = alc861vd_3stack_2ch_modes,
16544 .input_mux = &alc861vd_dallas_capture_source,
16545 .unsol_event = alc_automute_amp_unsol_event,
16546 .setup = alc861vd_dallas_setup,
16547 .init_hook = alc_automute_amp,
16550 .mixers = { alc861vd_hp_mixer },
16551 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16552 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16553 .dac_nids = alc861vd_dac_nids,
16554 .dig_out_nid = ALC861VD_DIGOUT_NID,
16555 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16556 .channel_mode = alc861vd_3stack_2ch_modes,
16557 .input_mux = &alc861vd_hp_capture_source,
16558 .unsol_event = alc_automute_amp_unsol_event,
16559 .setup = alc861vd_dallas_setup,
16560 .init_hook = alc_automute_amp,
16562 [ALC660VD_ASUS_V1S] = {
16563 .mixers = { alc861vd_lenovo_mixer },
16564 .init_verbs = { alc861vd_volume_init_verbs,
16565 alc861vd_3stack_init_verbs,
16566 alc861vd_eapd_verbs,
16567 alc861vd_lenovo_unsol_verbs },
16568 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16569 .dac_nids = alc660vd_dac_nids,
16570 .dig_out_nid = ALC861VD_DIGOUT_NID,
16571 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16572 .channel_mode = alc861vd_3stack_2ch_modes,
16573 .input_mux = &alc861vd_capture_source,
16574 .unsol_event = alc861vd_lenovo_unsol_event,
16575 .setup = alc861vd_lenovo_setup,
16576 .init_hook = alc861vd_lenovo_init_hook,
16581 * BIOS auto configuration
16583 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16584 const struct auto_pin_cfg *cfg)
16586 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16590 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16591 hda_nid_t nid, int pin_type, int dac_idx)
16593 alc_set_pin_output(codec, nid, pin_type);
16596 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16598 struct alc_spec *spec = codec->spec;
16601 for (i = 0; i <= HDA_SIDE; i++) {
16602 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16603 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16605 alc861vd_auto_set_output_and_unmute(codec, nid,
16611 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16613 struct alc_spec *spec = codec->spec;
16616 pin = spec->autocfg.hp_pins[0];
16617 if (pin) /* connect to front and use dac 0 */
16618 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16619 pin = spec->autocfg.speaker_pins[0];
16621 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16624 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16626 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16628 struct alc_spec *spec = codec->spec;
16629 struct auto_pin_cfg *cfg = &spec->autocfg;
16632 for (i = 0; i < cfg->num_inputs; i++) {
16633 hda_nid_t nid = cfg->inputs[i].pin;
16634 if (alc_is_input_pin(codec, nid)) {
16635 alc_set_input_pin(codec, nid, i);
16636 if (nid != ALC861VD_PIN_CD_NID &&
16637 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16638 snd_hda_codec_write(codec, nid, 0,
16639 AC_VERB_SET_AMP_GAIN_MUTE,
16645 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16647 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16648 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16650 /* add playback controls from the parsed DAC table */
16651 /* Based on ALC880 version. But ALC861VD has separate,
16652 * different NIDs for mute/unmute switch and volume control */
16653 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16654 const struct auto_pin_cfg *cfg)
16656 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16657 hda_nid_t nid_v, nid_s;
16660 for (i = 0; i < cfg->line_outs; i++) {
16661 if (!spec->multiout.dac_nids[i])
16663 nid_v = alc861vd_idx_to_mixer_vol(
16665 spec->multiout.dac_nids[i]));
16666 nid_s = alc861vd_idx_to_mixer_switch(
16668 spec->multiout.dac_nids[i]));
16672 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16674 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16678 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16680 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16684 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16686 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16690 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16692 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16698 if (cfg->line_outs == 1 &&
16699 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16706 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16707 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16711 if (cfg->line_outs == 1 &&
16712 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16714 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16715 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16724 /* add playback controls for speaker and HP outputs */
16725 /* Based on ALC880 version. But ALC861VD has separate,
16726 * different NIDs for mute/unmute switch and volume control */
16727 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16728 hda_nid_t pin, const char *pfx)
16730 hda_nid_t nid_v, nid_s;
16736 if (alc880_is_fixed_pin(pin)) {
16737 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16738 /* specify the DAC as the extra output */
16739 if (!spec->multiout.hp_nid)
16740 spec->multiout.hp_nid = nid_v;
16742 spec->multiout.extra_out_nid[0] = nid_v;
16743 /* control HP volume/switch on the output mixer amp */
16744 nid_v = alc861vd_idx_to_mixer_vol(
16745 alc880_fixed_pin_idx(pin));
16746 nid_s = alc861vd_idx_to_mixer_switch(
16747 alc880_fixed_pin_idx(pin));
16749 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16750 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16753 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16754 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16757 } else if (alc880_is_multi_pin(pin)) {
16758 /* set manual connection */
16759 /* we have only a switch on HP-out PIN */
16760 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16761 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16768 /* parse the BIOS configuration and set up the alc_spec
16769 * return 1 if successful, 0 if the proper config is not found,
16770 * or a negative error code
16771 * Based on ALC880 version - had to change it to override
16772 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16773 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16775 struct alc_spec *spec = codec->spec;
16777 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16779 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16783 if (!spec->autocfg.line_outs)
16784 return 0; /* can't find valid BIOS pin config */
16786 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16789 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16792 err = alc861vd_auto_create_extra_out(spec,
16793 spec->autocfg.speaker_pins[0],
16797 err = alc861vd_auto_create_extra_out(spec,
16798 spec->autocfg.hp_pins[0],
16802 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16806 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16808 alc_auto_parse_digital(codec);
16810 if (spec->kctls.list)
16811 add_mixer(spec, spec->kctls.list);
16813 add_verb(spec, alc861vd_volume_init_verbs);
16815 spec->num_mux_defs = 1;
16816 spec->input_mux = &spec->private_imux[0];
16818 err = alc_auto_add_mic_boost(codec);
16822 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16827 /* additional initialization for auto-configuration model */
16828 static void alc861vd_auto_init(struct hda_codec *codec)
16830 struct alc_spec *spec = codec->spec;
16831 alc861vd_auto_init_multi_out(codec);
16832 alc861vd_auto_init_hp_out(codec);
16833 alc861vd_auto_init_analog_input(codec);
16834 alc861vd_auto_init_input_src(codec);
16835 alc_auto_init_digital(codec);
16836 if (spec->unsol_event)
16837 alc_inithook(codec);
16841 ALC660VD_FIX_ASUS_GPIO1
16845 static const struct alc_fixup alc861vd_fixups[] = {
16846 [ALC660VD_FIX_ASUS_GPIO1] = {
16847 .verbs = (const struct hda_verb[]) {
16848 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16849 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16850 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16856 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16857 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16861 static int patch_alc861vd(struct hda_codec *codec)
16863 struct alc_spec *spec;
16864 int err, board_config;
16866 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16870 codec->spec = spec;
16872 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16876 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16877 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16879 board_config = ALC861VD_AUTO;
16882 if (board_config == ALC861VD_AUTO)
16883 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16885 if (board_config == ALC861VD_AUTO) {
16886 /* automatic parse from the BIOS config */
16887 err = alc861vd_parse_auto_config(codec);
16893 "hda_codec: Cannot set up configuration "
16894 "from BIOS. Using base mode...\n");
16895 board_config = ALC861VD_3ST;
16899 err = snd_hda_attach_beep_device(codec, 0x23);
16905 if (board_config != ALC861VD_AUTO)
16906 setup_preset(codec, &alc861vd_presets[board_config]);
16908 if (codec->vendor_id == 0x10ec0660) {
16909 /* always turn on EAPD */
16910 add_verb(spec, alc660vd_eapd_verbs);
16913 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16914 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16916 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16917 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16919 if (!spec->adc_nids) {
16920 spec->adc_nids = alc861vd_adc_nids;
16921 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16923 if (!spec->capsrc_nids)
16924 spec->capsrc_nids = alc861vd_capsrc_nids;
16926 set_capture_mixer(codec);
16927 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16929 spec->vmaster_nid = 0x02;
16931 if (board_config == ALC861VD_AUTO)
16932 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16934 codec->patch_ops = alc_patch_ops;
16936 if (board_config == ALC861VD_AUTO)
16937 spec->init_hook = alc861vd_auto_init;
16938 #ifdef CONFIG_SND_HDA_POWER_SAVE
16939 if (!spec->loopback.amplist)
16940 spec->loopback.amplist = alc861vd_loopbacks;
16949 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16950 * configuration. Each pin widget can choose any input DACs and a mixer.
16951 * Each ADC is connected from a mixer of all inputs. This makes possible
16952 * 6-channel independent captures.
16954 * In addition, an independent DAC for the multi-playback (not used in this
16957 #define ALC662_DIGOUT_NID 0x06
16958 #define ALC662_DIGIN_NID 0x0a
16960 static hda_nid_t alc662_dac_nids[4] = {
16961 /* front, rear, clfe, rear_surr */
16965 static hda_nid_t alc272_dac_nids[2] = {
16969 static hda_nid_t alc662_adc_nids[2] = {
16974 static hda_nid_t alc272_adc_nids[1] = {
16979 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16980 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16984 /* FIXME: should be a matrix-type input source selection */
16985 static struct hda_input_mux alc662_capture_source = {
16989 { "Front Mic", 0x1 },
16995 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17003 static struct hda_input_mux alc663_capture_source = {
17007 { "Front Mic", 0x1 },
17012 #if 0 /* set to 1 for testing other input sources below */
17013 static struct hda_input_mux alc272_nc10_capture_source = {
17016 { "Autoselect Mic", 0x0 },
17017 { "Internal Mic", 0x1 },
17018 { "In-0x02", 0x2 },
17019 { "In-0x03", 0x3 },
17020 { "In-0x04", 0x4 },
17021 { "In-0x05", 0x5 },
17022 { "In-0x06", 0x6 },
17023 { "In-0x07", 0x7 },
17024 { "In-0x08", 0x8 },
17025 { "In-0x09", 0x9 },
17026 { "In-0x0a", 0x0a },
17027 { "In-0x0b", 0x0b },
17028 { "In-0x0c", 0x0c },
17029 { "In-0x0d", 0x0d },
17030 { "In-0x0e", 0x0e },
17031 { "In-0x0f", 0x0f },
17039 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17046 static struct hda_verb alc662_3ST_ch2_init[] = {
17047 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17048 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17049 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17050 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17057 static struct hda_verb alc662_3ST_ch6_init[] = {
17058 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17059 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17060 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17061 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17062 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17063 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17067 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17068 { 2, alc662_3ST_ch2_init },
17069 { 6, alc662_3ST_ch6_init },
17075 static struct hda_verb alc662_sixstack_ch6_init[] = {
17076 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17077 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17078 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17085 static struct hda_verb alc662_sixstack_ch8_init[] = {
17086 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17087 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17088 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17092 static struct hda_channel_mode alc662_5stack_modes[2] = {
17093 { 2, alc662_sixstack_ch6_init },
17094 { 6, alc662_sixstack_ch8_init },
17097 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17098 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17101 static struct snd_kcontrol_new alc662_base_mixer[] = {
17102 /* output mixer control */
17103 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17104 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17105 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17106 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17107 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17108 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17109 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17110 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17113 /*Input mixer control */
17114 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17115 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17116 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17117 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17118 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17119 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17120 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17121 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17125 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17126 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17127 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17131 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17132 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17135 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17136 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17140 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17141 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17142 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17143 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17144 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17145 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17146 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17147 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17148 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17156 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17157 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17161 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17162 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17163 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17164 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17165 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17167 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17168 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17174 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17175 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17176 ALC262_HIPPO_MASTER_SWITCH,
17178 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17179 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17180 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17182 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17183 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17184 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17188 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17189 ALC262_HIPPO_MASTER_SWITCH,
17190 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17191 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17192 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17193 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17194 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17202 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17203 .ops = &snd_hda_bind_vol,
17205 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17206 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17211 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17212 .ops = &snd_hda_bind_sw,
17214 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17215 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17220 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17221 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17222 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17228 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17229 .ops = &snd_hda_bind_sw,
17231 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17232 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17233 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17238 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17239 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17240 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17243 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17244 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17249 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17250 .ops = &snd_hda_bind_sw,
17252 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17253 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17254 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17259 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17260 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17261 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17263 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17264 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17265 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17269 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17270 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17271 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17275 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17276 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17280 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17281 .ops = &snd_hda_bind_vol,
17283 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17284 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17289 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17290 .ops = &snd_hda_bind_sw,
17292 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17293 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17298 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17299 HDA_BIND_VOL("Master Playback Volume",
17300 &alc663_asus_two_bind_master_vol),
17301 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17302 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17303 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17309 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17310 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17311 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17312 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17314 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17315 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17319 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17320 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17321 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17322 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17323 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17328 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17329 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17333 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17334 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17335 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17340 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17341 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17342 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17343 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17347 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17348 .ops = &snd_hda_bind_sw,
17350 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17351 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17352 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17353 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17354 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17359 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17360 .ops = &snd_hda_bind_sw,
17362 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17363 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17368 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17369 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17370 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17371 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17372 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17373 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17374 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17375 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17381 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17382 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17383 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17384 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17385 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17386 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17393 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17396 .name = "Channel Mode",
17397 .info = alc_ch_mode_info,
17398 .get = alc_ch_mode_get,
17399 .put = alc_ch_mode_put,
17404 static struct hda_verb alc662_init_verbs[] = {
17405 /* ADC: mute amp left and right */
17406 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17407 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17412 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17413 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17416 /* Front Pin: output 0 (0x0c) */
17417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17420 /* Rear Pin: output 1 (0x0d) */
17421 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17422 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17424 /* CLFE Pin: output 2 (0x0e) */
17425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17426 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17428 /* Mic (rear) pin: input vref at 80% */
17429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17431 /* Front Mic pin: input vref at 80% */
17432 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17433 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17434 /* Line In pin: input */
17435 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17436 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17437 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17438 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17439 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17440 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17441 /* CD pin widget for input */
17442 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17444 /* FIXME: use matrix-type input source selection */
17445 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17450 /* always trun on EAPD */
17451 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17452 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17457 static struct hda_verb alc663_init_verbs[] = {
17458 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17459 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17460 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17461 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17462 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17463 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17467 static struct hda_verb alc272_init_verbs[] = {
17468 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17469 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17470 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17471 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17472 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17473 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17479 static struct hda_verb alc662_sue_init_verbs[] = {
17480 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17481 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17485 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17486 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17487 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17491 /* Set Unsolicited Event*/
17492 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17493 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17494 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17498 static struct hda_verb alc663_m51va_init_verbs[] = {
17499 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17500 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17501 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17502 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17503 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17506 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17507 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17511 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17512 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17513 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17514 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17515 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17518 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17522 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17525 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17526 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17529 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17534 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17537 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17540 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17541 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17545 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17546 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17547 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17548 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17549 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17551 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17552 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17555 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17556 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17557 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17561 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17562 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17563 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17564 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17565 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17568 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17571 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17572 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17573 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17577 static struct hda_verb alc663_g71v_init_verbs[] = {
17578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17579 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17580 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17582 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17583 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17584 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17586 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17587 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17588 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17592 static struct hda_verb alc663_g50v_init_verbs[] = {
17593 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17594 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17595 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17597 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17598 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17602 static struct hda_verb alc662_ecs_init_verbs[] = {
17603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17606 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17610 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17611 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17612 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17614 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17615 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17616 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17617 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17621 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17625 static struct hda_verb alc272_dell_init_verbs[] = {
17626 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17627 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17629 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17630 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17631 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17632 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17633 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17635 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17636 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17640 static struct hda_verb alc663_mode7_init_verbs[] = {
17641 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17642 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17643 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17644 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17645 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17646 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17647 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17648 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17649 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17650 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17653 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17654 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17655 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17659 static struct hda_verb alc663_mode8_init_verbs[] = {
17660 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17663 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17664 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17665 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17666 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17667 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17668 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17669 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17670 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17672 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17673 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17674 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17675 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17679 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17680 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17681 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17685 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17686 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17687 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17691 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17693 unsigned int present;
17694 unsigned char bits;
17696 present = snd_hda_jack_detect(codec, 0x14);
17697 bits = present ? HDA_AMP_MUTE : 0;
17699 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17700 HDA_AMP_MUTE, bits);
17703 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17705 unsigned int present;
17706 unsigned char bits;
17708 present = snd_hda_jack_detect(codec, 0x1b);
17709 bits = present ? HDA_AMP_MUTE : 0;
17711 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17712 HDA_AMP_MUTE, bits);
17713 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17714 HDA_AMP_MUTE, bits);
17717 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17720 if ((res >> 26) == ALC880_HP_EVENT)
17721 alc662_lenovo_101e_all_automute(codec);
17722 if ((res >> 26) == ALC880_FRONT_EVENT)
17723 alc662_lenovo_101e_ispeaker_automute(codec);
17726 /* unsolicited event for HP jack sensing */
17727 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17730 if ((res >> 26) == ALC880_MIC_EVENT)
17731 alc_mic_automute(codec);
17733 alc262_hippo_unsol_event(codec, res);
17736 static void alc662_eeepc_setup(struct hda_codec *codec)
17738 struct alc_spec *spec = codec->spec;
17740 alc262_hippo1_setup(codec);
17741 spec->ext_mic.pin = 0x18;
17742 spec->ext_mic.mux_idx = 0;
17743 spec->int_mic.pin = 0x19;
17744 spec->int_mic.mux_idx = 1;
17745 spec->auto_mic = 1;
17748 static void alc662_eeepc_inithook(struct hda_codec *codec)
17750 alc262_hippo_automute(codec);
17751 alc_mic_automute(codec);
17754 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17756 struct alc_spec *spec = codec->spec;
17758 spec->autocfg.hp_pins[0] = 0x14;
17759 spec->autocfg.speaker_pins[0] = 0x1b;
17762 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17764 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17766 unsigned int present;
17767 unsigned char bits;
17769 present = snd_hda_jack_detect(codec, 0x21);
17770 bits = present ? HDA_AMP_MUTE : 0;
17771 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17772 HDA_AMP_MUTE, bits);
17773 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17774 HDA_AMP_MUTE, bits);
17777 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17779 unsigned int present;
17780 unsigned char bits;
17782 present = snd_hda_jack_detect(codec, 0x21);
17783 bits = present ? HDA_AMP_MUTE : 0;
17784 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17785 HDA_AMP_MUTE, bits);
17786 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17787 HDA_AMP_MUTE, bits);
17788 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17789 HDA_AMP_MUTE, bits);
17790 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17791 HDA_AMP_MUTE, bits);
17794 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17796 unsigned int present;
17797 unsigned char bits;
17799 present = snd_hda_jack_detect(codec, 0x15);
17800 bits = present ? HDA_AMP_MUTE : 0;
17801 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17802 HDA_AMP_MUTE, bits);
17803 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17804 HDA_AMP_MUTE, bits);
17805 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17806 HDA_AMP_MUTE, bits);
17807 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17808 HDA_AMP_MUTE, bits);
17811 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17813 unsigned int present;
17814 unsigned char bits;
17816 present = snd_hda_jack_detect(codec, 0x1b);
17817 bits = present ? 0 : PIN_OUT;
17818 snd_hda_codec_write(codec, 0x14, 0,
17819 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17822 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17824 unsigned int present1, present2;
17826 present1 = snd_hda_jack_detect(codec, 0x21);
17827 present2 = snd_hda_jack_detect(codec, 0x15);
17829 if (present1 || present2) {
17830 snd_hda_codec_write_cache(codec, 0x14, 0,
17831 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17833 snd_hda_codec_write_cache(codec, 0x14, 0,
17834 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17838 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17840 unsigned int present1, present2;
17842 present1 = snd_hda_jack_detect(codec, 0x1b);
17843 present2 = snd_hda_jack_detect(codec, 0x15);
17845 if (present1 || present2) {
17846 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17847 HDA_AMP_MUTE, HDA_AMP_MUTE);
17848 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17849 HDA_AMP_MUTE, HDA_AMP_MUTE);
17851 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17853 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17858 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17860 unsigned int present1, present2;
17862 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17863 AC_VERB_GET_PIN_SENSE, 0)
17864 & AC_PINSENSE_PRESENCE;
17865 present2 = snd_hda_codec_read(codec, 0x21, 0,
17866 AC_VERB_GET_PIN_SENSE, 0)
17867 & AC_PINSENSE_PRESENCE;
17869 if (present1 || present2) {
17870 snd_hda_codec_write_cache(codec, 0x14, 0,
17871 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17872 snd_hda_codec_write_cache(codec, 0x17, 0,
17873 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17875 snd_hda_codec_write_cache(codec, 0x14, 0,
17876 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17877 snd_hda_codec_write_cache(codec, 0x17, 0,
17878 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17882 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17884 unsigned int present1, present2;
17886 present1 = snd_hda_codec_read(codec, 0x21, 0,
17887 AC_VERB_GET_PIN_SENSE, 0)
17888 & AC_PINSENSE_PRESENCE;
17889 present2 = snd_hda_codec_read(codec, 0x15, 0,
17890 AC_VERB_GET_PIN_SENSE, 0)
17891 & AC_PINSENSE_PRESENCE;
17893 if (present1 || present2) {
17894 snd_hda_codec_write_cache(codec, 0x14, 0,
17895 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17896 snd_hda_codec_write_cache(codec, 0x17, 0,
17897 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17899 snd_hda_codec_write_cache(codec, 0x14, 0,
17900 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17901 snd_hda_codec_write_cache(codec, 0x17, 0,
17902 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17906 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17909 switch (res >> 26) {
17910 case ALC880_HP_EVENT:
17911 alc663_m51va_speaker_automute(codec);
17913 case ALC880_MIC_EVENT:
17914 alc_mic_automute(codec);
17919 static void alc663_m51va_setup(struct hda_codec *codec)
17921 struct alc_spec *spec = codec->spec;
17922 spec->ext_mic.pin = 0x18;
17923 spec->ext_mic.mux_idx = 0;
17924 spec->int_mic.pin = 0x12;
17925 spec->int_mic.mux_idx = 9;
17926 spec->auto_mic = 1;
17929 static void alc663_m51va_inithook(struct hda_codec *codec)
17931 alc663_m51va_speaker_automute(codec);
17932 alc_mic_automute(codec);
17935 /* ***************** Mode1 ******************************/
17936 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17938 static void alc663_mode1_setup(struct hda_codec *codec)
17940 struct alc_spec *spec = codec->spec;
17941 spec->ext_mic.pin = 0x18;
17942 spec->ext_mic.mux_idx = 0;
17943 spec->int_mic.pin = 0x19;
17944 spec->int_mic.mux_idx = 1;
17945 spec->auto_mic = 1;
17948 #define alc663_mode1_inithook alc663_m51va_inithook
17950 /* ***************** Mode2 ******************************/
17951 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17954 switch (res >> 26) {
17955 case ALC880_HP_EVENT:
17956 alc662_f5z_speaker_automute(codec);
17958 case ALC880_MIC_EVENT:
17959 alc_mic_automute(codec);
17964 #define alc662_mode2_setup alc663_mode1_setup
17966 static void alc662_mode2_inithook(struct hda_codec *codec)
17968 alc662_f5z_speaker_automute(codec);
17969 alc_mic_automute(codec);
17971 /* ***************** Mode3 ******************************/
17972 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17975 switch (res >> 26) {
17976 case ALC880_HP_EVENT:
17977 alc663_two_hp_m1_speaker_automute(codec);
17979 case ALC880_MIC_EVENT:
17980 alc_mic_automute(codec);
17985 #define alc663_mode3_setup alc663_mode1_setup
17987 static void alc663_mode3_inithook(struct hda_codec *codec)
17989 alc663_two_hp_m1_speaker_automute(codec);
17990 alc_mic_automute(codec);
17992 /* ***************** Mode4 ******************************/
17993 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17996 switch (res >> 26) {
17997 case ALC880_HP_EVENT:
17998 alc663_21jd_two_speaker_automute(codec);
18000 case ALC880_MIC_EVENT:
18001 alc_mic_automute(codec);
18006 #define alc663_mode4_setup alc663_mode1_setup
18008 static void alc663_mode4_inithook(struct hda_codec *codec)
18010 alc663_21jd_two_speaker_automute(codec);
18011 alc_mic_automute(codec);
18013 /* ***************** Mode5 ******************************/
18014 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18017 switch (res >> 26) {
18018 case ALC880_HP_EVENT:
18019 alc663_15jd_two_speaker_automute(codec);
18021 case ALC880_MIC_EVENT:
18022 alc_mic_automute(codec);
18027 #define alc663_mode5_setup alc663_mode1_setup
18029 static void alc663_mode5_inithook(struct hda_codec *codec)
18031 alc663_15jd_two_speaker_automute(codec);
18032 alc_mic_automute(codec);
18034 /* ***************** Mode6 ******************************/
18035 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18038 switch (res >> 26) {
18039 case ALC880_HP_EVENT:
18040 alc663_two_hp_m2_speaker_automute(codec);
18042 case ALC880_MIC_EVENT:
18043 alc_mic_automute(codec);
18048 #define alc663_mode6_setup alc663_mode1_setup
18050 static void alc663_mode6_inithook(struct hda_codec *codec)
18052 alc663_two_hp_m2_speaker_automute(codec);
18053 alc_mic_automute(codec);
18056 /* ***************** Mode7 ******************************/
18057 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18060 switch (res >> 26) {
18061 case ALC880_HP_EVENT:
18062 alc663_two_hp_m7_speaker_automute(codec);
18064 case ALC880_MIC_EVENT:
18065 alc_mic_automute(codec);
18070 #define alc663_mode7_setup alc663_mode1_setup
18072 static void alc663_mode7_inithook(struct hda_codec *codec)
18074 alc663_two_hp_m7_speaker_automute(codec);
18075 alc_mic_automute(codec);
18078 /* ***************** Mode8 ******************************/
18079 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18082 switch (res >> 26) {
18083 case ALC880_HP_EVENT:
18084 alc663_two_hp_m8_speaker_automute(codec);
18086 case ALC880_MIC_EVENT:
18087 alc_mic_automute(codec);
18092 #define alc663_mode8_setup alc663_m51va_setup
18094 static void alc663_mode8_inithook(struct hda_codec *codec)
18096 alc663_two_hp_m8_speaker_automute(codec);
18097 alc_mic_automute(codec);
18100 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18102 unsigned int present;
18103 unsigned char bits;
18105 present = snd_hda_jack_detect(codec, 0x21);
18106 bits = present ? HDA_AMP_MUTE : 0;
18107 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18108 HDA_AMP_MUTE, bits);
18109 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18110 HDA_AMP_MUTE, bits);
18113 static void alc663_g71v_front_automute(struct hda_codec *codec)
18115 unsigned int present;
18116 unsigned char bits;
18118 present = snd_hda_jack_detect(codec, 0x15);
18119 bits = present ? HDA_AMP_MUTE : 0;
18120 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18121 HDA_AMP_MUTE, bits);
18124 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18127 switch (res >> 26) {
18128 case ALC880_HP_EVENT:
18129 alc663_g71v_hp_automute(codec);
18131 case ALC880_FRONT_EVENT:
18132 alc663_g71v_front_automute(codec);
18134 case ALC880_MIC_EVENT:
18135 alc_mic_automute(codec);
18140 #define alc663_g71v_setup alc663_m51va_setup
18142 static void alc663_g71v_inithook(struct hda_codec *codec)
18144 alc663_g71v_front_automute(codec);
18145 alc663_g71v_hp_automute(codec);
18146 alc_mic_automute(codec);
18149 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18152 switch (res >> 26) {
18153 case ALC880_HP_EVENT:
18154 alc663_m51va_speaker_automute(codec);
18156 case ALC880_MIC_EVENT:
18157 alc_mic_automute(codec);
18162 #define alc663_g50v_setup alc663_m51va_setup
18164 static void alc663_g50v_inithook(struct hda_codec *codec)
18166 alc663_m51va_speaker_automute(codec);
18167 alc_mic_automute(codec);
18170 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18171 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18172 ALC262_HIPPO_MASTER_SWITCH,
18174 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18175 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18176 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18178 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18179 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18180 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18184 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18185 /* Master Playback automatically created from Speaker and Headphone */
18186 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18187 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18188 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18191 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18192 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18193 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18195 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18196 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18197 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18201 #ifdef CONFIG_SND_HDA_POWER_SAVE
18202 #define alc662_loopbacks alc880_loopbacks
18206 /* pcm configuration: identical with ALC880 */
18207 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18208 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18209 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18210 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18213 * configuration and preset
18215 static const char *alc662_models[ALC662_MODEL_LAST] = {
18216 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18217 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18218 [ALC662_3ST_6ch] = "3stack-6ch",
18219 [ALC662_5ST_DIG] = "6stack-dig",
18220 [ALC662_LENOVO_101E] = "lenovo-101e",
18221 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18222 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18223 [ALC662_ECS] = "ecs",
18224 [ALC663_ASUS_M51VA] = "m51va",
18225 [ALC663_ASUS_G71V] = "g71v",
18226 [ALC663_ASUS_H13] = "h13",
18227 [ALC663_ASUS_G50V] = "g50v",
18228 [ALC663_ASUS_MODE1] = "asus-mode1",
18229 [ALC662_ASUS_MODE2] = "asus-mode2",
18230 [ALC663_ASUS_MODE3] = "asus-mode3",
18231 [ALC663_ASUS_MODE4] = "asus-mode4",
18232 [ALC663_ASUS_MODE5] = "asus-mode5",
18233 [ALC663_ASUS_MODE6] = "asus-mode6",
18234 [ALC663_ASUS_MODE7] = "asus-mode7",
18235 [ALC663_ASUS_MODE8] = "asus-mode8",
18236 [ALC272_DELL] = "dell",
18237 [ALC272_DELL_ZM1] = "dell-zm1",
18238 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18239 [ALC662_AUTO] = "auto",
18242 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18243 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18244 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18245 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18246 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18247 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18248 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18249 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18250 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18251 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18252 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18253 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18254 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18255 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18256 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18257 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18258 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18259 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18260 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18261 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18262 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18263 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18264 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18265 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18266 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18267 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18268 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18269 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18270 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18271 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18272 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18273 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18274 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18275 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18276 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18277 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18278 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18279 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18280 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18281 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18282 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18283 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18284 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18285 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18286 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18287 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18288 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18289 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18290 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18291 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18292 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18293 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18294 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18295 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18296 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18297 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18298 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18299 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18300 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18301 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18302 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18303 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18304 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18305 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18306 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18307 ALC662_3ST_6ch_DIG),
18308 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18309 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18310 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18311 ALC662_3ST_6ch_DIG),
18312 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18313 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18314 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18315 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18316 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18317 ALC662_3ST_6ch_DIG),
18318 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18323 static struct alc_config_preset alc662_presets[] = {
18324 [ALC662_3ST_2ch_DIG] = {
18325 .mixers = { alc662_3ST_2ch_mixer },
18326 .init_verbs = { alc662_init_verbs },
18327 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18328 .dac_nids = alc662_dac_nids,
18329 .dig_out_nid = ALC662_DIGOUT_NID,
18330 .dig_in_nid = ALC662_DIGIN_NID,
18331 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18332 .channel_mode = alc662_3ST_2ch_modes,
18333 .input_mux = &alc662_capture_source,
18335 [ALC662_3ST_6ch_DIG] = {
18336 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18337 .init_verbs = { alc662_init_verbs },
18338 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18339 .dac_nids = alc662_dac_nids,
18340 .dig_out_nid = ALC662_DIGOUT_NID,
18341 .dig_in_nid = ALC662_DIGIN_NID,
18342 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18343 .channel_mode = alc662_3ST_6ch_modes,
18345 .input_mux = &alc662_capture_source,
18347 [ALC662_3ST_6ch] = {
18348 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18349 .init_verbs = { alc662_init_verbs },
18350 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18351 .dac_nids = alc662_dac_nids,
18352 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18353 .channel_mode = alc662_3ST_6ch_modes,
18355 .input_mux = &alc662_capture_source,
18357 [ALC662_5ST_DIG] = {
18358 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18359 .init_verbs = { alc662_init_verbs },
18360 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18361 .dac_nids = alc662_dac_nids,
18362 .dig_out_nid = ALC662_DIGOUT_NID,
18363 .dig_in_nid = ALC662_DIGIN_NID,
18364 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18365 .channel_mode = alc662_5stack_modes,
18366 .input_mux = &alc662_capture_source,
18368 [ALC662_LENOVO_101E] = {
18369 .mixers = { alc662_lenovo_101e_mixer },
18370 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18371 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18372 .dac_nids = alc662_dac_nids,
18373 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18374 .channel_mode = alc662_3ST_2ch_modes,
18375 .input_mux = &alc662_lenovo_101e_capture_source,
18376 .unsol_event = alc662_lenovo_101e_unsol_event,
18377 .init_hook = alc662_lenovo_101e_all_automute,
18379 [ALC662_ASUS_EEEPC_P701] = {
18380 .mixers = { alc662_eeepc_p701_mixer },
18381 .init_verbs = { alc662_init_verbs,
18382 alc662_eeepc_sue_init_verbs },
18383 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18384 .dac_nids = alc662_dac_nids,
18385 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18386 .channel_mode = alc662_3ST_2ch_modes,
18387 .unsol_event = alc662_eeepc_unsol_event,
18388 .setup = alc662_eeepc_setup,
18389 .init_hook = alc662_eeepc_inithook,
18391 [ALC662_ASUS_EEEPC_EP20] = {
18392 .mixers = { alc662_eeepc_ep20_mixer,
18393 alc662_chmode_mixer },
18394 .init_verbs = { alc662_init_verbs,
18395 alc662_eeepc_ep20_sue_init_verbs },
18396 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18397 .dac_nids = alc662_dac_nids,
18398 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18399 .channel_mode = alc662_3ST_6ch_modes,
18400 .input_mux = &alc662_lenovo_101e_capture_source,
18401 .unsol_event = alc662_eeepc_unsol_event,
18402 .setup = alc662_eeepc_ep20_setup,
18403 .init_hook = alc662_eeepc_ep20_inithook,
18406 .mixers = { alc662_ecs_mixer },
18407 .init_verbs = { alc662_init_verbs,
18408 alc662_ecs_init_verbs },
18409 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18410 .dac_nids = alc662_dac_nids,
18411 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18412 .channel_mode = alc662_3ST_2ch_modes,
18413 .unsol_event = alc662_eeepc_unsol_event,
18414 .setup = alc662_eeepc_setup,
18415 .init_hook = alc662_eeepc_inithook,
18417 [ALC663_ASUS_M51VA] = {
18418 .mixers = { alc663_m51va_mixer },
18419 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18420 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18421 .dac_nids = alc662_dac_nids,
18422 .dig_out_nid = ALC662_DIGOUT_NID,
18423 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18424 .channel_mode = alc662_3ST_2ch_modes,
18425 .unsol_event = alc663_m51va_unsol_event,
18426 .setup = alc663_m51va_setup,
18427 .init_hook = alc663_m51va_inithook,
18429 [ALC663_ASUS_G71V] = {
18430 .mixers = { alc663_g71v_mixer },
18431 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18432 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18433 .dac_nids = alc662_dac_nids,
18434 .dig_out_nid = ALC662_DIGOUT_NID,
18435 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18436 .channel_mode = alc662_3ST_2ch_modes,
18437 .unsol_event = alc663_g71v_unsol_event,
18438 .setup = alc663_g71v_setup,
18439 .init_hook = alc663_g71v_inithook,
18441 [ALC663_ASUS_H13] = {
18442 .mixers = { alc663_m51va_mixer },
18443 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18444 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18445 .dac_nids = alc662_dac_nids,
18446 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18447 .channel_mode = alc662_3ST_2ch_modes,
18448 .unsol_event = alc663_m51va_unsol_event,
18449 .init_hook = alc663_m51va_inithook,
18451 [ALC663_ASUS_G50V] = {
18452 .mixers = { alc663_g50v_mixer },
18453 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18454 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18455 .dac_nids = alc662_dac_nids,
18456 .dig_out_nid = ALC662_DIGOUT_NID,
18457 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18458 .channel_mode = alc662_3ST_6ch_modes,
18459 .input_mux = &alc663_capture_source,
18460 .unsol_event = alc663_g50v_unsol_event,
18461 .setup = alc663_g50v_setup,
18462 .init_hook = alc663_g50v_inithook,
18464 [ALC663_ASUS_MODE1] = {
18465 .mixers = { alc663_m51va_mixer },
18466 .cap_mixer = alc662_auto_capture_mixer,
18467 .init_verbs = { alc662_init_verbs,
18468 alc663_21jd_amic_init_verbs },
18469 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18471 .dac_nids = alc662_dac_nids,
18472 .dig_out_nid = ALC662_DIGOUT_NID,
18473 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18474 .channel_mode = alc662_3ST_2ch_modes,
18475 .unsol_event = alc663_mode1_unsol_event,
18476 .setup = alc663_mode1_setup,
18477 .init_hook = alc663_mode1_inithook,
18479 [ALC662_ASUS_MODE2] = {
18480 .mixers = { alc662_1bjd_mixer },
18481 .cap_mixer = alc662_auto_capture_mixer,
18482 .init_verbs = { alc662_init_verbs,
18483 alc662_1bjd_amic_init_verbs },
18484 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18485 .dac_nids = alc662_dac_nids,
18486 .dig_out_nid = ALC662_DIGOUT_NID,
18487 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18488 .channel_mode = alc662_3ST_2ch_modes,
18489 .unsol_event = alc662_mode2_unsol_event,
18490 .setup = alc662_mode2_setup,
18491 .init_hook = alc662_mode2_inithook,
18493 [ALC663_ASUS_MODE3] = {
18494 .mixers = { alc663_two_hp_m1_mixer },
18495 .cap_mixer = alc662_auto_capture_mixer,
18496 .init_verbs = { alc662_init_verbs,
18497 alc663_two_hp_amic_m1_init_verbs },
18498 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18500 .dac_nids = alc662_dac_nids,
18501 .dig_out_nid = ALC662_DIGOUT_NID,
18502 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18503 .channel_mode = alc662_3ST_2ch_modes,
18504 .unsol_event = alc663_mode3_unsol_event,
18505 .setup = alc663_mode3_setup,
18506 .init_hook = alc663_mode3_inithook,
18508 [ALC663_ASUS_MODE4] = {
18509 .mixers = { alc663_asus_21jd_clfe_mixer },
18510 .cap_mixer = alc662_auto_capture_mixer,
18511 .init_verbs = { alc662_init_verbs,
18512 alc663_21jd_amic_init_verbs},
18513 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18515 .dac_nids = alc662_dac_nids,
18516 .dig_out_nid = ALC662_DIGOUT_NID,
18517 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18518 .channel_mode = alc662_3ST_2ch_modes,
18519 .unsol_event = alc663_mode4_unsol_event,
18520 .setup = alc663_mode4_setup,
18521 .init_hook = alc663_mode4_inithook,
18523 [ALC663_ASUS_MODE5] = {
18524 .mixers = { alc663_asus_15jd_clfe_mixer },
18525 .cap_mixer = alc662_auto_capture_mixer,
18526 .init_verbs = { alc662_init_verbs,
18527 alc663_15jd_amic_init_verbs },
18528 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18530 .dac_nids = alc662_dac_nids,
18531 .dig_out_nid = ALC662_DIGOUT_NID,
18532 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18533 .channel_mode = alc662_3ST_2ch_modes,
18534 .unsol_event = alc663_mode5_unsol_event,
18535 .setup = alc663_mode5_setup,
18536 .init_hook = alc663_mode5_inithook,
18538 [ALC663_ASUS_MODE6] = {
18539 .mixers = { alc663_two_hp_m2_mixer },
18540 .cap_mixer = alc662_auto_capture_mixer,
18541 .init_verbs = { alc662_init_verbs,
18542 alc663_two_hp_amic_m2_init_verbs },
18543 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18545 .dac_nids = alc662_dac_nids,
18546 .dig_out_nid = ALC662_DIGOUT_NID,
18547 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18548 .channel_mode = alc662_3ST_2ch_modes,
18549 .unsol_event = alc663_mode6_unsol_event,
18550 .setup = alc663_mode6_setup,
18551 .init_hook = alc663_mode6_inithook,
18553 [ALC663_ASUS_MODE7] = {
18554 .mixers = { alc663_mode7_mixer },
18555 .cap_mixer = alc662_auto_capture_mixer,
18556 .init_verbs = { alc662_init_verbs,
18557 alc663_mode7_init_verbs },
18558 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18560 .dac_nids = alc662_dac_nids,
18561 .dig_out_nid = ALC662_DIGOUT_NID,
18562 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18563 .channel_mode = alc662_3ST_2ch_modes,
18564 .unsol_event = alc663_mode7_unsol_event,
18565 .setup = alc663_mode7_setup,
18566 .init_hook = alc663_mode7_inithook,
18568 [ALC663_ASUS_MODE8] = {
18569 .mixers = { alc663_mode8_mixer },
18570 .cap_mixer = alc662_auto_capture_mixer,
18571 .init_verbs = { alc662_init_verbs,
18572 alc663_mode8_init_verbs },
18573 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18575 .dac_nids = alc662_dac_nids,
18576 .dig_out_nid = ALC662_DIGOUT_NID,
18577 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18578 .channel_mode = alc662_3ST_2ch_modes,
18579 .unsol_event = alc663_mode8_unsol_event,
18580 .setup = alc663_mode8_setup,
18581 .init_hook = alc663_mode8_inithook,
18584 .mixers = { alc663_m51va_mixer },
18585 .cap_mixer = alc272_auto_capture_mixer,
18586 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18587 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18588 .dac_nids = alc662_dac_nids,
18589 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18590 .adc_nids = alc272_adc_nids,
18591 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18592 .capsrc_nids = alc272_capsrc_nids,
18593 .channel_mode = alc662_3ST_2ch_modes,
18594 .unsol_event = alc663_m51va_unsol_event,
18595 .setup = alc663_m51va_setup,
18596 .init_hook = alc663_m51va_inithook,
18598 [ALC272_DELL_ZM1] = {
18599 .mixers = { alc663_m51va_mixer },
18600 .cap_mixer = alc662_auto_capture_mixer,
18601 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18602 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18603 .dac_nids = alc662_dac_nids,
18604 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18605 .adc_nids = alc662_adc_nids,
18607 .capsrc_nids = alc662_capsrc_nids,
18608 .channel_mode = alc662_3ST_2ch_modes,
18609 .unsol_event = alc663_m51va_unsol_event,
18610 .setup = alc663_m51va_setup,
18611 .init_hook = alc663_m51va_inithook,
18613 [ALC272_SAMSUNG_NC10] = {
18614 .mixers = { alc272_nc10_mixer },
18615 .init_verbs = { alc662_init_verbs,
18616 alc663_21jd_amic_init_verbs },
18617 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18618 .dac_nids = alc272_dac_nids,
18619 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18620 .channel_mode = alc662_3ST_2ch_modes,
18621 /*.input_mux = &alc272_nc10_capture_source,*/
18622 .unsol_event = alc663_mode4_unsol_event,
18623 .setup = alc663_mode4_setup,
18624 .init_hook = alc663_mode4_inithook,
18630 * BIOS auto configuration
18633 /* convert from MIX nid to DAC */
18634 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18638 else if (nid >= 0x0c && nid <= 0x0e)
18639 return nid - 0x0c + 0x02;
18644 /* get MIX nid connected to the given pin targeted to DAC */
18645 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18651 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18652 for (i = 0; i < num; i++) {
18653 if (alc662_mix_to_dac(mix[i]) == dac)
18659 /* look for an empty DAC slot */
18660 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18662 struct alc_spec *spec = codec->spec;
18666 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18669 for (i = 0; i < num; i++) {
18670 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18673 for (j = 0; j < spec->multiout.num_dacs; j++)
18674 if (spec->multiout.dac_nids[j] == nid)
18676 if (j >= spec->multiout.num_dacs)
18682 /* fill in the dac_nids table from the parsed pin configuration */
18683 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18684 const struct auto_pin_cfg *cfg)
18686 struct alc_spec *spec = codec->spec;
18690 spec->multiout.dac_nids = spec->private_dac_nids;
18691 for (i = 0; i < cfg->line_outs; i++) {
18692 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18695 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18700 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18701 hda_nid_t nid, unsigned int chs)
18703 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18704 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18707 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18708 hda_nid_t nid, unsigned int chs)
18710 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18711 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18714 #define alc662_add_stereo_vol(spec, pfx, nid) \
18715 alc662_add_vol_ctl(spec, pfx, nid, 3)
18716 #define alc662_add_stereo_sw(spec, pfx, nid) \
18717 alc662_add_sw_ctl(spec, pfx, nid, 3)
18719 /* add playback controls from the parsed DAC table */
18720 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18721 const struct auto_pin_cfg *cfg)
18723 struct alc_spec *spec = codec->spec;
18724 static const char *chname[4] = {
18725 "Front", "Surround", NULL /*CLFE*/, "Side"
18727 hda_nid_t nid, mix;
18730 for (i = 0; i < cfg->line_outs; i++) {
18731 nid = spec->multiout.dac_nids[i];
18734 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18739 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18742 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18745 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18748 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18753 if (cfg->line_outs == 1 &&
18754 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18761 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18764 if (cfg->line_outs == 1 &&
18765 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18767 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18775 /* add playback controls for speaker and HP outputs */
18776 /* return DAC nid if any new DAC is assigned */
18777 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18780 struct alc_spec *spec = codec->spec;
18781 hda_nid_t nid, mix;
18786 nid = alc662_look_for_dac(codec, pin);
18788 /* the corresponding DAC is already occupied */
18789 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18790 return 0; /* no way */
18791 /* create a switch only */
18792 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18793 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18796 mix = alc662_dac_to_mix(codec, pin, nid);
18799 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18802 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18808 /* create playback/capture controls for input pins */
18809 #define alc662_auto_create_input_ctls \
18810 alc882_auto_create_input_ctls
18812 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18813 hda_nid_t nid, int pin_type,
18817 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18819 alc_set_pin_output(codec, nid, pin_type);
18820 /* need the manual connection? */
18821 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18824 for (i = 0; i < num; i++) {
18825 if (alc662_mix_to_dac(srcs[i]) != dac)
18827 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18832 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18834 struct alc_spec *spec = codec->spec;
18835 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18838 for (i = 0; i <= HDA_SIDE; i++) {
18839 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18841 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18842 spec->multiout.dac_nids[i]);
18846 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18848 struct alc_spec *spec = codec->spec;
18851 pin = spec->autocfg.hp_pins[0];
18853 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18854 spec->multiout.hp_nid);
18855 pin = spec->autocfg.speaker_pins[0];
18857 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18858 spec->multiout.extra_out_nid[0]);
18861 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18863 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18865 struct alc_spec *spec = codec->spec;
18866 struct auto_pin_cfg *cfg = &spec->autocfg;
18869 for (i = 0; i < cfg->num_inputs; i++) {
18870 hda_nid_t nid = cfg->inputs[i].pin;
18871 if (alc_is_input_pin(codec, nid)) {
18872 alc_set_input_pin(codec, nid, i);
18873 if (nid != ALC662_PIN_CD_NID &&
18874 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18875 snd_hda_codec_write(codec, nid, 0,
18876 AC_VERB_SET_AMP_GAIN_MUTE,
18882 #define alc662_auto_init_input_src alc882_auto_init_input_src
18884 static int alc662_parse_auto_config(struct hda_codec *codec)
18886 struct alc_spec *spec = codec->spec;
18888 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18890 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18894 if (!spec->autocfg.line_outs)
18895 return 0; /* can't find valid BIOS pin config */
18897 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18900 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18903 err = alc662_auto_create_extra_out(codec,
18904 spec->autocfg.speaker_pins[0],
18909 spec->multiout.extra_out_nid[0] = err;
18910 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18915 spec->multiout.hp_nid = err;
18916 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18920 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18922 alc_auto_parse_digital(codec);
18924 if (spec->kctls.list)
18925 add_mixer(spec, spec->kctls.list);
18927 spec->num_mux_defs = 1;
18928 spec->input_mux = &spec->private_imux[0];
18930 add_verb(spec, alc662_init_verbs);
18931 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18932 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18933 add_verb(spec, alc663_init_verbs);
18935 if (codec->vendor_id == 0x10ec0272)
18936 add_verb(spec, alc272_init_verbs);
18938 err = alc_auto_add_mic_boost(codec);
18942 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18943 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18944 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18946 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18951 /* additional initialization for auto-configuration model */
18952 static void alc662_auto_init(struct hda_codec *codec)
18954 struct alc_spec *spec = codec->spec;
18955 alc662_auto_init_multi_out(codec);
18956 alc662_auto_init_hp_out(codec);
18957 alc662_auto_init_analog_input(codec);
18958 alc662_auto_init_input_src(codec);
18959 alc_auto_init_digital(codec);
18960 if (spec->unsol_event)
18961 alc_inithook(codec);
18965 ALC662_FIXUP_IDEAPAD,
18968 static const struct alc_fixup alc662_fixups[] = {
18969 [ALC662_FIXUP_IDEAPAD] = {
18970 .pins = (const struct alc_pincfg[]) {
18971 { 0x17, 0x99130112 }, /* subwoofer */
18977 static struct snd_pci_quirk alc662_fixup_tbl[] = {
18978 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
18984 static int patch_alc662(struct hda_codec *codec)
18986 struct alc_spec *spec;
18987 int err, board_config;
18989 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18993 codec->spec = spec;
18995 alc_auto_parse_customize_define(codec);
18997 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18999 if (alc_read_coef_idx(codec, 0) == 0x8020)
19000 alc_codec_rename(codec, "ALC661");
19001 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
19002 codec->bus->pci->subsystem_vendor == 0x1025 &&
19003 spec->cdefine.platform_type == 1)
19004 alc_codec_rename(codec, "ALC272X");
19006 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19009 if (board_config < 0) {
19010 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19012 board_config = ALC662_AUTO;
19015 if (board_config == ALC662_AUTO) {
19016 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19017 /* automatic parse from the BIOS config */
19018 err = alc662_parse_auto_config(codec);
19024 "hda_codec: Cannot set up configuration "
19025 "from BIOS. Using base mode...\n");
19026 board_config = ALC662_3ST_2ch_DIG;
19030 if (has_cdefine_beep(codec)) {
19031 err = snd_hda_attach_beep_device(codec, 0x1);
19038 if (board_config != ALC662_AUTO)
19039 setup_preset(codec, &alc662_presets[board_config]);
19041 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19042 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19044 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19045 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19047 if (!spec->adc_nids) {
19048 spec->adc_nids = alc662_adc_nids;
19049 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19051 if (!spec->capsrc_nids)
19052 spec->capsrc_nids = alc662_capsrc_nids;
19054 if (!spec->cap_mixer)
19055 set_capture_mixer(codec);
19057 if (has_cdefine_beep(codec)) {
19058 switch (codec->vendor_id) {
19060 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19065 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19068 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19072 spec->vmaster_nid = 0x02;
19074 codec->patch_ops = alc_patch_ops;
19075 if (board_config == ALC662_AUTO) {
19076 spec->init_hook = alc662_auto_init;
19077 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0);
19080 #ifdef CONFIG_SND_HDA_POWER_SAVE
19081 if (!spec->loopback.amplist)
19082 spec->loopback.amplist = alc662_loopbacks;
19088 static int patch_alc888(struct hda_codec *codec)
19090 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19091 kfree(codec->chip_name);
19092 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19093 if (!codec->chip_name) {
19097 return patch_alc662(codec);
19099 return patch_alc882(codec);
19105 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19106 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19107 #define alc680_modes alc260_modes
19109 static hda_nid_t alc680_dac_nids[3] = {
19110 /* Lout1, Lout2, hp */
19114 static hda_nid_t alc680_adc_nids[3] = {
19116 /* DMIC, MIC, Line-in*/
19121 * Analog capture ADC cgange
19123 static void alc680_rec_autoswitch(struct hda_codec *codec)
19125 struct alc_spec *spec = codec->spec;
19126 struct auto_pin_cfg *cfg = &spec->autocfg;
19128 int type_found = AUTO_PIN_LAST;
19132 for (i = 0; i < cfg->num_inputs; i++) {
19133 nid = cfg->inputs[i].pin;
19134 if (!(snd_hda_query_pin_caps(codec, nid) &
19135 AC_PINCAP_PRES_DETECT))
19137 if (snd_hda_jack_detect(codec, nid)) {
19138 if (cfg->inputs[i].type < type_found) {
19139 type_found = cfg->inputs[i].type;
19147 snd_hda_get_connections(codec, pin_found, &nid, 1);
19149 if (nid != spec->cur_adc)
19150 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19151 spec->cur_adc = nid;
19152 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19153 spec->cur_adc_format);
19156 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19157 struct hda_codec *codec,
19158 unsigned int stream_tag,
19159 unsigned int format,
19160 struct snd_pcm_substream *substream)
19162 struct alc_spec *spec = codec->spec;
19164 spec->cur_adc = 0x07;
19165 spec->cur_adc_stream_tag = stream_tag;
19166 spec->cur_adc_format = format;
19168 alc680_rec_autoswitch(codec);
19172 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19173 struct hda_codec *codec,
19174 struct snd_pcm_substream *substream)
19176 snd_hda_codec_cleanup_stream(codec, 0x07);
19177 snd_hda_codec_cleanup_stream(codec, 0x08);
19178 snd_hda_codec_cleanup_stream(codec, 0x09);
19182 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19183 .substreams = 1, /* can be overridden */
19186 /* NID is set in alc_build_pcms */
19188 .prepare = alc680_capture_pcm_prepare,
19189 .cleanup = alc680_capture_pcm_cleanup
19193 static struct snd_kcontrol_new alc680_base_mixer[] = {
19194 /* output mixer control */
19195 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19196 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19197 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19199 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19200 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19201 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19205 static struct hda_bind_ctls alc680_bind_cap_vol = {
19206 .ops = &snd_hda_bind_vol,
19208 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19209 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19210 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19215 static struct hda_bind_ctls alc680_bind_cap_switch = {
19216 .ops = &snd_hda_bind_sw,
19218 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19219 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19220 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19225 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19226 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19227 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19232 * generic initialization of ADC, input mixers and output mixers
19234 static struct hda_verb alc680_init_verbs[] = {
19235 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19236 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19237 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19239 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19240 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19242 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19243 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19244 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19246 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19249 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19252 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19253 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19254 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19259 /* toggle speaker-output according to the hp-jack state */
19260 static void alc680_base_setup(struct hda_codec *codec)
19262 struct alc_spec *spec = codec->spec;
19264 spec->autocfg.hp_pins[0] = 0x16;
19265 spec->autocfg.speaker_pins[0] = 0x14;
19266 spec->autocfg.speaker_pins[1] = 0x15;
19267 spec->autocfg.num_inputs = 2;
19268 spec->autocfg.inputs[0].pin = 0x18;
19269 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19270 spec->autocfg.inputs[1].pin = 0x19;
19271 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19274 static void alc680_unsol_event(struct hda_codec *codec,
19277 if ((res >> 26) == ALC880_HP_EVENT)
19278 alc_automute_amp(codec);
19279 if ((res >> 26) == ALC880_MIC_EVENT)
19280 alc680_rec_autoswitch(codec);
19283 static void alc680_inithook(struct hda_codec *codec)
19285 alc_automute_amp(codec);
19286 alc680_rec_autoswitch(codec);
19289 /* create input playback/capture controls for the given pin */
19290 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19291 const char *ctlname, int idx)
19309 if (spec->multiout.dac_nids[0] != dac &&
19310 spec->multiout.dac_nids[1] != dac) {
19311 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19312 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19317 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19318 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19322 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19328 /* add playback controls from the parsed DAC table */
19329 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19330 const struct auto_pin_cfg *cfg)
19335 spec->multiout.dac_nids = spec->private_dac_nids;
19337 nid = cfg->line_out_pins[0];
19340 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19344 err = alc680_new_analog_output(spec, nid, name, 0);
19349 nid = cfg->speaker_pins[0];
19351 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19355 nid = cfg->hp_pins[0];
19357 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19365 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19366 hda_nid_t nid, int pin_type)
19368 alc_set_pin_output(codec, nid, pin_type);
19371 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19373 struct alc_spec *spec = codec->spec;
19374 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19376 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19377 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19381 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19383 struct alc_spec *spec = codec->spec;
19386 pin = spec->autocfg.hp_pins[0];
19388 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19389 pin = spec->autocfg.speaker_pins[0];
19391 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19394 /* pcm configuration: identical with ALC880 */
19395 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19396 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19397 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19398 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19399 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19402 * BIOS auto configuration
19404 static int alc680_parse_auto_config(struct hda_codec *codec)
19406 struct alc_spec *spec = codec->spec;
19408 static hda_nid_t alc680_ignore[] = { 0 };
19410 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19415 if (!spec->autocfg.line_outs) {
19416 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19417 spec->multiout.max_channels = 2;
19418 spec->no_analog = 1;
19421 return 0; /* can't find valid BIOS pin config */
19423 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19427 spec->multiout.max_channels = 2;
19430 /* digital only support output */
19431 alc_auto_parse_digital(codec);
19432 if (spec->kctls.list)
19433 add_mixer(spec, spec->kctls.list);
19435 add_verb(spec, alc680_init_verbs);
19437 err = alc_auto_add_mic_boost(codec);
19444 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19446 /* init callback for auto-configuration model -- overriding the default init */
19447 static void alc680_auto_init(struct hda_codec *codec)
19449 struct alc_spec *spec = codec->spec;
19450 alc680_auto_init_multi_out(codec);
19451 alc680_auto_init_hp_out(codec);
19452 alc680_auto_init_analog_input(codec);
19453 alc_auto_init_digital(codec);
19454 if (spec->unsol_event)
19455 alc_inithook(codec);
19459 * configuration and preset
19461 static const char *alc680_models[ALC680_MODEL_LAST] = {
19462 [ALC680_BASE] = "base",
19463 [ALC680_AUTO] = "auto",
19466 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19467 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19471 static struct alc_config_preset alc680_presets[] = {
19473 .mixers = { alc680_base_mixer },
19474 .cap_mixer = alc680_master_capture_mixer,
19475 .init_verbs = { alc680_init_verbs },
19476 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19477 .dac_nids = alc680_dac_nids,
19478 .dig_out_nid = ALC680_DIGOUT_NID,
19479 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19480 .channel_mode = alc680_modes,
19481 .unsol_event = alc680_unsol_event,
19482 .setup = alc680_base_setup,
19483 .init_hook = alc680_inithook,
19488 static int patch_alc680(struct hda_codec *codec)
19490 struct alc_spec *spec;
19494 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19498 codec->spec = spec;
19500 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19504 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19505 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19507 board_config = ALC680_AUTO;
19510 if (board_config == ALC680_AUTO) {
19511 /* automatic parse from the BIOS config */
19512 err = alc680_parse_auto_config(codec);
19518 "hda_codec: Cannot set up configuration "
19519 "from BIOS. Using base mode...\n");
19520 board_config = ALC680_BASE;
19524 if (board_config != ALC680_AUTO)
19525 setup_preset(codec, &alc680_presets[board_config]);
19527 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19528 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19529 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19530 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19532 if (!spec->adc_nids) {
19533 spec->adc_nids = alc680_adc_nids;
19534 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19537 if (!spec->cap_mixer)
19538 set_capture_mixer(codec);
19540 spec->vmaster_nid = 0x02;
19542 codec->patch_ops = alc_patch_ops;
19543 if (board_config == ALC680_AUTO)
19544 spec->init_hook = alc680_auto_init;
19552 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19553 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19554 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19555 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19556 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19557 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19558 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19559 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19560 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19561 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19562 .patch = patch_alc861 },
19563 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19564 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19565 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19566 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19567 .patch = patch_alc882 },
19568 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19569 .patch = patch_alc662 },
19570 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19571 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19572 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19573 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19574 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19575 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19576 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19577 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19578 .patch = patch_alc882 },
19579 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19580 .patch = patch_alc882 },
19581 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19582 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19583 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19584 .patch = patch_alc882 },
19585 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19586 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19587 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19588 {} /* terminator */
19591 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19593 MODULE_LICENSE("GPL");
19594 MODULE_DESCRIPTION("Realtek HD-audio codec");
19596 static struct hda_codec_preset_list realtek_list = {
19597 .preset = snd_hda_preset_realtek,
19598 .owner = THIS_MODULE,
19601 static int __init patch_realtek_init(void)
19603 return snd_hda_add_codec_preset(&realtek_list);
19606 static void __exit patch_realtek_exit(void)
19608 snd_hda_delete_codec_preset(&realtek_list);
19611 module_init(patch_realtek_init)
19612 module_exit(patch_realtek_exit)