2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
142 ALC269_MODEL_LAST /* last tag */
159 /* ALC861-VD models */
181 ALC662_ASUS_EEEPC_P701,
182 ALC662_ASUS_EEEPC_EP20,
224 ALC883_TARGA_2ch_DIG,
225 ALC883_TARGA_8ch_DIG,
228 ALC888_ACER_ASPIRE_4930G,
229 ALC888_ACER_ASPIRE_6530G,
230 ALC888_ACER_ASPIRE_8930G,
231 ALC888_ACER_ASPIRE_7730G,
234 ALC883_MEDION_WIM2160,
236 ALC883_LENOVO_101E_2ch,
237 ALC883_LENOVO_NB0763,
238 ALC888_LENOVO_MS7195_DIG,
246 ALC883_FUJITSU_PI2515,
247 ALC888_FUJITSU_XA3530,
248 ALC883_3ST_6ch_INTEL,
268 #define GPIO_MASK 0x03
270 /* extra amp-initialization sequence types */
279 struct alc_mic_route {
281 unsigned char mux_idx;
282 unsigned char amix_idx;
285 #define MUX_IDX_UNDEF ((unsigned char)-1)
287 struct alc_customize_define {
288 unsigned int sku_cfg;
289 unsigned char port_connectivity;
290 unsigned char check_sum;
291 unsigned char customization;
292 unsigned char external_amp;
293 unsigned int enable_pcbeep:1;
294 unsigned int platform_type:1;
296 unsigned int override:1;
300 /* codec parameterization */
301 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
302 unsigned int num_mixers;
303 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
304 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
306 const struct hda_verb *init_verbs[10]; /* initialization verbs
310 unsigned int num_init_verbs;
312 char stream_name_analog[32]; /* analog PCM stream */
313 struct hda_pcm_stream *stream_analog_playback;
314 struct hda_pcm_stream *stream_analog_capture;
315 struct hda_pcm_stream *stream_analog_alt_playback;
316 struct hda_pcm_stream *stream_analog_alt_capture;
318 char stream_name_digital[32]; /* digital PCM stream */
319 struct hda_pcm_stream *stream_digital_playback;
320 struct hda_pcm_stream *stream_digital_capture;
323 struct hda_multi_out multiout; /* playback set-up
324 * max_channels, dacs must be set
325 * dig_out_nid and hp_nid are optional
327 hda_nid_t alt_dac_nid;
328 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
332 unsigned int num_adc_nids;
334 hda_nid_t *capsrc_nids;
335 hda_nid_t dig_in_nid; /* digital-in NID; optional */
337 /* capture setup for dynamic dual-adc switch */
338 unsigned int cur_adc_idx;
340 unsigned int cur_adc_stream_tag;
341 unsigned int cur_adc_format;
344 unsigned int num_mux_defs;
345 const struct hda_input_mux *input_mux;
346 unsigned int cur_mux[3];
347 struct alc_mic_route ext_mic;
348 struct alc_mic_route int_mic;
351 const struct hda_channel_mode *channel_mode;
352 int num_channel_mode;
354 int const_channel_count;
355 int ext_channel_count;
357 /* PCM information */
358 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
360 /* dynamic controls, init_verbs and input_mux */
361 struct auto_pin_cfg autocfg;
362 struct alc_customize_define cdefine;
363 struct snd_array kctls;
364 struct hda_input_mux private_imux[3];
365 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
366 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
367 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
370 void (*init_hook)(struct hda_codec *codec);
371 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
372 #ifdef CONFIG_SND_HDA_POWER_SAVE
373 void (*power_hook)(struct hda_codec *codec);
376 /* for pin sensing */
377 unsigned int sense_updated: 1;
378 unsigned int jack_present: 1;
379 unsigned int master_sw: 1;
380 unsigned int auto_mic:1;
383 unsigned int no_analog :1; /* digital I/O only */
384 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
387 /* for virtual master */
388 hda_nid_t vmaster_nid;
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 struct hda_loopback_check loopback;
395 unsigned int pll_coef_idx, pll_coef_bit;
399 * configuration template - to be copied to the spec instance
401 struct alc_config_preset {
402 struct snd_kcontrol_new *mixers[5]; /* should be identical size
405 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
406 const struct hda_verb *init_verbs[5];
407 unsigned int num_dacs;
409 hda_nid_t dig_out_nid; /* optional */
410 hda_nid_t hp_nid; /* optional */
411 hda_nid_t *slave_dig_outs;
412 unsigned int num_adc_nids;
414 hda_nid_t *capsrc_nids;
415 hda_nid_t dig_in_nid;
416 unsigned int num_channel_mode;
417 const struct hda_channel_mode *channel_mode;
419 int const_channel_count;
420 unsigned int num_mux_defs;
421 const struct hda_input_mux *input_mux;
422 void (*unsol_event)(struct hda_codec *, unsigned int);
423 void (*setup)(struct hda_codec *);
424 void (*init_hook)(struct hda_codec *);
425 #ifdef CONFIG_SND_HDA_POWER_SAVE
426 struct hda_amp_list *loopbacks;
427 void (*power_hook)(struct hda_codec *codec);
435 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
436 struct snd_ctl_elem_info *uinfo)
438 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
439 struct alc_spec *spec = codec->spec;
440 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
441 if (mux_idx >= spec->num_mux_defs)
443 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
445 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
448 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
449 struct snd_ctl_elem_value *ucontrol)
451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
452 struct alc_spec *spec = codec->spec;
453 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
455 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
459 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol)
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct alc_spec *spec = codec->spec;
464 const struct hda_input_mux *imux;
465 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
466 unsigned int mux_idx;
467 hda_nid_t nid = spec->capsrc_nids ?
468 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
471 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
472 imux = &spec->input_mux[mux_idx];
473 if (!imux->num_items && mux_idx > 0)
474 imux = &spec->input_mux[0];
476 type = get_wcaps_type(get_wcaps(codec, nid));
477 if (type == AC_WID_AUD_MIX) {
478 /* Matrix-mixer style (e.g. ALC882) */
479 unsigned int *cur_val = &spec->cur_mux[adc_idx];
482 idx = ucontrol->value.enumerated.item[0];
483 if (idx >= imux->num_items)
484 idx = imux->num_items - 1;
487 for (i = 0; i < imux->num_items; i++) {
488 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
489 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
490 imux->items[i].index,
496 /* MUX style (e.g. ALC880) */
497 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
498 &spec->cur_mux[adc_idx]);
503 * channel mode setting
505 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
506 struct snd_ctl_elem_info *uinfo)
508 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
509 struct alc_spec *spec = codec->spec;
510 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
511 spec->num_channel_mode);
514 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
515 struct snd_ctl_elem_value *ucontrol)
517 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
518 struct alc_spec *spec = codec->spec;
519 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
520 spec->num_channel_mode,
521 spec->ext_channel_count);
524 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
525 struct snd_ctl_elem_value *ucontrol)
527 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
528 struct alc_spec *spec = codec->spec;
529 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
530 spec->num_channel_mode,
531 &spec->ext_channel_count);
532 if (err >= 0 && !spec->const_channel_count) {
533 spec->multiout.max_channels = spec->ext_channel_count;
534 if (spec->need_dac_fix)
535 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
541 * Control the mode of pin widget settings via the mixer. "pc" is used
542 * instead of "%" to avoid consequences of accidently treating the % as
543 * being part of a format specifier. Maximum allowed length of a value is
544 * 63 characters plus NULL terminator.
546 * Note: some retasking pin complexes seem to ignore requests for input
547 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
548 * are requested. Therefore order this list so that this behaviour will not
549 * cause problems when mixer clients move through the enum sequentially.
550 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
553 static char *alc_pin_mode_names[] = {
554 "Mic 50pc bias", "Mic 80pc bias",
555 "Line in", "Line out", "Headphone out",
557 static unsigned char alc_pin_mode_values[] = {
558 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
560 /* The control can present all 5 options, or it can limit the options based
561 * in the pin being assumed to be exclusively an input or an output pin. In
562 * addition, "input" pins may or may not process the mic bias option
563 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
564 * accept requests for bias as of chip versions up to March 2006) and/or
565 * wiring in the computer.
567 #define ALC_PIN_DIR_IN 0x00
568 #define ALC_PIN_DIR_OUT 0x01
569 #define ALC_PIN_DIR_INOUT 0x02
570 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
571 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
573 /* Info about the pin modes supported by the different pin direction modes.
574 * For each direction the minimum and maximum values are given.
576 static signed char alc_pin_mode_dir_info[5][2] = {
577 { 0, 2 }, /* ALC_PIN_DIR_IN */
578 { 3, 4 }, /* ALC_PIN_DIR_OUT */
579 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
580 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
581 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
583 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
584 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
585 #define alc_pin_mode_n_items(_dir) \
586 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
588 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
589 struct snd_ctl_elem_info *uinfo)
591 unsigned int item_num = uinfo->value.enumerated.item;
592 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
596 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
598 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
599 item_num = alc_pin_mode_min(dir);
600 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
604 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
605 struct snd_ctl_elem_value *ucontrol)
608 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
609 hda_nid_t nid = kcontrol->private_value & 0xffff;
610 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
611 long *valp = ucontrol->value.integer.value;
612 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
613 AC_VERB_GET_PIN_WIDGET_CONTROL,
616 /* Find enumerated value for current pinctl setting */
617 i = alc_pin_mode_min(dir);
618 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
620 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
624 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
625 struct snd_ctl_elem_value *ucontrol)
628 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
629 hda_nid_t nid = kcontrol->private_value & 0xffff;
630 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
631 long val = *ucontrol->value.integer.value;
632 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
633 AC_VERB_GET_PIN_WIDGET_CONTROL,
636 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
637 val = alc_pin_mode_min(dir);
639 change = pinctl != alc_pin_mode_values[val];
641 /* Set pin mode to that requested */
642 snd_hda_codec_write_cache(codec, nid, 0,
643 AC_VERB_SET_PIN_WIDGET_CONTROL,
644 alc_pin_mode_values[val]);
646 /* Also enable the retasking pin's input/output as required
647 * for the requested pin mode. Enum values of 2 or less are
650 * Dynamically switching the input/output buffers probably
651 * reduces noise slightly (particularly on input) so we'll
652 * do it. However, having both input and output buffers
653 * enabled simultaneously doesn't seem to be problematic if
654 * this turns out to be necessary in the future.
657 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
658 HDA_AMP_MUTE, HDA_AMP_MUTE);
659 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
662 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
663 HDA_AMP_MUTE, HDA_AMP_MUTE);
664 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
671 #define ALC_PIN_MODE(xname, nid, dir) \
672 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
673 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
674 .info = alc_pin_mode_info, \
675 .get = alc_pin_mode_get, \
676 .put = alc_pin_mode_put, \
677 .private_value = nid | (dir<<16) }
679 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
680 * together using a mask with more than one bit set. This control is
681 * currently used only by the ALC260 test model. At this stage they are not
682 * needed for any "production" models.
684 #ifdef CONFIG_SND_DEBUG
685 #define alc_gpio_data_info snd_ctl_boolean_mono_info
687 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
688 struct snd_ctl_elem_value *ucontrol)
690 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
691 hda_nid_t nid = kcontrol->private_value & 0xffff;
692 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
693 long *valp = ucontrol->value.integer.value;
694 unsigned int val = snd_hda_codec_read(codec, nid, 0,
695 AC_VERB_GET_GPIO_DATA, 0x00);
697 *valp = (val & mask) != 0;
700 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
701 struct snd_ctl_elem_value *ucontrol)
704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
705 hda_nid_t nid = kcontrol->private_value & 0xffff;
706 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
707 long val = *ucontrol->value.integer.value;
708 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
709 AC_VERB_GET_GPIO_DATA,
712 /* Set/unset the masked GPIO bit(s) as needed */
713 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
718 snd_hda_codec_write_cache(codec, nid, 0,
719 AC_VERB_SET_GPIO_DATA, gpio_data);
723 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
724 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
725 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
726 .info = alc_gpio_data_info, \
727 .get = alc_gpio_data_get, \
728 .put = alc_gpio_data_put, \
729 .private_value = nid | (mask<<16) }
730 #endif /* CONFIG_SND_DEBUG */
732 /* A switch control to allow the enabling of the digital IO pins on the
733 * ALC260. This is incredibly simplistic; the intention of this control is
734 * to provide something in the test model allowing digital outputs to be
735 * identified if present. If models are found which can utilise these
736 * outputs a more complete mixer control can be devised for those models if
739 #ifdef CONFIG_SND_DEBUG
740 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
742 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
743 struct snd_ctl_elem_value *ucontrol)
745 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
746 hda_nid_t nid = kcontrol->private_value & 0xffff;
747 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
748 long *valp = ucontrol->value.integer.value;
749 unsigned int val = snd_hda_codec_read(codec, nid, 0,
750 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
752 *valp = (val & mask) != 0;
755 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
756 struct snd_ctl_elem_value *ucontrol)
759 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
760 hda_nid_t nid = kcontrol->private_value & 0xffff;
761 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
762 long val = *ucontrol->value.integer.value;
763 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
764 AC_VERB_GET_DIGI_CONVERT_1,
767 /* Set/unset the masked control bit(s) as needed */
768 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
773 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
778 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
779 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
780 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
781 .info = alc_spdif_ctrl_info, \
782 .get = alc_spdif_ctrl_get, \
783 .put = alc_spdif_ctrl_put, \
784 .private_value = nid | (mask<<16) }
785 #endif /* CONFIG_SND_DEBUG */
787 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
788 * Again, this is only used in the ALC26x test models to help identify when
789 * the EAPD line must be asserted for features to work.
791 #ifdef CONFIG_SND_DEBUG
792 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
794 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
795 struct snd_ctl_elem_value *ucontrol)
797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
798 hda_nid_t nid = kcontrol->private_value & 0xffff;
799 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
800 long *valp = ucontrol->value.integer.value;
801 unsigned int val = snd_hda_codec_read(codec, nid, 0,
802 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
804 *valp = (val & mask) != 0;
808 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
809 struct snd_ctl_elem_value *ucontrol)
812 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
813 hda_nid_t nid = kcontrol->private_value & 0xffff;
814 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
815 long val = *ucontrol->value.integer.value;
816 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
817 AC_VERB_GET_EAPD_BTLENABLE,
820 /* Set/unset the masked control bit(s) as needed */
821 change = (!val ? 0 : mask) != (ctrl_data & mask);
826 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
832 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
833 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
834 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
835 .info = alc_eapd_ctrl_info, \
836 .get = alc_eapd_ctrl_get, \
837 .put = alc_eapd_ctrl_put, \
838 .private_value = nid | (mask<<16) }
839 #endif /* CONFIG_SND_DEBUG */
842 * set up the input pin config (depending on the given auto-pin type)
844 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
847 unsigned int val = PIN_IN;
849 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
852 oldval = snd_hda_codec_read(codec, nid, 0,
853 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
854 pincap = snd_hda_query_pin_caps(codec, nid);
855 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
856 /* if the default pin setup is vref50, we give it priority */
857 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
859 else if (pincap & AC_PINCAP_VREF_50)
861 else if (pincap & AC_PINCAP_VREF_100)
863 else if (pincap & AC_PINCAP_VREF_GRD)
866 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
871 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
873 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
875 spec->mixers[spec->num_mixers++] = mix;
878 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
880 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
882 spec->init_verbs[spec->num_init_verbs++] = verb;
886 * set up from the preset table
888 static void setup_preset(struct hda_codec *codec,
889 const struct alc_config_preset *preset)
891 struct alc_spec *spec = codec->spec;
894 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
895 add_mixer(spec, preset->mixers[i]);
896 spec->cap_mixer = preset->cap_mixer;
897 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
899 add_verb(spec, preset->init_verbs[i]);
901 spec->channel_mode = preset->channel_mode;
902 spec->num_channel_mode = preset->num_channel_mode;
903 spec->need_dac_fix = preset->need_dac_fix;
904 spec->const_channel_count = preset->const_channel_count;
906 if (preset->const_channel_count)
907 spec->multiout.max_channels = preset->const_channel_count;
909 spec->multiout.max_channels = spec->channel_mode[0].channels;
910 spec->ext_channel_count = spec->channel_mode[0].channels;
912 spec->multiout.num_dacs = preset->num_dacs;
913 spec->multiout.dac_nids = preset->dac_nids;
914 spec->multiout.dig_out_nid = preset->dig_out_nid;
915 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
916 spec->multiout.hp_nid = preset->hp_nid;
918 spec->num_mux_defs = preset->num_mux_defs;
919 if (!spec->num_mux_defs)
920 spec->num_mux_defs = 1;
921 spec->input_mux = preset->input_mux;
923 spec->num_adc_nids = preset->num_adc_nids;
924 spec->adc_nids = preset->adc_nids;
925 spec->capsrc_nids = preset->capsrc_nids;
926 spec->dig_in_nid = preset->dig_in_nid;
928 spec->unsol_event = preset->unsol_event;
929 spec->init_hook = preset->init_hook;
930 #ifdef CONFIG_SND_HDA_POWER_SAVE
931 spec->power_hook = preset->power_hook;
932 spec->loopback.amplist = preset->loopbacks;
936 preset->setup(codec);
939 /* Enable GPIO mask and set output */
940 static struct hda_verb alc_gpio1_init_verbs[] = {
941 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
942 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
943 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
947 static struct hda_verb alc_gpio2_init_verbs[] = {
948 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
949 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
950 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
954 static struct hda_verb alc_gpio3_init_verbs[] = {
955 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
956 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
957 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
962 * Fix hardware PLL issue
963 * On some codecs, the analog PLL gating control must be off while
964 * the default value is 1.
966 static void alc_fix_pll(struct hda_codec *codec)
968 struct alc_spec *spec = codec->spec;
973 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
975 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
976 AC_VERB_GET_PROC_COEF, 0);
977 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
979 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
980 val & ~(1 << spec->pll_coef_bit));
983 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
984 unsigned int coef_idx, unsigned int coef_bit)
986 struct alc_spec *spec = codec->spec;
988 spec->pll_coef_idx = coef_idx;
989 spec->pll_coef_bit = coef_bit;
993 static void alc_automute_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)
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++) {
4951 pin = cfg->inputs[i].pin;
4952 if (!alc_is_input_pin(codec, pin))
4955 type = cfg->inputs[i].type;
4956 if (i > 0 && type == cfg->inputs[i - 1].type)
4961 idx = get_connection_index(codec, mixer, pin);
4963 err = new_analog_input(spec, pin,
4964 auto_pin_cfg_labels[type],
4965 type_idx, idx, mixer);
4973 idx = get_connection_index(codec, cap1, pin);
4974 if (idx < 0 && cap2)
4975 idx = get_connection_index(codec, cap2, pin);
4977 imux->items[imux->num_items].label =
4978 snd_hda_get_input_pin_label(cfg, i);
4979 imux->items[imux->num_items].index = idx;
4986 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4987 const struct auto_pin_cfg *cfg)
4989 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4992 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4993 unsigned int pin_type)
4995 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4998 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5002 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5003 hda_nid_t nid, int pin_type,
5006 alc_set_pin_output(codec, nid, pin_type);
5007 /* need the manual connection? */
5008 if (alc880_is_multi_pin(nid)) {
5009 struct alc_spec *spec = codec->spec;
5010 int idx = alc880_multi_pin_idx(nid);
5011 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5012 AC_VERB_SET_CONNECT_SEL,
5013 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5017 static int get_pin_type(int line_out_type)
5019 if (line_out_type == AUTO_PIN_HP_OUT)
5025 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5027 struct alc_spec *spec = codec->spec;
5030 for (i = 0; i < spec->autocfg.line_outs; i++) {
5031 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5032 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5033 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5037 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5039 struct alc_spec *spec = codec->spec;
5042 pin = spec->autocfg.speaker_pins[0];
5043 if (pin) /* connect to front */
5044 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5045 pin = spec->autocfg.hp_pins[0];
5046 if (pin) /* connect to front */
5047 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5050 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5052 struct alc_spec *spec = codec->spec;
5053 struct auto_pin_cfg *cfg = &spec->autocfg;
5056 for (i = 0; i < cfg->num_inputs; i++) {
5057 hda_nid_t nid = cfg->inputs[i].pin;
5058 if (alc_is_input_pin(codec, nid)) {
5059 alc_set_input_pin(codec, nid, i);
5060 if (nid != ALC880_PIN_CD_NID &&
5061 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5062 snd_hda_codec_write(codec, nid, 0,
5063 AC_VERB_SET_AMP_GAIN_MUTE,
5069 static void alc880_auto_init_input_src(struct hda_codec *codec)
5071 struct alc_spec *spec = codec->spec;
5074 for (c = 0; c < spec->num_adc_nids; c++) {
5075 unsigned int mux_idx;
5076 const struct hda_input_mux *imux;
5077 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5078 imux = &spec->input_mux[mux_idx];
5079 if (!imux->num_items && mux_idx > 0)
5080 imux = &spec->input_mux[0];
5082 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5083 AC_VERB_SET_CONNECT_SEL,
5084 imux->items[0].index);
5088 /* parse the BIOS configuration and set up the alc_spec */
5089 /* return 1 if successful, 0 if the proper config is not found,
5090 * or a negative error code
5092 static int alc880_parse_auto_config(struct hda_codec *codec)
5094 struct alc_spec *spec = codec->spec;
5096 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5098 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5102 if (!spec->autocfg.line_outs)
5103 return 0; /* can't find valid BIOS pin config */
5105 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5108 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5111 err = alc880_auto_create_extra_out(spec,
5112 spec->autocfg.speaker_pins[0],
5116 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5120 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5124 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5126 alc_auto_parse_digital(codec);
5128 if (spec->kctls.list)
5129 add_mixer(spec, spec->kctls.list);
5131 add_verb(spec, alc880_volume_init_verbs);
5133 spec->num_mux_defs = 1;
5134 spec->input_mux = &spec->private_imux[0];
5136 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5141 /* additional initialization for auto-configuration model */
5142 static void alc880_auto_init(struct hda_codec *codec)
5144 struct alc_spec *spec = codec->spec;
5145 alc880_auto_init_multi_out(codec);
5146 alc880_auto_init_extra_out(codec);
5147 alc880_auto_init_analog_input(codec);
5148 alc880_auto_init_input_src(codec);
5149 alc_auto_init_digital(codec);
5150 if (spec->unsol_event)
5151 alc_inithook(codec);
5154 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5155 * one of two digital mic pins, e.g. on ALC272
5157 static void fixup_automic_adc(struct hda_codec *codec)
5159 struct alc_spec *spec = codec->spec;
5162 for (i = 0; i < spec->num_adc_nids; i++) {
5163 hda_nid_t cap = spec->capsrc_nids ?
5164 spec->capsrc_nids[i] : spec->adc_nids[i];
5167 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5170 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5173 spec->int_mic.mux_idx = iidx;
5174 spec->ext_mic.mux_idx = eidx;
5175 if (spec->capsrc_nids)
5176 spec->capsrc_nids += i;
5177 spec->adc_nids += i;
5178 spec->num_adc_nids = 1;
5181 snd_printd(KERN_INFO "hda_codec: %s: "
5182 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5183 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5184 spec->auto_mic = 0; /* disable auto-mic to be sure */
5187 /* select or unmute the given capsrc route */
5188 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5191 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5192 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5195 snd_hda_codec_write_cache(codec, cap, 0,
5196 AC_VERB_SET_CONNECT_SEL, idx);
5200 /* set the default connection to that pin */
5201 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5203 struct alc_spec *spec = codec->spec;
5206 for (i = 0; i < spec->num_adc_nids; i++) {
5207 hda_nid_t cap = spec->capsrc_nids ?
5208 spec->capsrc_nids[i] : spec->adc_nids[i];
5211 idx = get_connection_index(codec, cap, pin);
5214 select_or_unmute_capsrc(codec, cap, idx);
5215 return i; /* return the found index */
5217 return -1; /* not found */
5220 /* choose the ADC/MUX containing the input pin and initialize the setup */
5221 static void fixup_single_adc(struct hda_codec *codec)
5223 struct alc_spec *spec = codec->spec;
5224 struct auto_pin_cfg *cfg = &spec->autocfg;
5227 /* search for the input pin; there must be only one */
5228 if (cfg->num_inputs != 1)
5230 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5232 /* use only this ADC */
5233 if (spec->capsrc_nids)
5234 spec->capsrc_nids += i;
5235 spec->adc_nids += i;
5236 spec->num_adc_nids = 1;
5240 /* initialize dual adcs */
5241 static void fixup_dual_adc_switch(struct hda_codec *codec)
5243 struct alc_spec *spec = codec->spec;
5244 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5245 init_capsrc_for_pin(codec, spec->int_mic.pin);
5248 static void set_capture_mixer(struct hda_codec *codec)
5250 struct alc_spec *spec = codec->spec;
5251 static struct snd_kcontrol_new *caps[2][3] = {
5252 { alc_capture_mixer_nosrc1,
5253 alc_capture_mixer_nosrc2,
5254 alc_capture_mixer_nosrc3 },
5255 { alc_capture_mixer1,
5257 alc_capture_mixer3 },
5259 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5261 int num_adcs = spec->num_adc_nids;
5262 if (spec->dual_adc_switch)
5263 fixup_dual_adc_switch(codec);
5264 else if (spec->auto_mic)
5265 fixup_automic_adc(codec);
5266 else if (spec->input_mux) {
5267 if (spec->input_mux->num_items > 1)
5269 else if (spec->input_mux->num_items == 1)
5270 fixup_single_adc(codec);
5272 if (spec->dual_adc_switch)
5274 spec->cap_mixer = caps[mux][num_adcs - 1];
5278 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5279 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5282 struct alc_spec *spec = codec->spec;
5283 struct auto_pin_cfg *cfg = &spec->autocfg;
5285 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5287 for (n = 0; n < num_nids; n++) {
5289 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5293 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5296 nconns = snd_hda_get_connections(codec, cap, conn,
5300 nconns = snd_hda_get_connections(codec, cap, conn,
5305 if (!fallback_adc) {
5309 for (i = 0; i < cfg->num_inputs; i++) {
5310 hda_nid_t nid = cfg->inputs[i].pin;
5311 for (j = 0; j < nconns; j++) {
5318 if (i >= cfg->num_inputs) {
5319 int num_adcs = spec->num_adc_nids;
5320 spec->private_adc_nids[num_adcs] = adc;
5321 spec->private_capsrc_nids[num_adcs] = cap;
5322 spec->num_adc_nids++;
5323 spec->adc_nids = spec->private_adc_nids;
5325 spec->capsrc_nids = spec->private_capsrc_nids;
5328 if (!spec->num_adc_nids) {
5329 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5330 " using fallback 0x%x\n",
5331 codec->chip_name, fallback_adc);
5332 spec->private_adc_nids[0] = fallback_adc;
5333 spec->adc_nids = spec->private_adc_nids;
5334 if (fallback_adc != fallback_cap) {
5335 spec->private_capsrc_nids[0] = fallback_cap;
5336 spec->capsrc_nids = spec->private_adc_nids;
5341 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5342 #define set_beep_amp(spec, nid, idx, dir) \
5343 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5345 static struct snd_pci_quirk beep_white_list[] = {
5346 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5347 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5348 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5352 static inline int has_cdefine_beep(struct hda_codec *codec)
5354 struct alc_spec *spec = codec->spec;
5355 const struct snd_pci_quirk *q;
5356 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5359 return spec->cdefine.enable_pcbeep;
5362 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5363 #define has_cdefine_beep(codec) 0
5367 * OK, here we have finally the patch for ALC880
5370 static int patch_alc880(struct hda_codec *codec)
5372 struct alc_spec *spec;
5376 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5382 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5385 if (board_config < 0) {
5386 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5388 board_config = ALC880_AUTO;
5391 if (board_config == ALC880_AUTO) {
5392 /* automatic parse from the BIOS config */
5393 err = alc880_parse_auto_config(codec);
5399 "hda_codec: Cannot set up configuration "
5400 "from BIOS. Using 3-stack mode...\n");
5401 board_config = ALC880_3ST;
5405 err = snd_hda_attach_beep_device(codec, 0x1);
5411 if (board_config != ALC880_AUTO)
5412 setup_preset(codec, &alc880_presets[board_config]);
5414 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5415 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5416 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5418 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5419 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5421 if (!spec->adc_nids && spec->input_mux) {
5422 /* check whether NID 0x07 is valid */
5423 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5425 wcap = get_wcaps_type(wcap);
5426 if (wcap != AC_WID_AUD_IN) {
5427 spec->adc_nids = alc880_adc_nids_alt;
5428 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5430 spec->adc_nids = alc880_adc_nids;
5431 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5434 set_capture_mixer(codec);
5435 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5437 spec->vmaster_nid = 0x0c;
5439 codec->patch_ops = alc_patch_ops;
5440 if (board_config == ALC880_AUTO)
5441 spec->init_hook = alc880_auto_init;
5442 #ifdef CONFIG_SND_HDA_POWER_SAVE
5443 if (!spec->loopback.amplist)
5444 spec->loopback.amplist = alc880_loopbacks;
5455 static hda_nid_t alc260_dac_nids[1] = {
5460 static hda_nid_t alc260_adc_nids[1] = {
5465 static hda_nid_t alc260_adc_nids_alt[1] = {
5470 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5471 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5473 static hda_nid_t alc260_dual_adc_nids[2] = {
5478 #define ALC260_DIGOUT_NID 0x03
5479 #define ALC260_DIGIN_NID 0x06
5481 static struct hda_input_mux alc260_capture_source = {
5485 { "Front Mic", 0x1 },
5491 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5492 * headphone jack and the internal CD lines since these are the only pins at
5493 * which audio can appear. For flexibility, also allow the option of
5494 * recording the mixer output on the second ADC (ADC0 doesn't have a
5495 * connection to the mixer output).
5497 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5501 { "Mic/Line", 0x0 },
5503 { "Headphone", 0x2 },
5509 { "Mic/Line", 0x0 },
5511 { "Headphone", 0x2 },
5518 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5519 * the Fujitsu S702x, but jacks are marked differently.
5521 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5528 { "Headphone", 0x5 },
5537 { "Headphone", 0x6 },
5543 /* Maxdata Favorit 100XS */
5544 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5548 { "Line/Mic", 0x0 },
5555 { "Line/Mic", 0x0 },
5563 * This is just place-holder, so there's something for alc_build_pcms to look
5564 * at when it calculates the maximum number of channels. ALC260 has no mixer
5565 * element which allows changing the channel mode, so the verb list is
5568 static struct hda_channel_mode alc260_modes[1] = {
5573 /* Mixer combinations
5575 * basic: base_output + input + pc_beep + capture
5576 * HP: base_output + input + capture_alt
5577 * HP_3013: hp_3013 + input + capture
5578 * fujitsu: fujitsu + capture
5579 * acer: acer + capture
5582 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5583 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5584 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5585 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5586 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5587 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5588 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5592 static struct snd_kcontrol_new alc260_input_mixer[] = {
5593 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5594 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5595 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5596 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5598 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5604 /* update HP, line and mono out pins according to the master switch */
5605 static void alc260_hp_master_update(struct hda_codec *codec,
5606 hda_nid_t hp, hda_nid_t line,
5609 struct alc_spec *spec = codec->spec;
5610 unsigned int val = spec->master_sw ? PIN_HP : 0;
5611 /* change HP and line-out pins */
5612 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5614 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5616 /* mono (speaker) depending on the HP jack sense */
5617 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5618 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5622 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5623 struct snd_ctl_elem_value *ucontrol)
5625 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5626 struct alc_spec *spec = codec->spec;
5627 *ucontrol->value.integer.value = spec->master_sw;
5631 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5632 struct snd_ctl_elem_value *ucontrol)
5634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5635 struct alc_spec *spec = codec->spec;
5636 int val = !!*ucontrol->value.integer.value;
5637 hda_nid_t hp, line, mono;
5639 if (val == spec->master_sw)
5641 spec->master_sw = val;
5642 hp = (kcontrol->private_value >> 16) & 0xff;
5643 line = (kcontrol->private_value >> 8) & 0xff;
5644 mono = kcontrol->private_value & 0xff;
5645 alc260_hp_master_update(codec, hp, line, mono);
5649 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5652 .name = "Master Playback Switch",
5653 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5654 .info = snd_ctl_boolean_mono_info,
5655 .get = alc260_hp_master_sw_get,
5656 .put = alc260_hp_master_sw_put,
5657 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5659 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5660 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5661 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5662 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5663 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5665 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5669 static struct hda_verb alc260_hp_unsol_verbs[] = {
5670 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5674 static void alc260_hp_automute(struct hda_codec *codec)
5676 struct alc_spec *spec = codec->spec;
5678 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5679 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5682 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5684 if ((res >> 26) == ALC880_HP_EVENT)
5685 alc260_hp_automute(codec);
5688 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5690 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5691 .name = "Master Playback Switch",
5692 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5693 .info = snd_ctl_boolean_mono_info,
5694 .get = alc260_hp_master_sw_get,
5695 .put = alc260_hp_master_sw_put,
5696 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5698 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5699 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5700 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5701 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5702 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5704 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5705 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5709 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5710 .ops = &snd_hda_bind_vol,
5712 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5713 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5714 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5719 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5720 .ops = &snd_hda_bind_sw,
5722 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5723 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5728 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5729 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5730 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5731 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5736 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5737 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5741 static void alc260_hp_3013_automute(struct hda_codec *codec)
5743 struct alc_spec *spec = codec->spec;
5745 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5746 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5749 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5752 if ((res >> 26) == ALC880_HP_EVENT)
5753 alc260_hp_3013_automute(codec);
5756 static void alc260_hp_3012_automute(struct hda_codec *codec)
5758 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5760 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5762 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5764 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5768 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5771 if ((res >> 26) == ALC880_HP_EVENT)
5772 alc260_hp_3012_automute(codec);
5775 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5776 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5778 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5779 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5780 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5781 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5782 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5783 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5784 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5785 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5786 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5787 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5788 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5792 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5793 * versions of the ALC260 don't act on requests to enable mic bias from NID
5794 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5795 * datasheet doesn't mention this restriction. At this stage it's not clear
5796 * whether this behaviour is intentional or is a hardware bug in chip
5797 * revisions available in early 2006. Therefore for now allow the
5798 * "Headphone Jack Mode" control to span all choices, but if it turns out
5799 * that the lack of mic bias for this NID is intentional we could change the
5800 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5802 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5803 * don't appear to make the mic bias available from the "line" jack, even
5804 * though the NID used for this jack (0x14) can supply it. The theory is
5805 * that perhaps Acer have included blocking capacitors between the ALC260
5806 * and the output jack. If this turns out to be the case for all such
5807 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5808 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5810 * The C20x Tablet series have a mono internal speaker which is controlled
5811 * via the chip's Mono sum widget and pin complex, so include the necessary
5812 * controls for such models. On models without a "mono speaker" the control
5813 * won't do anything.
5815 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5816 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5817 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5818 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5819 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5821 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5823 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5824 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5826 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5827 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5828 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5829 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5830 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5834 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5836 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5837 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5838 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5839 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5840 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5841 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5842 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5846 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5847 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5849 static struct snd_kcontrol_new alc260_will_mixer[] = {
5850 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5851 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5853 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5854 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5855 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5856 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5857 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5858 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5859 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5863 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5864 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5866 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5867 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5868 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5869 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5870 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5871 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5872 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5873 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5874 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5875 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5876 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5881 * initialization verbs
5883 static struct hda_verb alc260_init_verbs[] = {
5884 /* Line In pin widget for input */
5885 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5886 /* CD pin widget for input */
5887 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5888 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5889 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5890 /* Mic2 (front panel) pin widget for input and vref at 80% */
5891 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5892 /* LINE-2 is used for line-out in rear */
5893 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5894 /* select line-out */
5895 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5897 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5899 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5901 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5902 /* mute capture amp left and right */
5903 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5904 /* set connection select to line in (default select for this ADC) */
5905 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5906 /* mute capture amp left and right */
5907 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5908 /* set connection select to line in (default select for this ADC) */
5909 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5910 /* set vol=0 Line-Out mixer amp left and right */
5911 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5912 /* unmute pin widget amp left and right (no gain on this amp) */
5913 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5914 /* set vol=0 HP mixer amp left and right */
5915 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5916 /* unmute pin widget amp left and right (no gain on this amp) */
5917 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5918 /* set vol=0 Mono mixer amp left and right */
5919 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5920 /* unmute pin widget amp left and right (no gain on this amp) */
5921 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5922 /* unmute LINE-2 out pin */
5923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5924 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5927 /* mute analog inputs */
5928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5932 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5933 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5934 /* mute Front out path */
5935 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5936 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5937 /* mute Headphone out path */
5938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5939 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5940 /* mute Mono out path */
5941 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5942 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5946 #if 0 /* should be identical with alc260_init_verbs? */
5947 static struct hda_verb alc260_hp_init_verbs[] = {
5948 /* Headphone and output */
5949 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5951 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5952 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5953 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5954 /* Mic2 (front panel) pin widget for input and vref at 80% */
5955 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5956 /* Line In pin widget for input */
5957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5958 /* Line-2 pin widget for output */
5959 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5960 /* CD pin widget for input */
5961 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5962 /* unmute amp left and right */
5963 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5964 /* set connection select to line in (default select for this ADC) */
5965 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5966 /* unmute Line-Out mixer amp left and right (volume = 0) */
5967 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5968 /* mute pin widget amp left and right (no gain on this amp) */
5969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5970 /* unmute HP mixer amp left and right (volume = 0) */
5971 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5972 /* mute pin widget amp left and right (no gain on this amp) */
5973 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5974 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5977 /* mute analog inputs */
5978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5983 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5984 /* Unmute Front out path */
5985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5986 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5987 /* Unmute Headphone out path */
5988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5989 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5990 /* Unmute Mono out path */
5991 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5992 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5997 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5998 /* Line out and output */
5999 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6001 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6002 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6003 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6004 /* Mic2 (front panel) pin widget for input and vref at 80% */
6005 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6006 /* Line In pin widget for input */
6007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6008 /* Headphone pin widget for output */
6009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6010 /* CD pin widget for input */
6011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6012 /* unmute amp left and right */
6013 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6014 /* set connection select to line in (default select for this ADC) */
6015 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6016 /* unmute Line-Out mixer amp left and right (volume = 0) */
6017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6018 /* mute pin widget amp left and right (no gain on this amp) */
6019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6020 /* unmute HP mixer amp left and right (volume = 0) */
6021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6022 /* mute pin widget amp left and right (no gain on this amp) */
6023 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6024 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6027 /* mute analog inputs */
6028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6030 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6032 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6033 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6034 /* Unmute Front out path */
6035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6036 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6037 /* Unmute Headphone out path */
6038 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6039 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6040 /* Unmute Mono out path */
6041 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6042 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6046 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6047 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6048 * audio = 0x16, internal speaker = 0x10.
6050 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6051 /* Disable all GPIOs */
6052 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6053 /* Internal speaker is connected to headphone pin */
6054 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6055 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6057 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6058 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6059 /* Ensure all other unused pins are disabled and muted. */
6060 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6061 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6062 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6063 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6064 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6065 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6069 /* Disable digital (SPDIF) pins */
6070 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6071 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6073 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6074 * when acting as an output.
6076 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6078 /* Start with output sum widgets muted and their output gains at min */
6079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6080 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6081 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6083 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6084 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6085 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6086 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6087 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6089 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6090 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6091 /* Unmute Line1 pin widget output buffer since it starts as an output.
6092 * If the pin mode is changed by the user the pin mode control will
6093 * take care of enabling the pin's input/output buffers as needed.
6094 * Therefore there's no need to enable the input buffer at this
6097 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6098 /* Unmute input buffer of pin widget used for Line-in (no equiv
6101 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6103 /* Mute capture amp left and right */
6104 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6105 /* Set ADC connection select to match default mixer setting - line
6108 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6110 /* Do the same for the second ADC: mute capture input amp and
6111 * set ADC connection to line in (on mic1 pin)
6113 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6114 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6116 /* Mute all inputs to mixer widget (even unconnected ones) */
6117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6129 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6130 * similar laptops (adapted from Fujitsu init verbs).
6132 static struct hda_verb alc260_acer_init_verbs[] = {
6133 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6134 * the headphone jack. Turn this on and rely on the standard mute
6135 * methods whenever the user wants to turn these outputs off.
6137 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6138 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6139 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6140 /* Internal speaker/Headphone jack is connected to Line-out pin */
6141 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6142 /* Internal microphone/Mic jack is connected to Mic1 pin */
6143 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6144 /* Line In jack is connected to Line1 pin */
6145 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6146 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6147 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6148 /* Ensure all other unused pins are disabled and muted. */
6149 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6150 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6151 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6152 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6154 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6155 /* Disable digital (SPDIF) pins */
6156 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6157 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6159 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6160 * bus when acting as outputs.
6162 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6163 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6165 /* Start with output sum widgets muted and their output gains at min */
6166 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6167 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6168 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6171 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6172 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6173 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6174 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6176 /* Unmute Line-out pin widget amp left and right
6177 * (no equiv mixer ctrl)
6179 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6180 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6181 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6182 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6183 * inputs. If the pin mode is changed by the user the pin mode control
6184 * will take care of enabling the pin's input/output buffers as needed.
6185 * Therefore there's no need to enable the input buffer at this
6188 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6189 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6191 /* Mute capture amp left and right */
6192 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6193 /* Set ADC connection select to match default mixer setting - mic
6196 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6198 /* Do similar with the second ADC: mute capture input amp and
6199 * set ADC connection to mic to match ALSA's default state.
6201 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6202 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6204 /* Mute all inputs to mixer widget (even unconnected ones) */
6205 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6206 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6208 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6210 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6211 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6217 /* Initialisation sequence for Maxdata Favorit 100XS
6218 * (adapted from Acer init verbs).
6220 static struct hda_verb alc260_favorit100_init_verbs[] = {
6221 /* GPIO 0 enables the output jack.
6222 * Turn this on and rely on the standard mute
6223 * methods whenever the user wants to turn these outputs off.
6225 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6226 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6227 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6228 /* Line/Mic input jack is connected to Mic1 pin */
6229 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6230 /* Ensure all other unused pins are disabled and muted. */
6231 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6232 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6233 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6234 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6235 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6236 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6241 /* Disable digital (SPDIF) pins */
6242 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6243 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6245 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6246 * bus when acting as outputs.
6248 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6249 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6251 /* Start with output sum widgets muted and their output gains at min */
6252 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6253 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6254 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6255 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6256 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6258 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6259 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6260 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6262 /* Unmute Line-out pin widget amp left and right
6263 * (no equiv mixer ctrl)
6265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6266 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6267 * inputs. If the pin mode is changed by the user the pin mode control
6268 * will take care of enabling the pin's input/output buffers as needed.
6269 * Therefore there's no need to enable the input buffer at this
6272 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6274 /* Mute capture amp left and right */
6275 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6276 /* Set ADC connection select to match default mixer setting - mic
6279 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6281 /* Do similar with the second ADC: mute capture input amp and
6282 * set ADC connection to mic to match ALSA's default state.
6284 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6285 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6287 /* Mute all inputs to mixer widget (even unconnected ones) */
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6294 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6300 static struct hda_verb alc260_will_verbs[] = {
6301 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6302 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6303 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6304 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6305 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6306 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6310 static struct hda_verb alc260_replacer_672v_verbs[] = {
6311 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6312 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6313 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6315 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6316 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6317 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6319 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6323 /* toggle speaker-output according to the hp-jack state */
6324 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6326 unsigned int present;
6328 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6329 present = snd_hda_jack_detect(codec, 0x0f);
6331 snd_hda_codec_write_cache(codec, 0x01, 0,
6332 AC_VERB_SET_GPIO_DATA, 1);
6333 snd_hda_codec_write_cache(codec, 0x0f, 0,
6334 AC_VERB_SET_PIN_WIDGET_CONTROL,
6337 snd_hda_codec_write_cache(codec, 0x01, 0,
6338 AC_VERB_SET_GPIO_DATA, 0);
6339 snd_hda_codec_write_cache(codec, 0x0f, 0,
6340 AC_VERB_SET_PIN_WIDGET_CONTROL,
6345 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6348 if ((res >> 26) == ALC880_HP_EVENT)
6349 alc260_replacer_672v_automute(codec);
6352 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6353 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6355 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6356 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6357 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6359 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6360 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6361 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6362 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6366 /* Test configuration for debugging, modelled after the ALC880 test
6369 #ifdef CONFIG_SND_DEBUG
6370 static hda_nid_t alc260_test_dac_nids[1] = {
6373 static hda_nid_t alc260_test_adc_nids[2] = {
6376 /* For testing the ALC260, each input MUX needs its own definition since
6377 * the signal assignments are different. This assumes that the first ADC
6380 static struct hda_input_mux alc260_test_capture_sources[2] = {
6384 { "MIC1 pin", 0x0 },
6385 { "MIC2 pin", 0x1 },
6386 { "LINE1 pin", 0x2 },
6387 { "LINE2 pin", 0x3 },
6389 { "LINE-OUT pin", 0x5 },
6390 { "HP-OUT pin", 0x6 },
6396 { "MIC1 pin", 0x0 },
6397 { "MIC2 pin", 0x1 },
6398 { "LINE1 pin", 0x2 },
6399 { "LINE2 pin", 0x3 },
6402 { "LINE-OUT pin", 0x6 },
6403 { "HP-OUT pin", 0x7 },
6407 static struct snd_kcontrol_new alc260_test_mixer[] = {
6408 /* Output driver widgets */
6409 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6410 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6411 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6412 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6413 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6414 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6416 /* Modes for retasking pin widgets
6417 * Note: the ALC260 doesn't seem to act on requests to enable mic
6418 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6419 * mention this restriction. At this stage it's not clear whether
6420 * this behaviour is intentional or is a hardware bug in chip
6421 * revisions available at least up until early 2006. Therefore for
6422 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6423 * choices, but if it turns out that the lack of mic bias for these
6424 * NIDs is intentional we could change their modes from
6425 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6427 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6428 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6429 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6430 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6431 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6432 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6434 /* Loopback mixer controls */
6435 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6436 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6437 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6438 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6439 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6440 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6441 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6442 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6443 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6444 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6445 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6446 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6447 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6448 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6450 /* Controls for GPIO pins, assuming they are configured as outputs */
6451 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6452 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6453 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6454 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6456 /* Switches to allow the digital IO pins to be enabled. The datasheet
6457 * is ambigious as to which NID is which; testing on laptops which
6458 * make this output available should provide clarification.
6460 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6461 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6463 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6464 * this output to turn on an external amplifier.
6466 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6467 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6471 static struct hda_verb alc260_test_init_verbs[] = {
6472 /* Enable all GPIOs as outputs with an initial value of 0 */
6473 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6474 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6475 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6477 /* Enable retasking pins as output, initially without power amp */
6478 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6479 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6480 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6481 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6482 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6483 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6485 /* Disable digital (SPDIF) pins initially, but users can enable
6486 * them via a mixer switch. In the case of SPDIF-out, this initverb
6487 * payload also sets the generation to 0, output to be in "consumer"
6488 * PCM format, copyright asserted, no pre-emphasis and no validity
6491 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6492 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6494 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6495 * OUT1 sum bus when acting as an output.
6497 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6498 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6499 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6500 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6502 /* Start with output sum widgets muted and their output gains at min */
6503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6505 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6507 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6508 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6509 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6510 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6511 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6513 /* Unmute retasking pin widget output buffers since the default
6514 * state appears to be output. As the pin mode is changed by the
6515 * user the pin mode control will take care of enabling the pin's
6516 * input/output buffers as needed.
6518 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6521 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6522 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6523 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6524 /* Also unmute the mono-out pin widget */
6525 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6527 /* Mute capture amp left and right */
6528 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6529 /* Set ADC connection select to match default mixer setting (mic1
6532 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6534 /* Do the same for the second ADC: mute capture input amp and
6535 * set ADC connection to mic1 pin
6537 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6538 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6540 /* Mute all inputs to mixer widget (even unconnected ones) */
6541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6554 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6555 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6557 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6558 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6561 * for BIOS auto-configuration
6564 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6565 const char *pfx, int *vol_bits)
6568 unsigned long vol_val, sw_val;
6571 if (nid >= 0x0f && nid < 0x11) {
6572 nid_vol = nid - 0x7;
6573 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6574 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6575 } else if (nid == 0x11) {
6576 nid_vol = nid - 0x7;
6577 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6578 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6579 } else if (nid >= 0x12 && nid <= 0x15) {
6581 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6582 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6586 if (!(*vol_bits & (1 << nid_vol))) {
6587 /* first control for the volume widget */
6588 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6591 *vol_bits |= (1 << nid_vol);
6593 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6599 /* add playback controls from the parsed DAC table */
6600 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6601 const struct auto_pin_cfg *cfg)
6607 spec->multiout.num_dacs = 1;
6608 spec->multiout.dac_nids = spec->private_dac_nids;
6609 spec->multiout.dac_nids[0] = 0x02;
6611 nid = cfg->line_out_pins[0];
6614 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6616 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6620 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6625 nid = cfg->speaker_pins[0];
6627 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6632 nid = cfg->hp_pins[0];
6634 err = alc260_add_playback_controls(spec, nid, "Headphone",
6642 /* create playback/capture controls for input pins */
6643 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6644 const struct auto_pin_cfg *cfg)
6646 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6649 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6650 hda_nid_t nid, int pin_type,
6653 alc_set_pin_output(codec, nid, pin_type);
6654 /* need the manual connection? */
6656 int idx = nid - 0x12;
6657 snd_hda_codec_write(codec, idx + 0x0b, 0,
6658 AC_VERB_SET_CONNECT_SEL, sel_idx);
6662 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6664 struct alc_spec *spec = codec->spec;
6667 nid = spec->autocfg.line_out_pins[0];
6669 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6670 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6673 nid = spec->autocfg.speaker_pins[0];
6675 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6677 nid = spec->autocfg.hp_pins[0];
6679 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6682 #define ALC260_PIN_CD_NID 0x16
6683 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6685 struct alc_spec *spec = codec->spec;
6686 struct auto_pin_cfg *cfg = &spec->autocfg;
6689 for (i = 0; i < cfg->num_inputs; i++) {
6690 hda_nid_t nid = cfg->inputs[i].pin;
6692 alc_set_input_pin(codec, nid, i);
6693 if (nid != ALC260_PIN_CD_NID &&
6694 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6695 snd_hda_codec_write(codec, nid, 0,
6696 AC_VERB_SET_AMP_GAIN_MUTE,
6702 #define alc260_auto_init_input_src alc880_auto_init_input_src
6705 * generic initialization of ADC, input mixers and output mixers
6707 static struct hda_verb alc260_volume_init_verbs[] = {
6709 * Unmute ADC0-1 and set the default input to mic-in
6711 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6712 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6713 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6714 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6716 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6718 * Note: PASD motherboards uses the Line In 2 as the input for
6719 * front panel mic (mic 2)
6721 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6722 /* mute analog inputs */
6723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6727 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6730 * Set up output mixers (0x08 - 0x0a)
6732 /* set vol=0 to output mixers */
6733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6735 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6736 /* set up input amps for analog loopback */
6737 /* Amp Indices: DAC = 0, mixer = 1 */
6738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6742 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6743 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6748 static int alc260_parse_auto_config(struct hda_codec *codec)
6750 struct alc_spec *spec = codec->spec;
6752 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6754 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6758 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6761 if (!spec->kctls.list)
6762 return 0; /* can't find valid BIOS pin config */
6763 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6767 spec->multiout.max_channels = 2;
6769 if (spec->autocfg.dig_outs)
6770 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6771 if (spec->kctls.list)
6772 add_mixer(spec, spec->kctls.list);
6774 add_verb(spec, alc260_volume_init_verbs);
6776 spec->num_mux_defs = 1;
6777 spec->input_mux = &spec->private_imux[0];
6779 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6784 /* additional initialization for auto-configuration model */
6785 static void alc260_auto_init(struct hda_codec *codec)
6787 struct alc_spec *spec = codec->spec;
6788 alc260_auto_init_multi_out(codec);
6789 alc260_auto_init_analog_input(codec);
6790 alc260_auto_init_input_src(codec);
6791 alc_auto_init_digital(codec);
6792 if (spec->unsol_event)
6793 alc_inithook(codec);
6796 #ifdef CONFIG_SND_HDA_POWER_SAVE
6797 static struct hda_amp_list alc260_loopbacks[] = {
6798 { 0x07, HDA_INPUT, 0 },
6799 { 0x07, HDA_INPUT, 1 },
6800 { 0x07, HDA_INPUT, 2 },
6801 { 0x07, HDA_INPUT, 3 },
6802 { 0x07, HDA_INPUT, 4 },
6814 static const struct alc_fixup alc260_fixups[] = {
6815 [PINFIX_HP_DC5750] = {
6816 .pins = (const struct alc_pincfg[]) {
6817 { 0x11, 0x90130110 }, /* speaker */
6823 static struct snd_pci_quirk alc260_fixup_tbl[] = {
6824 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
6829 * ALC260 configurations
6831 static const char *alc260_models[ALC260_MODEL_LAST] = {
6832 [ALC260_BASIC] = "basic",
6834 [ALC260_HP_3013] = "hp-3013",
6835 [ALC260_HP_DC7600] = "hp-dc7600",
6836 [ALC260_FUJITSU_S702X] = "fujitsu",
6837 [ALC260_ACER] = "acer",
6838 [ALC260_WILL] = "will",
6839 [ALC260_REPLACER_672V] = "replacer",
6840 [ALC260_FAVORIT100] = "favorit100",
6841 #ifdef CONFIG_SND_DEBUG
6842 [ALC260_TEST] = "test",
6844 [ALC260_AUTO] = "auto",
6847 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6848 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6849 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6850 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6851 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6852 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6853 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6854 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6855 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6856 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6857 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6858 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6859 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6860 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6861 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6862 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6863 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6864 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6865 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6866 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6867 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6871 static struct alc_config_preset alc260_presets[] = {
6873 .mixers = { alc260_base_output_mixer,
6874 alc260_input_mixer },
6875 .init_verbs = { alc260_init_verbs },
6876 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6877 .dac_nids = alc260_dac_nids,
6878 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6879 .adc_nids = alc260_dual_adc_nids,
6880 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6881 .channel_mode = alc260_modes,
6882 .input_mux = &alc260_capture_source,
6885 .mixers = { alc260_hp_output_mixer,
6886 alc260_input_mixer },
6887 .init_verbs = { alc260_init_verbs,
6888 alc260_hp_unsol_verbs },
6889 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6890 .dac_nids = alc260_dac_nids,
6891 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6892 .adc_nids = alc260_adc_nids_alt,
6893 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6894 .channel_mode = alc260_modes,
6895 .input_mux = &alc260_capture_source,
6896 .unsol_event = alc260_hp_unsol_event,
6897 .init_hook = alc260_hp_automute,
6899 [ALC260_HP_DC7600] = {
6900 .mixers = { alc260_hp_dc7600_mixer,
6901 alc260_input_mixer },
6902 .init_verbs = { alc260_init_verbs,
6903 alc260_hp_dc7600_verbs },
6904 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6905 .dac_nids = alc260_dac_nids,
6906 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6907 .adc_nids = alc260_adc_nids_alt,
6908 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6909 .channel_mode = alc260_modes,
6910 .input_mux = &alc260_capture_source,
6911 .unsol_event = alc260_hp_3012_unsol_event,
6912 .init_hook = alc260_hp_3012_automute,
6914 [ALC260_HP_3013] = {
6915 .mixers = { alc260_hp_3013_mixer,
6916 alc260_input_mixer },
6917 .init_verbs = { alc260_hp_3013_init_verbs,
6918 alc260_hp_3013_unsol_verbs },
6919 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6920 .dac_nids = alc260_dac_nids,
6921 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6922 .adc_nids = alc260_adc_nids_alt,
6923 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6924 .channel_mode = alc260_modes,
6925 .input_mux = &alc260_capture_source,
6926 .unsol_event = alc260_hp_3013_unsol_event,
6927 .init_hook = alc260_hp_3013_automute,
6929 [ALC260_FUJITSU_S702X] = {
6930 .mixers = { alc260_fujitsu_mixer },
6931 .init_verbs = { alc260_fujitsu_init_verbs },
6932 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6933 .dac_nids = alc260_dac_nids,
6934 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6935 .adc_nids = alc260_dual_adc_nids,
6936 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6937 .channel_mode = alc260_modes,
6938 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6939 .input_mux = alc260_fujitsu_capture_sources,
6942 .mixers = { alc260_acer_mixer },
6943 .init_verbs = { alc260_acer_init_verbs },
6944 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6945 .dac_nids = alc260_dac_nids,
6946 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6947 .adc_nids = alc260_dual_adc_nids,
6948 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6949 .channel_mode = alc260_modes,
6950 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6951 .input_mux = alc260_acer_capture_sources,
6953 [ALC260_FAVORIT100] = {
6954 .mixers = { alc260_favorit100_mixer },
6955 .init_verbs = { alc260_favorit100_init_verbs },
6956 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6957 .dac_nids = alc260_dac_nids,
6958 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6959 .adc_nids = alc260_dual_adc_nids,
6960 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6961 .channel_mode = alc260_modes,
6962 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6963 .input_mux = alc260_favorit100_capture_sources,
6966 .mixers = { alc260_will_mixer },
6967 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6968 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6969 .dac_nids = alc260_dac_nids,
6970 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6971 .adc_nids = alc260_adc_nids,
6972 .dig_out_nid = ALC260_DIGOUT_NID,
6973 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6974 .channel_mode = alc260_modes,
6975 .input_mux = &alc260_capture_source,
6977 [ALC260_REPLACER_672V] = {
6978 .mixers = { alc260_replacer_672v_mixer },
6979 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6980 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6981 .dac_nids = alc260_dac_nids,
6982 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6983 .adc_nids = alc260_adc_nids,
6984 .dig_out_nid = ALC260_DIGOUT_NID,
6985 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6986 .channel_mode = alc260_modes,
6987 .input_mux = &alc260_capture_source,
6988 .unsol_event = alc260_replacer_672v_unsol_event,
6989 .init_hook = alc260_replacer_672v_automute,
6991 #ifdef CONFIG_SND_DEBUG
6993 .mixers = { alc260_test_mixer },
6994 .init_verbs = { alc260_test_init_verbs },
6995 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6996 .dac_nids = alc260_test_dac_nids,
6997 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6998 .adc_nids = alc260_test_adc_nids,
6999 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7000 .channel_mode = alc260_modes,
7001 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7002 .input_mux = alc260_test_capture_sources,
7007 static int patch_alc260(struct hda_codec *codec)
7009 struct alc_spec *spec;
7010 int err, board_config;
7012 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7018 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7021 if (board_config < 0) {
7022 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7024 board_config = ALC260_AUTO;
7027 if (board_config == ALC260_AUTO)
7028 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7030 if (board_config == ALC260_AUTO) {
7031 /* automatic parse from the BIOS config */
7032 err = alc260_parse_auto_config(codec);
7038 "hda_codec: Cannot set up configuration "
7039 "from BIOS. Using base mode...\n");
7040 board_config = ALC260_BASIC;
7044 err = snd_hda_attach_beep_device(codec, 0x1);
7050 if (board_config != ALC260_AUTO)
7051 setup_preset(codec, &alc260_presets[board_config]);
7053 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7054 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7055 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7057 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7058 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7060 if (!spec->adc_nids && spec->input_mux) {
7061 /* check whether NID 0x04 is valid */
7062 unsigned int wcap = get_wcaps(codec, 0x04);
7063 wcap = get_wcaps_type(wcap);
7065 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7066 spec->adc_nids = alc260_adc_nids_alt;
7067 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7069 spec->adc_nids = alc260_adc_nids;
7070 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7073 set_capture_mixer(codec);
7074 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7076 if (board_config == ALC260_AUTO)
7077 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7079 spec->vmaster_nid = 0x08;
7081 codec->patch_ops = alc_patch_ops;
7082 if (board_config == ALC260_AUTO)
7083 spec->init_hook = alc260_auto_init;
7084 #ifdef CONFIG_SND_HDA_POWER_SAVE
7085 if (!spec->loopback.amplist)
7086 spec->loopback.amplist = alc260_loopbacks;
7094 * ALC882/883/885/888/889 support
7096 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7097 * configuration. Each pin widget can choose any input DACs and a mixer.
7098 * Each ADC is connected from a mixer of all inputs. This makes possible
7099 * 6-channel independent captures.
7101 * In addition, an independent DAC for the multi-playback (not used in this
7104 #define ALC882_DIGOUT_NID 0x06
7105 #define ALC882_DIGIN_NID 0x0a
7106 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7107 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7108 #define ALC1200_DIGOUT_NID 0x10
7111 static struct hda_channel_mode alc882_ch_modes[1] = {
7116 static hda_nid_t alc882_dac_nids[4] = {
7117 /* front, rear, clfe, rear_surr */
7118 0x02, 0x03, 0x04, 0x05
7120 #define alc883_dac_nids alc882_dac_nids
7123 #define alc882_adc_nids alc880_adc_nids
7124 #define alc882_adc_nids_alt alc880_adc_nids_alt
7125 #define alc883_adc_nids alc882_adc_nids_alt
7126 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7127 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7128 #define alc889_adc_nids alc880_adc_nids
7130 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7131 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7132 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7133 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7134 #define alc889_capsrc_nids alc882_capsrc_nids
7137 /* FIXME: should be a matrix-type input source selection */
7139 static struct hda_input_mux alc882_capture_source = {
7143 { "Front Mic", 0x1 },
7149 #define alc883_capture_source alc882_capture_source
7151 static struct hda_input_mux alc889_capture_source = {
7154 { "Front Mic", 0x0 },
7160 static struct hda_input_mux mb5_capture_source = {
7169 static struct hda_input_mux macmini3_capture_source = {
7177 static struct hda_input_mux alc883_3stack_6ch_intel = {
7181 { "Front Mic", 0x0 },
7187 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7195 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7205 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7213 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7217 { "Front Mic", 0x1 },
7222 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7230 static struct hda_input_mux alc889A_mb31_capture_source = {
7234 /* Front Mic (0x01) unused */
7236 /* Line 2 (0x03) unused */
7237 /* CD (0x04) unused? */
7241 static struct hda_input_mux alc889A_imac91_capture_source = {
7245 { "Line", 0x2 }, /* Not sure! */
7252 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7259 static struct hda_verb alc882_3ST_ch2_init[] = {
7260 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7261 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7262 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7263 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7270 static struct hda_verb alc882_3ST_ch4_init[] = {
7271 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7272 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7273 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7274 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7275 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7282 static struct hda_verb alc882_3ST_ch6_init[] = {
7283 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7284 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7285 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7286 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7287 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7288 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7292 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7293 { 2, alc882_3ST_ch2_init },
7294 { 4, alc882_3ST_ch4_init },
7295 { 6, alc882_3ST_ch6_init },
7298 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7303 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7304 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7305 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7306 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7307 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7308 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7315 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7316 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7317 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7318 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7319 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7320 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7321 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7328 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7329 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7330 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7331 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7332 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7333 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7334 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7335 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7339 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7340 { 2, alc883_3ST_ch2_clevo_init },
7341 { 4, alc883_3ST_ch4_clevo_init },
7342 { 6, alc883_3ST_ch6_clevo_init },
7349 static struct hda_verb alc882_sixstack_ch6_init[] = {
7350 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7351 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7352 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7353 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7360 static struct hda_verb alc882_sixstack_ch8_init[] = {
7361 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7362 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7363 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7364 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7368 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7369 { 6, alc882_sixstack_ch6_init },
7370 { 8, alc882_sixstack_ch8_init },
7374 /* Macbook Air 2,1 */
7376 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7381 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7387 static struct hda_verb alc885_mbp_ch2_init[] = {
7388 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7389 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7390 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7397 static struct hda_verb alc885_mbp_ch4_init[] = {
7398 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7399 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7400 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7401 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7402 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7406 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7407 { 2, alc885_mbp_ch2_init },
7408 { 4, alc885_mbp_ch4_init },
7413 * Speakers/Woofer/HP = Front
7416 static struct hda_verb alc885_mb5_ch2_init[] = {
7417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7424 * Speakers/HP = Front
7428 static struct hda_verb alc885_mb5_ch6_init[] = {
7429 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7430 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7435 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7436 { 2, alc885_mb5_ch2_init },
7437 { 6, alc885_mb5_ch6_init },
7440 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7445 static struct hda_verb alc883_4ST_ch2_init[] = {
7446 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7447 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7448 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7449 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7450 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7451 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7458 static struct hda_verb alc883_4ST_ch4_init[] = {
7459 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7460 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7461 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7462 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7463 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7464 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7465 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7472 static struct hda_verb alc883_4ST_ch6_init[] = {
7473 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7474 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7475 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7476 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7477 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7478 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7479 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7480 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7487 static struct hda_verb alc883_4ST_ch8_init[] = {
7488 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7489 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7490 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7491 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7492 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7493 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7494 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7495 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7496 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7500 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7501 { 2, alc883_4ST_ch2_init },
7502 { 4, alc883_4ST_ch4_init },
7503 { 6, alc883_4ST_ch6_init },
7504 { 8, alc883_4ST_ch8_init },
7511 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7512 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7513 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7514 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7515 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7522 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7523 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7524 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7525 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7526 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7527 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7534 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7535 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7536 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7537 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7538 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7539 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7540 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7544 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7545 { 2, alc883_3ST_ch2_intel_init },
7546 { 4, alc883_3ST_ch4_intel_init },
7547 { 6, alc883_3ST_ch6_intel_init },
7553 static struct hda_verb alc889_ch2_intel_init[] = {
7554 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7555 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7556 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7557 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7558 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7559 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7566 static struct hda_verb alc889_ch6_intel_init[] = {
7567 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7568 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7569 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7570 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7571 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7572 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7579 static struct hda_verb alc889_ch8_intel_init[] = {
7580 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7581 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7582 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7583 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7584 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7585 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7586 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7590 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7591 { 2, alc889_ch2_intel_init },
7592 { 6, alc889_ch6_intel_init },
7593 { 8, alc889_ch8_intel_init },
7599 static struct hda_verb alc883_sixstack_ch6_init[] = {
7600 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7601 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7602 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7603 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7610 static struct hda_verb alc883_sixstack_ch8_init[] = {
7611 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7612 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7613 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7614 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7618 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7619 { 6, alc883_sixstack_ch6_init },
7620 { 8, alc883_sixstack_ch8_init },
7624 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7625 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7627 static struct snd_kcontrol_new alc882_base_mixer[] = {
7628 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7629 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7630 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7631 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7632 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7633 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7634 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7635 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7636 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7639 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7640 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7642 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7644 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7646 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7647 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7648 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7652 /* Macbook Air 2,1 same control for HP and internal Speaker */
7654 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7655 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7656 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7661 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7662 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7663 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7664 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7665 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7667 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7668 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7670 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7671 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7676 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7677 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7678 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7679 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7680 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7681 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7682 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7683 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7684 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7685 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7686 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7688 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7689 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7690 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7694 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7695 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7696 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7697 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7698 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7699 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7700 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7701 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7702 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7703 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7704 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7705 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7709 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7710 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7711 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7716 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7717 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7718 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7719 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7720 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7721 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7722 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7724 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7729 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7730 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7731 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7733 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7734 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7736 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7738 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7739 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7740 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7742 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7746 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7747 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7749 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7750 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7751 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7753 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7759 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7766 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7767 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7768 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7769 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7770 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7771 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7772 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7773 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7774 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7775 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7780 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7783 .name = "Channel Mode",
7784 .info = alc_ch_mode_info,
7785 .get = alc_ch_mode_get,
7786 .put = alc_ch_mode_put,
7791 static struct hda_verb alc882_base_init_verbs[] = {
7792 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7793 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7796 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7797 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7799 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7800 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7802 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7803 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7805 /* Front Pin: output 0 (0x0c) */
7806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7809 /* Rear Pin: output 1 (0x0d) */
7810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7812 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7813 /* CLFE Pin: output 2 (0x0e) */
7814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7816 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7817 /* Side Pin: output 3 (0x0f) */
7818 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7819 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7820 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7821 /* Mic (rear) pin: input vref at 80% */
7822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7824 /* Front Mic pin: input vref at 80% */
7825 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7827 /* Line In pin: input */
7828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7830 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7833 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7834 /* CD pin widget for input */
7835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7837 /* FIXME: use matrix-type input source selection */
7838 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7842 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7843 /* ADC2: mute amp left and right */
7844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7845 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7846 /* ADC3: mute amp left and right */
7847 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7848 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7853 static struct hda_verb alc882_adc1_init_verbs[] = {
7854 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7855 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7859 /* ADC1: mute amp left and right */
7860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7861 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7865 static struct hda_verb alc882_eapd_verbs[] = {
7866 /* change to EAPD mode */
7867 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7868 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7872 static struct hda_verb alc889_eapd_verbs[] = {
7873 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7874 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7878 static struct hda_verb alc_hp15_unsol_verbs[] = {
7879 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7884 static struct hda_verb alc885_init_verbs[] = {
7885 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7895 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7896 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7898 /* Front HP Pin: output 0 (0x0c) */
7899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7902 /* Front Pin: output 0 (0x0c) */
7903 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7904 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7905 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7906 /* Rear Pin: output 1 (0x0d) */
7907 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7908 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7909 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7910 /* CLFE Pin: output 2 (0x0e) */
7911 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7912 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7913 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7914 /* Side Pin: output 3 (0x0f) */
7915 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7916 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7917 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7918 /* Mic (rear) pin: input vref at 80% */
7919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7920 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7921 /* Front Mic pin: input vref at 80% */
7922 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7924 /* Line In pin: input */
7925 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7926 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7928 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7930 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7932 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7935 /* ADC2: mute amp left and right */
7936 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7937 /* ADC3: mute amp left and right */
7938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7943 static struct hda_verb alc885_init_input_verbs[] = {
7944 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7945 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7946 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7951 /* Unmute Selector 24h and set the default input to front mic */
7952 static struct hda_verb alc889_init_input_verbs[] = {
7953 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7959 #define alc883_init_verbs alc882_base_init_verbs
7962 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7963 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7964 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7966 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7967 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7968 /* FIXME: this looks suspicious...
7969 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7970 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7975 static struct hda_verb alc882_macpro_init_verbs[] = {
7976 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7980 /* Front Pin: output 0 (0x0c) */
7981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7982 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7983 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7984 /* Front Mic pin: input vref at 80% */
7985 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7987 /* Speaker: output */
7988 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7990 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7991 /* Headphone output (output 0 - 0x0c) */
7992 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7993 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7994 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7996 /* FIXME: use matrix-type input source selection */
7997 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7998 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8000 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8001 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8002 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8013 /* ADC1: mute amp left and right */
8014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8015 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8016 /* ADC2: mute amp left and right */
8017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8018 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8019 /* ADC3: mute amp left and right */
8020 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8021 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8027 static struct hda_verb alc885_mb5_init_verbs[] = {
8029 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8030 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8031 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8032 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8034 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8037 /* Surround mixer */
8038 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8039 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8043 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8044 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8046 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8047 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8048 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8049 /* Front Pin (0x0c) */
8050 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8051 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8052 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8053 /* LFE Pin (0x0e) */
8054 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8055 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8056 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8059 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8060 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8061 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8062 /* Front Mic pin: input vref at 80% */
8063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8071 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8076 static struct hda_verb alc885_macmini3_init_verbs[] = {
8078 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8079 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8080 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8081 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8083 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8084 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8086 /* Surround mixer */
8087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8088 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8089 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8091 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8092 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8095 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8096 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8097 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8098 /* Front Pin (0x0c) */
8099 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8101 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8102 /* LFE Pin (0x0e) */
8103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8104 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8105 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8107 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8109 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8110 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8112 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8117 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8118 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8123 static struct hda_verb alc885_mba21_init_verbs[] = {
8124 /*Internal and HP Speaker Mixer*/
8125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8127 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8128 /*Internal Speaker Pin (0x0c)*/
8129 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8131 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8132 /* HP Pin: output 0 (0x0e) */
8133 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8134 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8135 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8136 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8137 /* Line in (is hp when jack connected)*/
8138 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8139 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8145 /* Macbook Pro rev3 */
8146 static struct hda_verb alc885_mbp3_init_verbs[] = {
8147 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8148 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8153 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8154 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8156 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8157 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8159 /* Front Pin: output 0 (0x0c) */
8160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8161 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8162 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8163 /* HP Pin: output 0 (0x0e) */
8164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8165 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8166 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8167 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8168 /* Mic (rear) pin: input vref at 80% */
8169 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8170 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8171 /* Front Mic pin: input vref at 80% */
8172 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8173 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8174 /* Line In pin: use output 1 when in LineOut mode */
8175 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8176 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8177 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8179 /* FIXME: use matrix-type input source selection */
8180 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8181 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8187 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8188 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8189 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8192 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8196 /* ADC1: mute amp left and right */
8197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8198 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8199 /* ADC2: mute amp left and right */
8200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8201 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8202 /* ADC3: mute amp left and right */
8203 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8204 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8210 static struct hda_verb alc885_imac91_init_verbs[] = {
8211 /* Internal Speaker Pin (0x0c) */
8212 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8213 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8214 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8215 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8216 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8217 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8221 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8222 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8224 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8226 /* Front Mic pin: input vref at 80% */
8227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8228 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8230 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8231 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8232 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8233 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8236 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8237 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8240 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8242 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8247 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8252 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8253 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8254 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8255 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8256 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8257 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8258 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8259 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8260 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8264 /* iMac 24 mixer. */
8265 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8266 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8267 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8271 /* iMac 24 init verbs. */
8272 static struct hda_verb alc885_imac24_init_verbs[] = {
8273 /* Internal speakers: output 0 (0x0c) */
8274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8276 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8277 /* Internal speakers: output 0 (0x0c) */
8278 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8279 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8280 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8281 /* Headphone: output 0 (0x0c) */
8282 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8283 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8284 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8285 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8286 /* Front Mic: input vref at 80% */
8287 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8292 /* Toggle speaker-output according to the hp-jack state */
8293 static void alc885_imac24_setup(struct hda_codec *codec)
8295 struct alc_spec *spec = codec->spec;
8297 spec->autocfg.hp_pins[0] = 0x14;
8298 spec->autocfg.speaker_pins[0] = 0x18;
8299 spec->autocfg.speaker_pins[1] = 0x1a;
8302 #define alc885_mb5_setup alc885_imac24_setup
8303 #define alc885_macmini3_setup alc885_imac24_setup
8305 /* Macbook Air 2,1 */
8306 static void alc885_mba21_setup(struct hda_codec *codec)
8308 struct alc_spec *spec = codec->spec;
8310 spec->autocfg.hp_pins[0] = 0x14;
8311 spec->autocfg.speaker_pins[0] = 0x18;
8316 static void alc885_mbp3_setup(struct hda_codec *codec)
8318 struct alc_spec *spec = codec->spec;
8320 spec->autocfg.hp_pins[0] = 0x15;
8321 spec->autocfg.speaker_pins[0] = 0x14;
8324 static void alc885_imac91_setup(struct hda_codec *codec)
8326 struct alc_spec *spec = codec->spec;
8328 spec->autocfg.hp_pins[0] = 0x14;
8329 spec->autocfg.speaker_pins[0] = 0x18;
8330 spec->autocfg.speaker_pins[1] = 0x1a;
8333 static struct hda_verb alc882_targa_verbs[] = {
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8338 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8340 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8341 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8342 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8344 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8348 /* toggle speaker-output according to the hp-jack state */
8349 static void alc882_targa_automute(struct hda_codec *codec)
8351 struct alc_spec *spec = codec->spec;
8352 alc_automute_amp(codec);
8353 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8354 spec->jack_present ? 1 : 3);
8357 static void alc882_targa_setup(struct hda_codec *codec)
8359 struct alc_spec *spec = codec->spec;
8361 spec->autocfg.hp_pins[0] = 0x14;
8362 spec->autocfg.speaker_pins[0] = 0x1b;
8365 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8367 if ((res >> 26) == ALC880_HP_EVENT)
8368 alc882_targa_automute(codec);
8371 static struct hda_verb alc882_asus_a7j_verbs[] = {
8372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8379 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8381 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8383 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8384 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8385 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8389 static struct hda_verb alc882_asus_a7m_verbs[] = {
8390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8391 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8394 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8395 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8397 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8399 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8401 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8402 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8403 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8407 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8409 unsigned int gpiostate, gpiomask, gpiodir;
8411 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8412 AC_VERB_GET_GPIO_DATA, 0);
8415 gpiostate |= (1 << pin);
8417 gpiostate &= ~(1 << pin);
8419 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8420 AC_VERB_GET_GPIO_MASK, 0);
8421 gpiomask |= (1 << pin);
8423 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8424 AC_VERB_GET_GPIO_DIRECTION, 0);
8425 gpiodir |= (1 << pin);
8428 snd_hda_codec_write(codec, codec->afg, 0,
8429 AC_VERB_SET_GPIO_MASK, gpiomask);
8430 snd_hda_codec_write(codec, codec->afg, 0,
8431 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8435 snd_hda_codec_write(codec, codec->afg, 0,
8436 AC_VERB_SET_GPIO_DATA, gpiostate);
8439 /* set up GPIO at initialization */
8440 static void alc885_macpro_init_hook(struct hda_codec *codec)
8442 alc882_gpio_mute(codec, 0, 0);
8443 alc882_gpio_mute(codec, 1, 0);
8446 /* set up GPIO and update auto-muting at initialization */
8447 static void alc885_imac24_init_hook(struct hda_codec *codec)
8449 alc885_macpro_init_hook(codec);
8450 alc_automute_amp(codec);
8454 * generic initialization of ADC, input mixers and output mixers
8456 static struct hda_verb alc883_auto_init_verbs[] = {
8458 * Unmute ADC0-2 and set the default input to mic-in
8460 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8462 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8463 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 * Set up output mixers (0x0c - 0x0f)
8468 /* set vol=0 to output mixers */
8469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8472 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8473 /* set up input amps for analog loopback */
8474 /* Amp Indices: DAC = 0, mixer = 1 */
8475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8481 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8482 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8483 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8484 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8486 /* FIXME: use matrix-type input source selection */
8487 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8495 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8496 static struct hda_verb alc889A_mb31_ch2_init[] = {
8497 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8499 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8500 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8504 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8505 static struct hda_verb alc889A_mb31_ch4_init[] = {
8506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8513 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8514 static struct hda_verb alc889A_mb31_ch5_init[] = {
8515 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8517 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8518 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8522 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8523 static struct hda_verb alc889A_mb31_ch6_init[] = {
8524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8525 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8526 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8527 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8531 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8532 { 2, alc889A_mb31_ch2_init },
8533 { 4, alc889A_mb31_ch4_init },
8534 { 5, alc889A_mb31_ch5_init },
8535 { 6, alc889A_mb31_ch6_init },
8538 static struct hda_verb alc883_medion_eapd_verbs[] = {
8539 /* eanable EAPD on medion laptop */
8540 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8541 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8545 #define alc883_base_mixer alc882_base_mixer
8547 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8548 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8549 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8550 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8551 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8552 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8553 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8554 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8556 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8557 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8558 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8559 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8560 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8564 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8565 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8566 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8567 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8568 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8570 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8571 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8572 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8573 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8574 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8578 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8579 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8580 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8581 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8582 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8584 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8585 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8586 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8587 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8588 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8592 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8593 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8594 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8595 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8596 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8597 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8598 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8601 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8603 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8604 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8605 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8609 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8610 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8611 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8613 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8614 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8615 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8616 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8617 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8618 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8619 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8620 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8621 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8622 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8623 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8624 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8625 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8626 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8627 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8628 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8632 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8633 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8634 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8635 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8636 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8637 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8639 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8640 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8641 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8642 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8643 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8644 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8645 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8646 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8648 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8649 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8650 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8651 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8656 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8657 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8658 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8659 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8660 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8661 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8663 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8664 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8665 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8666 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8667 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8668 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8672 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8674 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8675 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8680 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8681 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8682 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8683 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8684 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8685 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8690 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8691 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8692 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8693 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8695 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8697 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8698 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8703 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8704 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8705 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8707 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8708 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8709 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8710 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8711 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8712 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8713 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8715 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8716 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8717 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8719 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8724 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8725 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8726 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8728 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8731 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8732 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8734 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8735 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8736 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8740 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8741 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8742 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8743 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8744 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8745 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8749 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8750 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8751 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8752 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8753 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8755 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8761 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8762 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8763 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8764 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8765 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8766 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8767 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8769 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8770 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8774 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8775 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8777 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8778 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8779 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8787 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8788 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8789 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8790 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8792 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8793 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8797 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8798 /* Unmute front mixer */
8799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8802 /* Set speaker pin to front mixer */
8803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8805 /* Init headphone pin */
8806 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8807 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8808 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8809 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8814 /* toggle speaker-output according to the hp-jack state */
8815 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8817 struct alc_spec *spec = codec->spec;
8819 spec->autocfg.hp_pins[0] = 0x1a;
8820 spec->autocfg.speaker_pins[0] = 0x15;
8823 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8824 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8825 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8826 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8827 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8828 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8830 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8835 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8836 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8838 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8839 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8840 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8841 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8848 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8849 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8850 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8851 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8852 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8853 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8854 0x0d, 1, 0x0, HDA_OUTPUT),
8855 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8856 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8857 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8858 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8859 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8860 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8861 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8862 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8863 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8867 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8868 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8869 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8873 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8875 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8876 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8877 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8878 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8879 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8881 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8883 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8884 /* Output switches */
8885 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8886 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8887 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8899 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8900 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8901 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8903 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8904 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8909 static struct hda_bind_ctls alc883_bind_cap_vol = {
8910 .ops = &snd_hda_bind_vol,
8912 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8913 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8918 static struct hda_bind_ctls alc883_bind_cap_switch = {
8919 .ops = &snd_hda_bind_sw,
8921 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8922 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8927 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8928 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8929 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8930 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8934 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8935 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8939 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8940 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8941 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8943 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8944 /* .name = "Capture Source", */
8945 .name = "Input Source",
8947 .info = alc_mux_enum_info,
8948 .get = alc_mux_enum_get,
8949 .put = alc_mux_enum_put,
8954 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8956 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8957 .name = "Channel Mode",
8958 .info = alc_ch_mode_info,
8959 .get = alc_ch_mode_get,
8960 .put = alc_ch_mode_put,
8965 /* toggle speaker-output according to the hp-jack state */
8966 static void alc883_mitac_setup(struct hda_codec *codec)
8968 struct alc_spec *spec = codec->spec;
8970 spec->autocfg.hp_pins[0] = 0x15;
8971 spec->autocfg.speaker_pins[0] = 0x14;
8972 spec->autocfg.speaker_pins[1] = 0x17;
8975 /* auto-toggle front mic */
8977 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8979 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8981 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8985 static struct hda_verb alc883_mitac_verbs[] = {
8987 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8990 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8991 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8993 /* enable unsolicited event */
8994 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8995 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9000 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9002 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9003 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9005 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9007 /* enable unsolicited event */
9009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9010 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9016 static struct hda_verb alc883_clevo_m720_verbs[] = {
9018 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9021 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9024 /* enable unsolicited event */
9025 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9026 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9031 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9033 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9034 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9036 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9037 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9039 /* enable unsolicited event */
9040 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9045 static struct hda_verb alc883_targa_verbs[] = {
9046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9052 /* Connect Line-Out side jack (SPDIF) to Side */
9053 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9054 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9055 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9056 /* Connect Mic jack to CLFE */
9057 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9058 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9059 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9060 /* Connect Line-in jack to Surround */
9061 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9062 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9063 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9064 /* Connect HP out jack to Front */
9065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9066 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9067 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9069 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9074 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9075 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9076 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9077 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9081 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9085 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9089 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9093 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9094 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9098 static struct hda_verb alc883_haier_w66_verbs[] = {
9099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9104 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9105 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9106 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9107 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9111 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9112 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9113 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9114 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9116 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9117 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9118 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9119 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9123 static struct hda_verb alc888_6st_dell_verbs[] = {
9124 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9128 static struct hda_verb alc883_vaiott_verbs[] = {
9130 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9133 /* enable unsolicited event */
9134 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9139 static void alc888_3st_hp_setup(struct hda_codec *codec)
9141 struct alc_spec *spec = codec->spec;
9143 spec->autocfg.hp_pins[0] = 0x1b;
9144 spec->autocfg.speaker_pins[0] = 0x14;
9145 spec->autocfg.speaker_pins[1] = 0x16;
9146 spec->autocfg.speaker_pins[2] = 0x18;
9149 static struct hda_verb alc888_3st_hp_verbs[] = {
9150 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9151 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9152 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9153 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9160 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9161 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9162 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9163 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9164 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9171 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9172 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9173 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9174 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9175 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9176 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9183 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9184 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9185 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9186 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9187 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9188 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9189 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9193 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9194 { 2, alc888_3st_hp_2ch_init },
9195 { 4, alc888_3st_hp_4ch_init },
9196 { 6, alc888_3st_hp_6ch_init },
9199 /* toggle front-jack and RCA according to the hp-jack state */
9200 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9202 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9204 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9205 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9206 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9207 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9210 /* toggle RCA according to the front-jack state */
9211 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9213 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9215 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9216 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9219 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9222 if ((res >> 26) == ALC880_HP_EVENT)
9223 alc888_lenovo_ms7195_front_automute(codec);
9224 if ((res >> 26) == ALC880_FRONT_EVENT)
9225 alc888_lenovo_ms7195_rca_automute(codec);
9228 static struct hda_verb alc883_medion_md2_verbs[] = {
9229 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9230 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9232 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9234 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9238 /* toggle speaker-output according to the hp-jack state */
9239 static void alc883_medion_md2_setup(struct hda_codec *codec)
9241 struct alc_spec *spec = codec->spec;
9243 spec->autocfg.hp_pins[0] = 0x14;
9244 spec->autocfg.speaker_pins[0] = 0x15;
9247 /* toggle speaker-output according to the hp-jack state */
9248 #define alc883_targa_init_hook alc882_targa_init_hook
9249 #define alc883_targa_unsol_event alc882_targa_unsol_event
9251 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9253 unsigned int present;
9255 present = snd_hda_jack_detect(codec, 0x18);
9256 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9257 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9260 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9262 struct alc_spec *spec = codec->spec;
9264 spec->autocfg.hp_pins[0] = 0x15;
9265 spec->autocfg.speaker_pins[0] = 0x14;
9268 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9270 alc_automute_amp(codec);
9271 alc883_clevo_m720_mic_automute(codec);
9274 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9277 switch (res >> 26) {
9278 case ALC880_MIC_EVENT:
9279 alc883_clevo_m720_mic_automute(codec);
9282 alc_automute_amp_unsol_event(codec, res);
9287 /* toggle speaker-output according to the hp-jack state */
9288 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9290 struct alc_spec *spec = codec->spec;
9292 spec->autocfg.hp_pins[0] = 0x14;
9293 spec->autocfg.speaker_pins[0] = 0x15;
9296 static void alc883_haier_w66_setup(struct hda_codec *codec)
9298 struct alc_spec *spec = codec->spec;
9300 spec->autocfg.hp_pins[0] = 0x1b;
9301 spec->autocfg.speaker_pins[0] = 0x14;
9304 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9306 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9308 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9309 HDA_AMP_MUTE, bits);
9312 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9314 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9316 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9317 HDA_AMP_MUTE, bits);
9318 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9319 HDA_AMP_MUTE, bits);
9322 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9325 if ((res >> 26) == ALC880_HP_EVENT)
9326 alc883_lenovo_101e_all_automute(codec);
9327 if ((res >> 26) == ALC880_FRONT_EVENT)
9328 alc883_lenovo_101e_ispeaker_automute(codec);
9331 /* toggle speaker-output according to the hp-jack state */
9332 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9334 struct alc_spec *spec = codec->spec;
9336 spec->autocfg.hp_pins[0] = 0x14;
9337 spec->autocfg.speaker_pins[0] = 0x15;
9338 spec->autocfg.speaker_pins[1] = 0x16;
9341 static struct hda_verb alc883_acer_eapd_verbs[] = {
9342 /* HP Pin: output 0 (0x0c) */
9343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9344 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9345 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9346 /* Front Pin: output 0 (0x0c) */
9347 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9348 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9349 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9350 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9351 /* eanable EAPD on medion laptop */
9352 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9353 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9354 /* enable unsolicited event */
9355 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9359 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9360 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9361 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9362 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9366 static void alc888_6st_dell_setup(struct hda_codec *codec)
9368 struct alc_spec *spec = codec->spec;
9370 spec->autocfg.hp_pins[0] = 0x1b;
9371 spec->autocfg.speaker_pins[0] = 0x14;
9372 spec->autocfg.speaker_pins[1] = 0x15;
9373 spec->autocfg.speaker_pins[2] = 0x16;
9374 spec->autocfg.speaker_pins[3] = 0x17;
9377 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9379 struct alc_spec *spec = codec->spec;
9381 spec->autocfg.hp_pins[0] = 0x1b;
9382 spec->autocfg.speaker_pins[0] = 0x14;
9383 spec->autocfg.speaker_pins[1] = 0x15;
9384 spec->autocfg.speaker_pins[2] = 0x16;
9385 spec->autocfg.speaker_pins[3] = 0x17;
9386 spec->autocfg.speaker_pins[4] = 0x1a;
9389 static void alc883_vaiott_setup(struct hda_codec *codec)
9391 struct alc_spec *spec = codec->spec;
9393 spec->autocfg.hp_pins[0] = 0x15;
9394 spec->autocfg.speaker_pins[0] = 0x14;
9395 spec->autocfg.speaker_pins[1] = 0x17;
9398 static struct hda_verb alc888_asus_m90v_verbs[] = {
9399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9402 /* enable unsolicited event */
9403 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9404 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9408 static void alc883_mode2_setup(struct hda_codec *codec)
9410 struct alc_spec *spec = codec->spec;
9412 spec->autocfg.hp_pins[0] = 0x1b;
9413 spec->autocfg.speaker_pins[0] = 0x14;
9414 spec->autocfg.speaker_pins[1] = 0x15;
9415 spec->autocfg.speaker_pins[2] = 0x16;
9416 spec->ext_mic.pin = 0x18;
9417 spec->int_mic.pin = 0x19;
9418 spec->ext_mic.mux_idx = 0;
9419 spec->int_mic.mux_idx = 1;
9423 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9426 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9427 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9428 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9429 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9430 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9431 /* enable unsolicited event */
9432 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9436 static void alc883_eee1601_inithook(struct hda_codec *codec)
9438 struct alc_spec *spec = codec->spec;
9440 spec->autocfg.hp_pins[0] = 0x14;
9441 spec->autocfg.speaker_pins[0] = 0x1b;
9442 alc_automute_pin(codec);
9445 static struct hda_verb alc889A_mb31_verbs[] = {
9446 /* Init rear pin (used as headphone output) */
9447 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9448 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9449 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9450 /* Init line pin (used as output in 4ch and 6ch mode) */
9451 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9452 /* Init line 2 pin (used as headphone out by default) */
9453 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9454 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9458 /* Mute speakers according to the headphone jack state */
9459 static void alc889A_mb31_automute(struct hda_codec *codec)
9461 unsigned int present;
9463 /* Mute only in 2ch or 4ch mode */
9464 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9466 present = snd_hda_jack_detect(codec, 0x15);
9467 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9468 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9469 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9470 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9474 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9476 if ((res >> 26) == ALC880_HP_EVENT)
9477 alc889A_mb31_automute(codec);
9481 #ifdef CONFIG_SND_HDA_POWER_SAVE
9482 #define alc882_loopbacks alc880_loopbacks
9485 /* pcm configuration: identical with ALC880 */
9486 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9487 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9488 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9489 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9491 static hda_nid_t alc883_slave_dig_outs[] = {
9492 ALC1200_DIGOUT_NID, 0,
9495 static hda_nid_t alc1200_slave_dig_outs[] = {
9496 ALC883_DIGOUT_NID, 0,
9500 * configuration and preset
9502 static const char *alc882_models[ALC882_MODEL_LAST] = {
9503 [ALC882_3ST_DIG] = "3stack-dig",
9504 [ALC882_6ST_DIG] = "6stack-dig",
9505 [ALC882_ARIMA] = "arima",
9506 [ALC882_W2JC] = "w2jc",
9507 [ALC882_TARGA] = "targa",
9508 [ALC882_ASUS_A7J] = "asus-a7j",
9509 [ALC882_ASUS_A7M] = "asus-a7m",
9510 [ALC885_MACPRO] = "macpro",
9511 [ALC885_MB5] = "mb5",
9512 [ALC885_MACMINI3] = "macmini3",
9513 [ALC885_MBA21] = "mba21",
9514 [ALC885_MBP3] = "mbp3",
9515 [ALC885_IMAC24] = "imac24",
9516 [ALC885_IMAC91] = "imac91",
9517 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9518 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9519 [ALC883_3ST_6ch] = "3stack-6ch",
9520 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9521 [ALC883_TARGA_DIG] = "targa-dig",
9522 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9523 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9524 [ALC883_ACER] = "acer",
9525 [ALC883_ACER_ASPIRE] = "acer-aspire",
9526 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9527 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9528 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9529 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9530 [ALC883_MEDION] = "medion",
9531 [ALC883_MEDION_MD2] = "medion-md2",
9532 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9533 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9534 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9535 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9536 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9537 [ALC888_LENOVO_SKY] = "lenovo-sky",
9538 [ALC883_HAIER_W66] = "haier-w66",
9539 [ALC888_3ST_HP] = "3stack-hp",
9540 [ALC888_6ST_DELL] = "6stack-dell",
9541 [ALC883_MITAC] = "mitac",
9542 [ALC883_CLEVO_M540R] = "clevo-m540r",
9543 [ALC883_CLEVO_M720] = "clevo-m720",
9544 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9545 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9546 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9547 [ALC889A_INTEL] = "intel-alc889a",
9548 [ALC889_INTEL] = "intel-x58",
9549 [ALC1200_ASUS_P5Q] = "asus-p5q",
9550 [ALC889A_MB31] = "mb31",
9551 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9552 [ALC882_AUTO] = "auto",
9555 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9556 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9558 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9559 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9560 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9561 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9562 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9563 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9564 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9565 ALC888_ACER_ASPIRE_4930G),
9566 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9567 ALC888_ACER_ASPIRE_4930G),
9568 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9569 ALC888_ACER_ASPIRE_8930G),
9570 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9571 ALC888_ACER_ASPIRE_8930G),
9572 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9573 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9574 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9575 ALC888_ACER_ASPIRE_6530G),
9576 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9577 ALC888_ACER_ASPIRE_6530G),
9578 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9579 ALC888_ACER_ASPIRE_7730G),
9580 /* default Acer -- disabled as it causes more problems.
9581 * model=auto should work fine now
9583 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9585 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9587 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9588 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9589 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9590 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9591 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9592 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9594 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9595 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9596 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9597 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9598 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9599 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9600 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9601 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9602 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9603 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9604 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9606 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9607 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9608 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9609 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9610 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9611 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9612 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9613 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9614 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9616 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9617 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9618 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9619 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9620 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9621 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9622 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9623 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9624 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9625 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9626 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9627 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9628 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9629 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9630 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9631 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9632 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9633 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9634 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9635 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9636 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9637 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9638 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9639 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9640 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9641 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9642 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9643 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9644 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9645 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9646 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9648 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9649 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9650 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9651 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9652 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9653 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9654 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9655 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9656 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9657 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9658 ALC883_FUJITSU_PI2515),
9659 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9660 ALC888_FUJITSU_XA3530),
9661 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9662 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9663 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9664 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9665 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9666 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9667 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9668 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9669 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9671 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9672 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9673 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9674 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9675 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9676 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9677 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9682 /* codec SSID table for Intel Mac */
9683 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9684 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9685 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9686 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9687 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9688 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9689 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9690 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9691 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9692 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9693 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9694 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9695 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9696 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9697 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9698 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9699 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9700 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9701 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9702 * so apparently no perfect solution yet
9704 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9705 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9706 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9710 static struct alc_config_preset alc882_presets[] = {
9711 [ALC882_3ST_DIG] = {
9712 .mixers = { alc882_base_mixer },
9713 .init_verbs = { alc882_base_init_verbs,
9714 alc882_adc1_init_verbs },
9715 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9716 .dac_nids = alc882_dac_nids,
9717 .dig_out_nid = ALC882_DIGOUT_NID,
9718 .dig_in_nid = ALC882_DIGIN_NID,
9719 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9720 .channel_mode = alc882_ch_modes,
9722 .input_mux = &alc882_capture_source,
9724 [ALC882_6ST_DIG] = {
9725 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9726 .init_verbs = { alc882_base_init_verbs,
9727 alc882_adc1_init_verbs },
9728 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9729 .dac_nids = alc882_dac_nids,
9730 .dig_out_nid = ALC882_DIGOUT_NID,
9731 .dig_in_nid = ALC882_DIGIN_NID,
9732 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9733 .channel_mode = alc882_sixstack_modes,
9734 .input_mux = &alc882_capture_source,
9737 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9738 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9739 alc882_eapd_verbs },
9740 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9741 .dac_nids = alc882_dac_nids,
9742 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9743 .channel_mode = alc882_sixstack_modes,
9744 .input_mux = &alc882_capture_source,
9747 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9748 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9749 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9750 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9751 .dac_nids = alc882_dac_nids,
9752 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9753 .channel_mode = alc880_threestack_modes,
9755 .input_mux = &alc882_capture_source,
9756 .dig_out_nid = ALC882_DIGOUT_NID,
9759 .mixers = { alc885_mba21_mixer },
9760 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9762 .dac_nids = alc882_dac_nids,
9763 .channel_mode = alc885_mba21_ch_modes,
9764 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9765 .input_mux = &alc882_capture_source,
9766 .unsol_event = alc_automute_amp_unsol_event,
9767 .setup = alc885_mba21_setup,
9768 .init_hook = alc_automute_amp,
9771 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9772 .init_verbs = { alc885_mbp3_init_verbs,
9773 alc880_gpio1_init_verbs },
9775 .dac_nids = alc882_dac_nids,
9777 .channel_mode = alc885_mbp_4ch_modes,
9778 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9779 .input_mux = &alc882_capture_source,
9780 .dig_out_nid = ALC882_DIGOUT_NID,
9781 .dig_in_nid = ALC882_DIGIN_NID,
9782 .unsol_event = alc_automute_amp_unsol_event,
9783 .setup = alc885_mbp3_setup,
9784 .init_hook = alc_automute_amp,
9787 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9788 .init_verbs = { alc885_mb5_init_verbs,
9789 alc880_gpio1_init_verbs },
9790 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9791 .dac_nids = alc882_dac_nids,
9792 .channel_mode = alc885_mb5_6ch_modes,
9793 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9794 .input_mux = &mb5_capture_source,
9795 .dig_out_nid = ALC882_DIGOUT_NID,
9796 .dig_in_nid = ALC882_DIGIN_NID,
9797 .unsol_event = alc_automute_amp_unsol_event,
9798 .setup = alc885_mb5_setup,
9799 .init_hook = alc_automute_amp,
9801 [ALC885_MACMINI3] = {
9802 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9803 .init_verbs = { alc885_macmini3_init_verbs,
9804 alc880_gpio1_init_verbs },
9805 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9806 .dac_nids = alc882_dac_nids,
9807 .channel_mode = alc885_macmini3_6ch_modes,
9808 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9809 .input_mux = &macmini3_capture_source,
9810 .dig_out_nid = ALC882_DIGOUT_NID,
9811 .dig_in_nid = ALC882_DIGIN_NID,
9812 .unsol_event = alc_automute_amp_unsol_event,
9813 .setup = alc885_macmini3_setup,
9814 .init_hook = alc_automute_amp,
9817 .mixers = { alc882_macpro_mixer },
9818 .init_verbs = { alc882_macpro_init_verbs },
9819 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9820 .dac_nids = alc882_dac_nids,
9821 .dig_out_nid = ALC882_DIGOUT_NID,
9822 .dig_in_nid = ALC882_DIGIN_NID,
9823 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9824 .channel_mode = alc882_ch_modes,
9825 .input_mux = &alc882_capture_source,
9826 .init_hook = alc885_macpro_init_hook,
9829 .mixers = { alc885_imac24_mixer },
9830 .init_verbs = { alc885_imac24_init_verbs },
9831 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9832 .dac_nids = alc882_dac_nids,
9833 .dig_out_nid = ALC882_DIGOUT_NID,
9834 .dig_in_nid = ALC882_DIGIN_NID,
9835 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9836 .channel_mode = alc882_ch_modes,
9837 .input_mux = &alc882_capture_source,
9838 .unsol_event = alc_automute_amp_unsol_event,
9839 .setup = alc885_imac24_setup,
9840 .init_hook = alc885_imac24_init_hook,
9843 .mixers = {alc885_imac91_mixer},
9844 .init_verbs = { alc885_imac91_init_verbs,
9845 alc880_gpio1_init_verbs },
9846 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9847 .dac_nids = alc882_dac_nids,
9848 .channel_mode = alc885_mba21_ch_modes,
9849 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9850 .input_mux = &alc889A_imac91_capture_source,
9851 .dig_out_nid = ALC882_DIGOUT_NID,
9852 .dig_in_nid = ALC882_DIGIN_NID,
9853 .unsol_event = alc_automute_amp_unsol_event,
9854 .setup = alc885_imac91_setup,
9855 .init_hook = alc_automute_amp,
9858 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9859 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9860 alc880_gpio3_init_verbs, alc882_targa_verbs},
9861 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9862 .dac_nids = alc882_dac_nids,
9863 .dig_out_nid = ALC882_DIGOUT_NID,
9864 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9865 .adc_nids = alc882_adc_nids,
9866 .capsrc_nids = alc882_capsrc_nids,
9867 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9868 .channel_mode = alc882_3ST_6ch_modes,
9870 .input_mux = &alc882_capture_source,
9871 .unsol_event = alc882_targa_unsol_event,
9872 .setup = alc882_targa_setup,
9873 .init_hook = alc882_targa_automute,
9875 [ALC882_ASUS_A7J] = {
9876 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9877 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9878 alc882_asus_a7j_verbs},
9879 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9880 .dac_nids = alc882_dac_nids,
9881 .dig_out_nid = ALC882_DIGOUT_NID,
9882 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9883 .adc_nids = alc882_adc_nids,
9884 .capsrc_nids = alc882_capsrc_nids,
9885 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9886 .channel_mode = alc882_3ST_6ch_modes,
9888 .input_mux = &alc882_capture_source,
9890 [ALC882_ASUS_A7M] = {
9891 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9892 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9893 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9894 alc882_asus_a7m_verbs },
9895 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9896 .dac_nids = alc882_dac_nids,
9897 .dig_out_nid = ALC882_DIGOUT_NID,
9898 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9899 .channel_mode = alc880_threestack_modes,
9901 .input_mux = &alc882_capture_source,
9903 [ALC883_3ST_2ch_DIG] = {
9904 .mixers = { alc883_3ST_2ch_mixer },
9905 .init_verbs = { alc883_init_verbs },
9906 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9907 .dac_nids = alc883_dac_nids,
9908 .dig_out_nid = ALC883_DIGOUT_NID,
9909 .dig_in_nid = ALC883_DIGIN_NID,
9910 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9911 .channel_mode = alc883_3ST_2ch_modes,
9912 .input_mux = &alc883_capture_source,
9914 [ALC883_3ST_6ch_DIG] = {
9915 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9916 .init_verbs = { alc883_init_verbs },
9917 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9918 .dac_nids = alc883_dac_nids,
9919 .dig_out_nid = ALC883_DIGOUT_NID,
9920 .dig_in_nid = ALC883_DIGIN_NID,
9921 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9922 .channel_mode = alc883_3ST_6ch_modes,
9924 .input_mux = &alc883_capture_source,
9926 [ALC883_3ST_6ch] = {
9927 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9928 .init_verbs = { alc883_init_verbs },
9929 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9930 .dac_nids = alc883_dac_nids,
9931 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9932 .channel_mode = alc883_3ST_6ch_modes,
9934 .input_mux = &alc883_capture_source,
9936 [ALC883_3ST_6ch_INTEL] = {
9937 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9938 .init_verbs = { alc883_init_verbs },
9939 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9940 .dac_nids = alc883_dac_nids,
9941 .dig_out_nid = ALC883_DIGOUT_NID,
9942 .dig_in_nid = ALC883_DIGIN_NID,
9943 .slave_dig_outs = alc883_slave_dig_outs,
9944 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9945 .channel_mode = alc883_3ST_6ch_intel_modes,
9947 .input_mux = &alc883_3stack_6ch_intel,
9950 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9951 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9952 alc_hp15_unsol_verbs },
9953 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9954 .dac_nids = alc883_dac_nids,
9955 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9956 .adc_nids = alc889_adc_nids,
9957 .dig_out_nid = ALC883_DIGOUT_NID,
9958 .dig_in_nid = ALC883_DIGIN_NID,
9959 .slave_dig_outs = alc883_slave_dig_outs,
9960 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9961 .channel_mode = alc889_8ch_intel_modes,
9962 .capsrc_nids = alc889_capsrc_nids,
9963 .input_mux = &alc889_capture_source,
9964 .setup = alc889_automute_setup,
9965 .init_hook = alc_automute_amp,
9966 .unsol_event = alc_automute_amp_unsol_event,
9970 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9971 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9972 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9973 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9974 .dac_nids = alc883_dac_nids,
9975 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9976 .adc_nids = alc889_adc_nids,
9977 .dig_out_nid = ALC883_DIGOUT_NID,
9978 .dig_in_nid = ALC883_DIGIN_NID,
9979 .slave_dig_outs = alc883_slave_dig_outs,
9980 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9981 .channel_mode = alc889_8ch_intel_modes,
9982 .capsrc_nids = alc889_capsrc_nids,
9983 .input_mux = &alc889_capture_source,
9984 .setup = alc889_automute_setup,
9985 .init_hook = alc889_intel_init_hook,
9986 .unsol_event = alc_automute_amp_unsol_event,
9989 [ALC883_6ST_DIG] = {
9990 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9991 .init_verbs = { alc883_init_verbs },
9992 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9993 .dac_nids = alc883_dac_nids,
9994 .dig_out_nid = ALC883_DIGOUT_NID,
9995 .dig_in_nid = ALC883_DIGIN_NID,
9996 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9997 .channel_mode = alc883_sixstack_modes,
9998 .input_mux = &alc883_capture_source,
10000 [ALC883_TARGA_DIG] = {
10001 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10002 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10003 alc883_targa_verbs},
10004 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10005 .dac_nids = alc883_dac_nids,
10006 .dig_out_nid = ALC883_DIGOUT_NID,
10007 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10008 .channel_mode = alc883_3ST_6ch_modes,
10010 .input_mux = &alc883_capture_source,
10011 .unsol_event = alc883_targa_unsol_event,
10012 .setup = alc882_targa_setup,
10013 .init_hook = alc882_targa_automute,
10015 [ALC883_TARGA_2ch_DIG] = {
10016 .mixers = { alc883_targa_2ch_mixer},
10017 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10018 alc883_targa_verbs},
10019 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10020 .dac_nids = alc883_dac_nids,
10021 .adc_nids = alc883_adc_nids_alt,
10022 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10023 .capsrc_nids = alc883_capsrc_nids,
10024 .dig_out_nid = ALC883_DIGOUT_NID,
10025 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10026 .channel_mode = alc883_3ST_2ch_modes,
10027 .input_mux = &alc883_capture_source,
10028 .unsol_event = alc883_targa_unsol_event,
10029 .setup = alc882_targa_setup,
10030 .init_hook = alc882_targa_automute,
10032 [ALC883_TARGA_8ch_DIG] = {
10033 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10034 alc883_chmode_mixer },
10035 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10036 alc883_targa_verbs },
10037 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10038 .dac_nids = alc883_dac_nids,
10039 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10040 .adc_nids = alc883_adc_nids_rev,
10041 .capsrc_nids = alc883_capsrc_nids_rev,
10042 .dig_out_nid = ALC883_DIGOUT_NID,
10043 .dig_in_nid = ALC883_DIGIN_NID,
10044 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10045 .channel_mode = alc883_4ST_8ch_modes,
10047 .input_mux = &alc883_capture_source,
10048 .unsol_event = alc883_targa_unsol_event,
10049 .setup = alc882_targa_setup,
10050 .init_hook = alc882_targa_automute,
10053 .mixers = { alc883_base_mixer },
10054 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10055 * and the headphone jack. Turn this on and rely on the
10056 * standard mute methods whenever the user wants to turn
10057 * these outputs off.
10059 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10060 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10061 .dac_nids = alc883_dac_nids,
10062 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10063 .channel_mode = alc883_3ST_2ch_modes,
10064 .input_mux = &alc883_capture_source,
10066 [ALC883_ACER_ASPIRE] = {
10067 .mixers = { alc883_acer_aspire_mixer },
10068 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10069 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10070 .dac_nids = alc883_dac_nids,
10071 .dig_out_nid = ALC883_DIGOUT_NID,
10072 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10073 .channel_mode = alc883_3ST_2ch_modes,
10074 .input_mux = &alc883_capture_source,
10075 .unsol_event = alc_automute_amp_unsol_event,
10076 .setup = alc883_acer_aspire_setup,
10077 .init_hook = alc_automute_amp,
10079 [ALC888_ACER_ASPIRE_4930G] = {
10080 .mixers = { alc888_base_mixer,
10081 alc883_chmode_mixer },
10082 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10083 alc888_acer_aspire_4930g_verbs },
10084 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10085 .dac_nids = alc883_dac_nids,
10086 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10087 .adc_nids = alc883_adc_nids_rev,
10088 .capsrc_nids = alc883_capsrc_nids_rev,
10089 .dig_out_nid = ALC883_DIGOUT_NID,
10090 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10091 .channel_mode = alc883_3ST_6ch_modes,
10093 .const_channel_count = 6,
10095 ARRAY_SIZE(alc888_2_capture_sources),
10096 .input_mux = alc888_2_capture_sources,
10097 .unsol_event = alc_automute_amp_unsol_event,
10098 .setup = alc888_acer_aspire_4930g_setup,
10099 .init_hook = alc_automute_amp,
10101 [ALC888_ACER_ASPIRE_6530G] = {
10102 .mixers = { alc888_acer_aspire_6530_mixer },
10103 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10104 alc888_acer_aspire_6530g_verbs },
10105 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10106 .dac_nids = alc883_dac_nids,
10107 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10108 .adc_nids = alc883_adc_nids_rev,
10109 .capsrc_nids = alc883_capsrc_nids_rev,
10110 .dig_out_nid = ALC883_DIGOUT_NID,
10111 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10112 .channel_mode = alc883_3ST_2ch_modes,
10114 ARRAY_SIZE(alc888_2_capture_sources),
10115 .input_mux = alc888_acer_aspire_6530_sources,
10116 .unsol_event = alc_automute_amp_unsol_event,
10117 .setup = alc888_acer_aspire_6530g_setup,
10118 .init_hook = alc_automute_amp,
10120 [ALC888_ACER_ASPIRE_8930G] = {
10121 .mixers = { alc889_acer_aspire_8930g_mixer,
10122 alc883_chmode_mixer },
10123 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10124 alc889_acer_aspire_8930g_verbs,
10125 alc889_eapd_verbs},
10126 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10127 .dac_nids = alc883_dac_nids,
10128 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10129 .adc_nids = alc889_adc_nids,
10130 .capsrc_nids = alc889_capsrc_nids,
10131 .dig_out_nid = ALC883_DIGOUT_NID,
10132 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10133 .channel_mode = alc883_3ST_6ch_modes,
10135 .const_channel_count = 6,
10137 ARRAY_SIZE(alc889_capture_sources),
10138 .input_mux = alc889_capture_sources,
10139 .unsol_event = alc_automute_amp_unsol_event,
10140 .setup = alc889_acer_aspire_8930g_setup,
10141 .init_hook = alc_automute_amp,
10142 #ifdef CONFIG_SND_HDA_POWER_SAVE
10143 .power_hook = alc_power_eapd,
10146 [ALC888_ACER_ASPIRE_7730G] = {
10147 .mixers = { alc883_3ST_6ch_mixer,
10148 alc883_chmode_mixer },
10149 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10150 alc888_acer_aspire_7730G_verbs },
10151 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10152 .dac_nids = alc883_dac_nids,
10153 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10154 .adc_nids = alc883_adc_nids_rev,
10155 .capsrc_nids = alc883_capsrc_nids_rev,
10156 .dig_out_nid = ALC883_DIGOUT_NID,
10157 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10158 .channel_mode = alc883_3ST_6ch_modes,
10160 .const_channel_count = 6,
10161 .input_mux = &alc883_capture_source,
10162 .unsol_event = alc_automute_amp_unsol_event,
10163 .setup = alc888_acer_aspire_6530g_setup,
10164 .init_hook = alc_automute_amp,
10166 [ALC883_MEDION] = {
10167 .mixers = { alc883_fivestack_mixer,
10168 alc883_chmode_mixer },
10169 .init_verbs = { alc883_init_verbs,
10170 alc883_medion_eapd_verbs },
10171 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10172 .dac_nids = alc883_dac_nids,
10173 .adc_nids = alc883_adc_nids_alt,
10174 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10175 .capsrc_nids = alc883_capsrc_nids,
10176 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10177 .channel_mode = alc883_sixstack_modes,
10178 .input_mux = &alc883_capture_source,
10180 [ALC883_MEDION_MD2] = {
10181 .mixers = { alc883_medion_md2_mixer},
10182 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10183 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10184 .dac_nids = alc883_dac_nids,
10185 .dig_out_nid = ALC883_DIGOUT_NID,
10186 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10187 .channel_mode = alc883_3ST_2ch_modes,
10188 .input_mux = &alc883_capture_source,
10189 .unsol_event = alc_automute_amp_unsol_event,
10190 .setup = alc883_medion_md2_setup,
10191 .init_hook = alc_automute_amp,
10193 [ALC883_MEDION_WIM2160] = {
10194 .mixers = { alc883_medion_wim2160_mixer },
10195 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10196 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10197 .dac_nids = alc883_dac_nids,
10198 .dig_out_nid = ALC883_DIGOUT_NID,
10199 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10200 .adc_nids = alc883_adc_nids,
10201 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10202 .channel_mode = alc883_3ST_2ch_modes,
10203 .input_mux = &alc883_capture_source,
10204 .unsol_event = alc_automute_amp_unsol_event,
10205 .setup = alc883_medion_wim2160_setup,
10206 .init_hook = alc_automute_amp,
10208 [ALC883_LAPTOP_EAPD] = {
10209 .mixers = { alc883_base_mixer },
10210 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10211 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10212 .dac_nids = alc883_dac_nids,
10213 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10214 .channel_mode = alc883_3ST_2ch_modes,
10215 .input_mux = &alc883_capture_source,
10217 [ALC883_CLEVO_M540R] = {
10218 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10219 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10220 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10221 .dac_nids = alc883_dac_nids,
10222 .dig_out_nid = ALC883_DIGOUT_NID,
10223 .dig_in_nid = ALC883_DIGIN_NID,
10224 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10225 .channel_mode = alc883_3ST_6ch_clevo_modes,
10227 .input_mux = &alc883_capture_source,
10228 /* This machine has the hardware HP auto-muting, thus
10229 * we need no software mute via unsol event
10232 [ALC883_CLEVO_M720] = {
10233 .mixers = { alc883_clevo_m720_mixer },
10234 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10235 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10236 .dac_nids = alc883_dac_nids,
10237 .dig_out_nid = ALC883_DIGOUT_NID,
10238 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10239 .channel_mode = alc883_3ST_2ch_modes,
10240 .input_mux = &alc883_capture_source,
10241 .unsol_event = alc883_clevo_m720_unsol_event,
10242 .setup = alc883_clevo_m720_setup,
10243 .init_hook = alc883_clevo_m720_init_hook,
10245 [ALC883_LENOVO_101E_2ch] = {
10246 .mixers = { alc883_lenovo_101e_2ch_mixer},
10247 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10248 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10249 .dac_nids = alc883_dac_nids,
10250 .adc_nids = alc883_adc_nids_alt,
10251 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10252 .capsrc_nids = alc883_capsrc_nids,
10253 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10254 .channel_mode = alc883_3ST_2ch_modes,
10255 .input_mux = &alc883_lenovo_101e_capture_source,
10256 .unsol_event = alc883_lenovo_101e_unsol_event,
10257 .init_hook = alc883_lenovo_101e_all_automute,
10259 [ALC883_LENOVO_NB0763] = {
10260 .mixers = { alc883_lenovo_nb0763_mixer },
10261 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10262 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10263 .dac_nids = alc883_dac_nids,
10264 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10265 .channel_mode = alc883_3ST_2ch_modes,
10267 .input_mux = &alc883_lenovo_nb0763_capture_source,
10268 .unsol_event = alc_automute_amp_unsol_event,
10269 .setup = alc883_medion_md2_setup,
10270 .init_hook = alc_automute_amp,
10272 [ALC888_LENOVO_MS7195_DIG] = {
10273 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10274 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10275 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10276 .dac_nids = alc883_dac_nids,
10277 .dig_out_nid = ALC883_DIGOUT_NID,
10278 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10279 .channel_mode = alc883_3ST_6ch_modes,
10281 .input_mux = &alc883_capture_source,
10282 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10283 .init_hook = alc888_lenovo_ms7195_front_automute,
10285 [ALC883_HAIER_W66] = {
10286 .mixers = { alc883_targa_2ch_mixer},
10287 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10288 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10289 .dac_nids = alc883_dac_nids,
10290 .dig_out_nid = ALC883_DIGOUT_NID,
10291 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10292 .channel_mode = alc883_3ST_2ch_modes,
10293 .input_mux = &alc883_capture_source,
10294 .unsol_event = alc_automute_amp_unsol_event,
10295 .setup = alc883_haier_w66_setup,
10296 .init_hook = alc_automute_amp,
10298 [ALC888_3ST_HP] = {
10299 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10300 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10301 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10302 .dac_nids = alc883_dac_nids,
10303 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10304 .channel_mode = alc888_3st_hp_modes,
10306 .input_mux = &alc883_capture_source,
10307 .unsol_event = alc_automute_amp_unsol_event,
10308 .setup = alc888_3st_hp_setup,
10309 .init_hook = alc_automute_amp,
10311 [ALC888_6ST_DELL] = {
10312 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10313 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10314 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10315 .dac_nids = alc883_dac_nids,
10316 .dig_out_nid = ALC883_DIGOUT_NID,
10317 .dig_in_nid = ALC883_DIGIN_NID,
10318 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10319 .channel_mode = alc883_sixstack_modes,
10320 .input_mux = &alc883_capture_source,
10321 .unsol_event = alc_automute_amp_unsol_event,
10322 .setup = alc888_6st_dell_setup,
10323 .init_hook = alc_automute_amp,
10326 .mixers = { alc883_mitac_mixer },
10327 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10329 .dac_nids = alc883_dac_nids,
10330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10331 .channel_mode = alc883_3ST_2ch_modes,
10332 .input_mux = &alc883_capture_source,
10333 .unsol_event = alc_automute_amp_unsol_event,
10334 .setup = alc883_mitac_setup,
10335 .init_hook = alc_automute_amp,
10337 [ALC883_FUJITSU_PI2515] = {
10338 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10339 .init_verbs = { alc883_init_verbs,
10340 alc883_2ch_fujitsu_pi2515_verbs},
10341 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10342 .dac_nids = alc883_dac_nids,
10343 .dig_out_nid = ALC883_DIGOUT_NID,
10344 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10345 .channel_mode = alc883_3ST_2ch_modes,
10346 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10347 .unsol_event = alc_automute_amp_unsol_event,
10348 .setup = alc883_2ch_fujitsu_pi2515_setup,
10349 .init_hook = alc_automute_amp,
10351 [ALC888_FUJITSU_XA3530] = {
10352 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10353 .init_verbs = { alc883_init_verbs,
10354 alc888_fujitsu_xa3530_verbs },
10355 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10356 .dac_nids = alc883_dac_nids,
10357 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10358 .adc_nids = alc883_adc_nids_rev,
10359 .capsrc_nids = alc883_capsrc_nids_rev,
10360 .dig_out_nid = ALC883_DIGOUT_NID,
10361 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10362 .channel_mode = alc888_4ST_8ch_intel_modes,
10364 ARRAY_SIZE(alc888_2_capture_sources),
10365 .input_mux = alc888_2_capture_sources,
10366 .unsol_event = alc_automute_amp_unsol_event,
10367 .setup = alc888_fujitsu_xa3530_setup,
10368 .init_hook = alc_automute_amp,
10370 [ALC888_LENOVO_SKY] = {
10371 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10372 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10373 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10374 .dac_nids = alc883_dac_nids,
10375 .dig_out_nid = ALC883_DIGOUT_NID,
10376 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10377 .channel_mode = alc883_sixstack_modes,
10379 .input_mux = &alc883_lenovo_sky_capture_source,
10380 .unsol_event = alc_automute_amp_unsol_event,
10381 .setup = alc888_lenovo_sky_setup,
10382 .init_hook = alc_automute_amp,
10384 [ALC888_ASUS_M90V] = {
10385 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10386 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10387 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10388 .dac_nids = alc883_dac_nids,
10389 .dig_out_nid = ALC883_DIGOUT_NID,
10390 .dig_in_nid = ALC883_DIGIN_NID,
10391 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10392 .channel_mode = alc883_3ST_6ch_modes,
10394 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10395 .unsol_event = alc_sku_unsol_event,
10396 .setup = alc883_mode2_setup,
10397 .init_hook = alc_inithook,
10399 [ALC888_ASUS_EEE1601] = {
10400 .mixers = { alc883_asus_eee1601_mixer },
10401 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10402 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10403 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10404 .dac_nids = alc883_dac_nids,
10405 .dig_out_nid = ALC883_DIGOUT_NID,
10406 .dig_in_nid = ALC883_DIGIN_NID,
10407 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10408 .channel_mode = alc883_3ST_2ch_modes,
10410 .input_mux = &alc883_asus_eee1601_capture_source,
10411 .unsol_event = alc_sku_unsol_event,
10412 .init_hook = alc883_eee1601_inithook,
10414 [ALC1200_ASUS_P5Q] = {
10415 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10416 .init_verbs = { alc883_init_verbs },
10417 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10418 .dac_nids = alc883_dac_nids,
10419 .dig_out_nid = ALC1200_DIGOUT_NID,
10420 .dig_in_nid = ALC883_DIGIN_NID,
10421 .slave_dig_outs = alc1200_slave_dig_outs,
10422 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10423 .channel_mode = alc883_sixstack_modes,
10424 .input_mux = &alc883_capture_source,
10427 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10428 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10429 alc880_gpio1_init_verbs },
10430 .adc_nids = alc883_adc_nids,
10431 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10432 .capsrc_nids = alc883_capsrc_nids,
10433 .dac_nids = alc883_dac_nids,
10434 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10435 .channel_mode = alc889A_mb31_6ch_modes,
10436 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10437 .input_mux = &alc889A_mb31_capture_source,
10438 .dig_out_nid = ALC883_DIGOUT_NID,
10439 .unsol_event = alc889A_mb31_unsol_event,
10440 .init_hook = alc889A_mb31_automute,
10442 [ALC883_SONY_VAIO_TT] = {
10443 .mixers = { alc883_vaiott_mixer },
10444 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10446 .dac_nids = alc883_dac_nids,
10447 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10448 .channel_mode = alc883_3ST_2ch_modes,
10449 .input_mux = &alc883_capture_source,
10450 .unsol_event = alc_automute_amp_unsol_event,
10451 .setup = alc883_vaiott_setup,
10452 .init_hook = alc_automute_amp,
10461 PINFIX_ABIT_AW9D_MAX,
10465 static const struct alc_fixup alc882_fixups[] = {
10466 [PINFIX_ABIT_AW9D_MAX] = {
10467 .pins = (const struct alc_pincfg[]) {
10468 { 0x15, 0x01080104 }, /* side */
10469 { 0x16, 0x01011012 }, /* rear */
10470 { 0x17, 0x01016011 }, /* clfe */
10474 [PINFIX_PB_M5210] = {
10475 .verbs = (const struct hda_verb[]) {
10476 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10482 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10483 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10484 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10489 * BIOS auto configuration
10491 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10492 const struct auto_pin_cfg *cfg)
10494 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10497 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10498 hda_nid_t nid, int pin_type,
10503 /* set as output */
10504 alc_set_pin_output(codec, nid, pin_type);
10508 else if (dac >= 0x02 && dac <= 0x05)
10512 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10515 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10517 struct alc_spec *spec = codec->spec;
10520 for (i = 0; i <= HDA_SIDE; i++) {
10521 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10522 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10524 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10525 spec->multiout.dac_nids[i]);
10529 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10531 struct alc_spec *spec = codec->spec;
10532 hda_nid_t pin, dac;
10534 pin = spec->autocfg.hp_pins[0];
10536 dac = spec->multiout.hp_nid;
10538 dac = spec->multiout.dac_nids[0]; /* to front */
10539 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10541 pin = spec->autocfg.speaker_pins[0];
10543 dac = spec->multiout.extra_out_nid[0];
10545 dac = spec->multiout.dac_nids[0]; /* to front */
10546 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10550 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10552 struct alc_spec *spec = codec->spec;
10553 struct auto_pin_cfg *cfg = &spec->autocfg;
10556 for (i = 0; i < cfg->num_inputs; i++) {
10557 hda_nid_t nid = cfg->inputs[i].pin;
10558 alc_set_input_pin(codec, nid, i);
10559 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10560 snd_hda_codec_write(codec, nid, 0,
10561 AC_VERB_SET_AMP_GAIN_MUTE,
10566 static void alc882_auto_init_input_src(struct hda_codec *codec)
10568 struct alc_spec *spec = codec->spec;
10571 for (c = 0; c < spec->num_adc_nids; c++) {
10572 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10573 hda_nid_t nid = spec->capsrc_nids[c];
10574 unsigned int mux_idx;
10575 const struct hda_input_mux *imux;
10576 int conns, mute, idx, item;
10578 conns = snd_hda_get_connections(codec, nid, conn_list,
10579 ARRAY_SIZE(conn_list));
10582 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10583 imux = &spec->input_mux[mux_idx];
10584 if (!imux->num_items && mux_idx > 0)
10585 imux = &spec->input_mux[0];
10586 for (idx = 0; idx < conns; idx++) {
10587 /* if the current connection is the selected one,
10588 * unmute it as default - otherwise mute it
10590 mute = AMP_IN_MUTE(idx);
10591 for (item = 0; item < imux->num_items; item++) {
10592 if (imux->items[item].index == idx) {
10593 if (spec->cur_mux[c] == item)
10594 mute = AMP_IN_UNMUTE(idx);
10598 /* check if we have a selector or mixer
10599 * we could check for the widget type instead, but
10600 * just check for Amp-In presence (in case of mixer
10601 * without amp-in there is something wrong, this
10602 * function shouldn't be used or capsrc nid is wrong)
10604 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10605 snd_hda_codec_write(codec, nid, 0,
10606 AC_VERB_SET_AMP_GAIN_MUTE,
10608 else if (mute != AMP_IN_MUTE(idx))
10609 snd_hda_codec_write(codec, nid, 0,
10610 AC_VERB_SET_CONNECT_SEL,
10616 /* add mic boosts if needed */
10617 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10619 struct alc_spec *spec = codec->spec;
10620 struct auto_pin_cfg *cfg = &spec->autocfg;
10624 for (i = 0; i < cfg->num_inputs; i++) {
10625 if (cfg->inputs[i].type > AUTO_PIN_FRONT_MIC)
10627 nid = cfg->inputs[i].pin;
10628 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10630 snprintf(label, sizeof(label), "%s Boost",
10631 snd_hda_get_input_pin_label(cfg, i));
10632 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10633 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10641 /* almost identical with ALC880 parser... */
10642 static int alc882_parse_auto_config(struct hda_codec *codec)
10644 struct alc_spec *spec = codec->spec;
10645 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10648 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10652 if (!spec->autocfg.line_outs)
10653 return 0; /* can't find valid BIOS pin config */
10655 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10658 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10661 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10665 err = alc880_auto_create_extra_out(spec,
10666 spec->autocfg.speaker_pins[0],
10670 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10674 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10676 alc_auto_parse_digital(codec);
10678 if (spec->kctls.list)
10679 add_mixer(spec, spec->kctls.list);
10681 add_verb(spec, alc883_auto_init_verbs);
10682 /* if ADC 0x07 is available, initialize it, too */
10683 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10684 add_verb(spec, alc882_adc1_init_verbs);
10686 spec->num_mux_defs = 1;
10687 spec->input_mux = &spec->private_imux[0];
10689 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10691 err = alc_auto_add_mic_boost(codec);
10695 return 1; /* config found */
10698 /* additional initialization for auto-configuration model */
10699 static void alc882_auto_init(struct hda_codec *codec)
10701 struct alc_spec *spec = codec->spec;
10702 alc882_auto_init_multi_out(codec);
10703 alc882_auto_init_hp_out(codec);
10704 alc882_auto_init_analog_input(codec);
10705 alc882_auto_init_input_src(codec);
10706 alc_auto_init_digital(codec);
10707 if (spec->unsol_event)
10708 alc_inithook(codec);
10711 static int patch_alc882(struct hda_codec *codec)
10713 struct alc_spec *spec;
10714 int err, board_config;
10716 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10720 codec->spec = spec;
10722 alc_auto_parse_customize_define(codec);
10724 switch (codec->vendor_id) {
10729 /* ALC883 and variants */
10730 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10734 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10738 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10739 board_config = snd_hda_check_board_codec_sid_config(codec,
10740 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10742 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10743 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10745 board_config = ALC882_AUTO;
10748 if (board_config == ALC882_AUTO)
10749 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10751 if (board_config == ALC882_AUTO) {
10752 /* automatic parse from the BIOS config */
10753 err = alc882_parse_auto_config(codec);
10759 "hda_codec: Cannot set up configuration "
10760 "from BIOS. Using base mode...\n");
10761 board_config = ALC882_3ST_DIG;
10765 if (has_cdefine_beep(codec)) {
10766 err = snd_hda_attach_beep_device(codec, 0x1);
10773 if (board_config != ALC882_AUTO)
10774 setup_preset(codec, &alc882_presets[board_config]);
10776 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10777 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10778 /* FIXME: setup DAC5 */
10779 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10780 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10782 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10783 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10785 if (!spec->adc_nids && spec->input_mux) {
10787 spec->num_adc_nids = 0;
10788 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10789 const struct hda_input_mux *imux = spec->input_mux;
10791 hda_nid_t items[16];
10792 hda_nid_t nid = alc882_adc_nids[i];
10793 unsigned int wcap = get_wcaps(codec, nid);
10795 wcap = get_wcaps_type(wcap);
10796 if (wcap != AC_WID_AUD_IN)
10798 spec->private_adc_nids[spec->num_adc_nids] = nid;
10799 err = snd_hda_get_connections(codec, nid, &cap, 1);
10802 err = snd_hda_get_connections(codec, cap, items,
10803 ARRAY_SIZE(items));
10806 for (j = 0; j < imux->num_items; j++)
10807 if (imux->items[j].index >= err)
10809 if (j < imux->num_items)
10811 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10812 spec->num_adc_nids++;
10814 spec->adc_nids = spec->private_adc_nids;
10815 spec->capsrc_nids = spec->private_capsrc_nids;
10818 set_capture_mixer(codec);
10820 if (has_cdefine_beep(codec))
10821 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10823 if (board_config == ALC882_AUTO)
10824 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10826 spec->vmaster_nid = 0x0c;
10828 codec->patch_ops = alc_patch_ops;
10829 if (board_config == ALC882_AUTO)
10830 spec->init_hook = alc882_auto_init;
10831 #ifdef CONFIG_SND_HDA_POWER_SAVE
10832 if (!spec->loopback.amplist)
10833 spec->loopback.amplist = alc882_loopbacks;
10844 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10845 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10847 #define alc262_dac_nids alc260_dac_nids
10848 #define alc262_adc_nids alc882_adc_nids
10849 #define alc262_adc_nids_alt alc882_adc_nids_alt
10850 #define alc262_capsrc_nids alc882_capsrc_nids
10851 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10853 #define alc262_modes alc260_modes
10854 #define alc262_capture_source alc882_capture_source
10856 static hda_nid_t alc262_dmic_adc_nids[1] = {
10861 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10863 static struct snd_kcontrol_new alc262_base_mixer[] = {
10864 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10865 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10866 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10867 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10868 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10869 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10872 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10873 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10874 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10875 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10876 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10878 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10879 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10883 /* update HP, line and mono-out pins according to the master switch */
10884 static void alc262_hp_master_update(struct hda_codec *codec)
10886 struct alc_spec *spec = codec->spec;
10887 int val = spec->master_sw;
10889 /* HP & line-out */
10890 snd_hda_codec_write_cache(codec, 0x1b, 0,
10891 AC_VERB_SET_PIN_WIDGET_CONTROL,
10893 snd_hda_codec_write_cache(codec, 0x15, 0,
10894 AC_VERB_SET_PIN_WIDGET_CONTROL,
10896 /* mono (speaker) depending on the HP jack sense */
10897 val = val && !spec->jack_present;
10898 snd_hda_codec_write_cache(codec, 0x16, 0,
10899 AC_VERB_SET_PIN_WIDGET_CONTROL,
10900 val ? PIN_OUT : 0);
10903 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10905 struct alc_spec *spec = codec->spec;
10907 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10908 alc262_hp_master_update(codec);
10911 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10913 if ((res >> 26) != ALC880_HP_EVENT)
10915 alc262_hp_bpc_automute(codec);
10918 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10920 struct alc_spec *spec = codec->spec;
10922 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10923 alc262_hp_master_update(codec);
10926 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10929 if ((res >> 26) != ALC880_HP_EVENT)
10931 alc262_hp_wildwest_automute(codec);
10934 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10936 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10937 struct snd_ctl_elem_value *ucontrol)
10939 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10940 struct alc_spec *spec = codec->spec;
10941 int val = !!*ucontrol->value.integer.value;
10943 if (val == spec->master_sw)
10945 spec->master_sw = val;
10946 alc262_hp_master_update(codec);
10950 #define ALC262_HP_MASTER_SWITCH \
10952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10953 .name = "Master Playback Switch", \
10954 .info = snd_ctl_boolean_mono_info, \
10955 .get = alc262_hp_master_sw_get, \
10956 .put = alc262_hp_master_sw_put, \
10959 .iface = NID_MAPPING, \
10960 .name = "Master Playback Switch", \
10961 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10965 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10966 ALC262_HP_MASTER_SWITCH,
10967 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10968 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10969 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10970 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10972 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10977 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10978 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10979 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10982 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10983 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10984 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10985 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10989 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10990 ALC262_HP_MASTER_SWITCH,
10991 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10992 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10995 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10997 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10999 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11000 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11001 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11002 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11003 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11004 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11005 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11009 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11010 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11011 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11012 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11016 /* mute/unmute internal speaker according to the hp jack and mute state */
11017 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11019 struct alc_spec *spec = codec->spec;
11021 spec->autocfg.hp_pins[0] = 0x15;
11022 spec->autocfg.speaker_pins[0] = 0x14;
11025 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11026 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11027 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11028 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11036 static struct hda_verb alc262_hp_t5735_verbs[] = {
11037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11040 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11044 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11045 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11047 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11048 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11054 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11055 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11059 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11060 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11068 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11075 /* bind hp and internal speaker mute (with plug check) as master switch */
11076 static void alc262_hippo_master_update(struct hda_codec *codec)
11078 struct alc_spec *spec = codec->spec;
11079 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11080 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11081 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11085 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11086 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11087 HDA_AMP_MUTE, mute);
11088 /* mute internal speaker per jack sense */
11089 if (spec->jack_present)
11090 mute = HDA_AMP_MUTE;
11092 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11093 HDA_AMP_MUTE, mute);
11094 if (speaker_nid && speaker_nid != line_nid)
11095 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11096 HDA_AMP_MUTE, mute);
11099 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11101 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11102 struct snd_ctl_elem_value *ucontrol)
11104 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11105 struct alc_spec *spec = codec->spec;
11106 int val = !!*ucontrol->value.integer.value;
11108 if (val == spec->master_sw)
11110 spec->master_sw = val;
11111 alc262_hippo_master_update(codec);
11115 #define ALC262_HIPPO_MASTER_SWITCH \
11117 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11118 .name = "Master Playback Switch", \
11119 .info = snd_ctl_boolean_mono_info, \
11120 .get = alc262_hippo_master_sw_get, \
11121 .put = alc262_hippo_master_sw_put, \
11124 .iface = NID_MAPPING, \
11125 .name = "Master Playback Switch", \
11126 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11127 (SUBDEV_SPEAKER(0) << 16), \
11130 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11131 ALC262_HIPPO_MASTER_SWITCH,
11132 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11133 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11134 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11136 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11139 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11140 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11141 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11142 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11143 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11147 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11148 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11149 ALC262_HIPPO_MASTER_SWITCH,
11150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11157 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11158 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11159 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11163 /* mute/unmute internal speaker according to the hp jack and mute state */
11164 static void alc262_hippo_automute(struct hda_codec *codec)
11166 struct alc_spec *spec = codec->spec;
11167 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11169 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11170 alc262_hippo_master_update(codec);
11173 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11175 if ((res >> 26) != ALC880_HP_EVENT)
11177 alc262_hippo_automute(codec);
11180 static void alc262_hippo_setup(struct hda_codec *codec)
11182 struct alc_spec *spec = codec->spec;
11184 spec->autocfg.hp_pins[0] = 0x15;
11185 spec->autocfg.speaker_pins[0] = 0x14;
11188 static void alc262_hippo1_setup(struct hda_codec *codec)
11190 struct alc_spec *spec = codec->spec;
11192 spec->autocfg.hp_pins[0] = 0x1b;
11193 spec->autocfg.speaker_pins[0] = 0x14;
11197 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11198 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11199 ALC262_HIPPO_MASTER_SWITCH,
11200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11202 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11203 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11207 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11208 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11209 ALC262_HIPPO_MASTER_SWITCH,
11210 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11213 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11214 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11218 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11219 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11220 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11221 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11222 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11223 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11224 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11227 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11228 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11229 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11230 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11234 static struct hda_verb alc262_tyan_verbs[] = {
11235 /* Headphone automute */
11236 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11237 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11238 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11240 /* P11 AUX_IN, white 4-pin connector */
11241 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11242 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11243 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11244 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11249 /* unsolicited event for HP jack sensing */
11250 static void alc262_tyan_setup(struct hda_codec *codec)
11252 struct alc_spec *spec = codec->spec;
11254 spec->autocfg.hp_pins[0] = 0x1b;
11255 spec->autocfg.speaker_pins[0] = 0x15;
11259 #define alc262_capture_mixer alc882_capture_mixer
11260 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11263 * generic initialization of ADC, input mixers and output mixers
11265 static struct hda_verb alc262_init_verbs[] = {
11267 * Unmute ADC0-2 and set the default input to mic-in
11269 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11271 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11273 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11276 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11278 * Note: PASD motherboards uses the Line In 2 as the input for
11279 * front panel mic (mic 2)
11281 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11289 * Set up output mixers (0x0c - 0x0e)
11291 /* set vol=0 to output mixers */
11292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11294 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11295 /* set up input amps for analog loopback */
11296 /* Amp Indices: DAC = 0, mixer = 1 */
11297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11298 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11299 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11300 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11302 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11304 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11306 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11308 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11311 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11312 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11313 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11314 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11317 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11320 /* FIXME: use matrix-type input source selection */
11321 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11322 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11341 static struct hda_verb alc262_eapd_verbs[] = {
11342 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11343 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11347 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11348 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11349 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11352 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11353 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11357 static struct hda_verb alc262_sony_unsol_verbs[] = {
11358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11359 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11360 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11362 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11367 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11369 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11376 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11377 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11380 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11381 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11382 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11383 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11384 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11388 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11390 struct alc_spec *spec = codec->spec;
11392 spec->autocfg.hp_pins[0] = 0x15;
11393 spec->autocfg.speaker_pins[0] = 0x14;
11394 spec->ext_mic.pin = 0x18;
11395 spec->ext_mic.mux_idx = 0;
11396 spec->int_mic.pin = 0x12;
11397 spec->int_mic.mux_idx = 9;
11398 spec->auto_mic = 1;
11404 * 0x16 = internal speaker
11405 * 0x18 = external mic
11408 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11409 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11410 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11416 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11417 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11421 static struct hda_verb alc262_nec_verbs[] = {
11422 /* Unmute Speaker */
11423 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11426 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11429 /* External mic to headphone */
11430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11431 /* External mic to speaker */
11432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11438 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11439 * 0x1b = port replicator headphone out
11442 #define ALC_HP_EVENT 0x37
11444 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11445 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11446 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11447 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11452 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11454 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11458 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11459 /* Front Mic pin: input vref at 50% */
11460 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11461 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11465 static struct hda_input_mux alc262_fujitsu_capture_source = {
11469 { "Int Mic", 0x1 },
11474 static struct hda_input_mux alc262_HP_capture_source = {
11478 { "Front Mic", 0x1 },
11485 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11489 { "Front Mic", 0x2 },
11495 /* mute/unmute internal speaker according to the hp jacks and mute state */
11496 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11498 struct alc_spec *spec = codec->spec;
11501 if (force || !spec->sense_updated) {
11502 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11503 snd_hda_jack_detect(codec, 0x1b);
11504 spec->sense_updated = 1;
11506 /* unmute internal speaker only if both HPs are unplugged and
11507 * master switch is on
11509 if (spec->jack_present)
11510 mute = HDA_AMP_MUTE;
11512 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11513 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11514 HDA_AMP_MUTE, mute);
11517 /* unsolicited event for HP jack sensing */
11518 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11521 if ((res >> 26) != ALC_HP_EVENT)
11523 alc262_fujitsu_automute(codec, 1);
11526 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11528 alc262_fujitsu_automute(codec, 1);
11531 /* bind volumes of both NID 0x0c and 0x0d */
11532 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11533 .ops = &snd_hda_bind_vol,
11535 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11536 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11541 /* mute/unmute internal speaker according to the hp jack and mute state */
11542 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11544 struct alc_spec *spec = codec->spec;
11547 if (force || !spec->sense_updated) {
11548 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11549 spec->sense_updated = 1;
11551 if (spec->jack_present) {
11552 /* mute internal speaker */
11553 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11554 HDA_AMP_MUTE, HDA_AMP_MUTE);
11555 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11556 HDA_AMP_MUTE, HDA_AMP_MUTE);
11558 /* unmute internal speaker if necessary */
11559 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11560 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11561 HDA_AMP_MUTE, mute);
11562 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11563 HDA_AMP_MUTE, mute);
11567 /* unsolicited event for HP jack sensing */
11568 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11571 if ((res >> 26) != ALC_HP_EVENT)
11573 alc262_lenovo_3000_automute(codec, 1);
11576 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11577 int dir, int idx, long *valp)
11581 for (i = 0; i < 2; i++, valp++)
11582 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11584 *valp ? 0 : HDA_AMP_MUTE);
11588 /* bind hp and internal speaker mute (with plug check) */
11589 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11590 struct snd_ctl_elem_value *ucontrol)
11592 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11593 long *valp = ucontrol->value.integer.value;
11596 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11597 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11599 alc262_fujitsu_automute(codec, 0);
11603 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11604 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11606 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11607 .name = "Master Playback Switch",
11608 .subdevice = HDA_SUBDEV_AMP_FLAG,
11609 .info = snd_hda_mixer_amp_switch_info,
11610 .get = snd_hda_mixer_amp_switch_get,
11611 .put = alc262_fujitsu_master_sw_put,
11612 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11615 .iface = NID_MAPPING,
11616 .name = "Master Playback Switch",
11617 .private_value = 0x1b,
11619 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11620 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11621 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11624 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11625 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11626 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11630 /* bind hp and internal speaker mute (with plug check) */
11631 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11632 struct snd_ctl_elem_value *ucontrol)
11634 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11635 long *valp = ucontrol->value.integer.value;
11638 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11640 alc262_lenovo_3000_automute(codec, 0);
11644 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11645 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11648 .name = "Master Playback Switch",
11649 .subdevice = HDA_SUBDEV_AMP_FLAG,
11650 .info = snd_hda_mixer_amp_switch_info,
11651 .get = snd_hda_mixer_amp_switch_get,
11652 .put = alc262_lenovo_3000_master_sw_put,
11653 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11655 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11656 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11657 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11658 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11659 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11660 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11661 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11662 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11666 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11667 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11668 ALC262_HIPPO_MASTER_SWITCH,
11669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11671 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11674 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11678 /* additional init verbs for Benq laptops */
11679 static struct hda_verb alc262_EAPD_verbs[] = {
11680 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11681 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11685 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11686 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11689 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11690 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11694 /* Samsung Q1 Ultra Vista model setup */
11695 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11696 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11697 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11698 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11699 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11700 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11701 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11705 static struct hda_verb alc262_ultra_verbs[] = {
11707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11711 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11712 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11714 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11717 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11719 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11720 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11724 /* ADC, choose mic */
11725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11726 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11729 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11733 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11734 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11738 /* mute/unmute internal speaker according to the hp jack and mute state */
11739 static void alc262_ultra_automute(struct hda_codec *codec)
11741 struct alc_spec *spec = codec->spec;
11745 /* auto-mute only when HP is used as HP */
11746 if (!spec->cur_mux[0]) {
11747 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11748 if (spec->jack_present)
11749 mute = HDA_AMP_MUTE;
11751 /* mute/unmute internal speaker */
11752 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11753 HDA_AMP_MUTE, mute);
11754 /* mute/unmute HP */
11755 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11756 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11759 /* unsolicited event for HP jack sensing */
11760 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11763 if ((res >> 26) != ALC880_HP_EVENT)
11765 alc262_ultra_automute(codec);
11768 static struct hda_input_mux alc262_ultra_capture_source = {
11772 { "Headphone", 0x7 },
11776 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11777 struct snd_ctl_elem_value *ucontrol)
11779 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11780 struct alc_spec *spec = codec->spec;
11783 ret = alc_mux_enum_put(kcontrol, ucontrol);
11786 /* reprogram the HP pin as mic or HP according to the input source */
11787 snd_hda_codec_write_cache(codec, 0x15, 0,
11788 AC_VERB_SET_PIN_WIDGET_CONTROL,
11789 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11790 alc262_ultra_automute(codec); /* mute/unmute HP */
11794 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11795 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11796 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11798 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11799 .name = "Capture Source",
11800 .info = alc_mux_enum_info,
11801 .get = alc_mux_enum_get,
11802 .put = alc262_ultra_mux_enum_put,
11805 .iface = NID_MAPPING,
11806 .name = "Capture Source",
11807 .private_value = 0x15,
11812 /* We use two mixers depending on the output pin; 0x16 is a mono output
11813 * and thus it's bound with a different mixer.
11814 * This function returns which mixer amp should be used.
11816 static int alc262_check_volbit(hda_nid_t nid)
11820 else if (nid == 0x16)
11826 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11827 const char *pfx, int *vbits)
11832 vbit = alc262_check_volbit(nid);
11835 if (*vbits & vbit) /* a volume control for this mixer already there */
11839 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11841 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11842 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11845 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11853 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11855 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11856 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11859 /* add playback controls from the parsed DAC table */
11860 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11861 const struct auto_pin_cfg *cfg)
11867 spec->multiout.num_dacs = 1; /* only use one dac */
11868 spec->multiout.dac_nids = spec->private_dac_nids;
11869 spec->multiout.dac_nids[0] = 2;
11871 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11873 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11877 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11880 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11883 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11887 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11888 alc262_check_volbit(cfg->speaker_pins[0]) |
11889 alc262_check_volbit(cfg->hp_pins[0]);
11890 if (vbits == 1 || vbits == 2)
11891 pfx = "Master"; /* only one mixer is used */
11892 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11897 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11900 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11904 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11911 #define alc262_auto_create_input_ctls \
11912 alc882_auto_create_input_ctls
11915 * generic initialization of ADC, input mixers and output mixers
11917 static struct hda_verb alc262_volume_init_verbs[] = {
11919 * Unmute ADC0-2 and set the default input to mic-in
11921 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11922 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11923 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11925 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11926 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11928 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11930 * Note: PASD motherboards uses the Line In 2 as the input for
11931 * front panel mic (mic 2)
11933 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11941 * Set up output mixers (0x0c - 0x0f)
11943 /* set vol=0 to output mixers */
11944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11945 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11946 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11948 /* set up input amps for analog loopback */
11949 /* Amp Indices: DAC = 0, mixer = 1 */
11950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11957 /* FIXME: use matrix-type input source selection */
11958 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11959 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11960 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11961 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11962 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11963 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11965 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11966 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11967 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11968 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11970 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11978 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11980 * Unmute ADC0-2 and set the default input to mic-in
11982 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11984 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11985 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11986 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11989 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11991 * Note: PASD motherboards uses the Line In 2 as the input for
11992 * front panel mic (mic 2)
11994 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12004 * Set up output mixers (0x0c - 0x0e)
12006 /* set vol=0 to output mixers */
12007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12011 /* set up input amps for analog loopback */
12012 /* Amp Indices: DAC = 0, mixer = 1 */
12013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12015 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12017 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12020 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12021 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12022 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12024 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12025 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12027 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12028 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12030 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12031 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12032 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12033 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12034 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12036 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12037 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12039 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12040 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12041 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12044 /* FIXME: use matrix-type input source selection */
12045 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12046 /* Input mixer1: only unmute Mic */
12047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12051 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12052 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12053 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12054 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12055 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12059 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12061 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12065 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12067 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12077 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12082 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12084 * Unmute ADC0-2 and set the default input to mic-in
12086 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12088 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12091 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12093 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12095 * Note: PASD motherboards uses the Line In 2 as the input for front
12096 * panel mic (mic 2)
12098 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12108 * Set up output mixers (0x0c - 0x0e)
12110 /* set vol=0 to output mixers */
12111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12112 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12113 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12115 /* set up input amps for analog loopback */
12116 /* Amp Indices: DAC = 0, mixer = 1 */
12117 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12118 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12120 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12121 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12125 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12126 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12127 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12128 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12129 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12130 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12131 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12133 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12136 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12137 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12139 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12140 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12141 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12142 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12143 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12144 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12146 /* FIXME: use matrix-type input source selection */
12147 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12148 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12149 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12150 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12151 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12152 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12153 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12154 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12157 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12158 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12159 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12160 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12161 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12162 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12166 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12167 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12168 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12170 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12173 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12178 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12182 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12184 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12185 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12190 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12191 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12196 #ifdef CONFIG_SND_HDA_POWER_SAVE
12197 #define alc262_loopbacks alc880_loopbacks
12200 /* pcm configuration: identical with ALC880 */
12201 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12202 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12203 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12204 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12207 * BIOS auto configuration
12209 static int alc262_parse_auto_config(struct hda_codec *codec)
12211 struct alc_spec *spec = codec->spec;
12213 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12215 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12219 if (!spec->autocfg.line_outs) {
12220 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12221 spec->multiout.max_channels = 2;
12222 spec->no_analog = 1;
12225 return 0; /* can't find valid BIOS pin config */
12227 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12230 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12234 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12237 alc_auto_parse_digital(codec);
12239 if (spec->kctls.list)
12240 add_mixer(spec, spec->kctls.list);
12242 add_verb(spec, alc262_volume_init_verbs);
12243 spec->num_mux_defs = 1;
12244 spec->input_mux = &spec->private_imux[0];
12246 err = alc_auto_add_mic_boost(codec);
12250 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12255 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12256 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12257 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12258 #define alc262_auto_init_input_src alc882_auto_init_input_src
12261 /* init callback for auto-configuration model -- overriding the default init */
12262 static void alc262_auto_init(struct hda_codec *codec)
12264 struct alc_spec *spec = codec->spec;
12265 alc262_auto_init_multi_out(codec);
12266 alc262_auto_init_hp_out(codec);
12267 alc262_auto_init_analog_input(codec);
12268 alc262_auto_init_input_src(codec);
12269 alc_auto_init_digital(codec);
12270 if (spec->unsol_event)
12271 alc_inithook(codec);
12275 * configuration and preset
12277 static const char *alc262_models[ALC262_MODEL_LAST] = {
12278 [ALC262_BASIC] = "basic",
12279 [ALC262_HIPPO] = "hippo",
12280 [ALC262_HIPPO_1] = "hippo_1",
12281 [ALC262_FUJITSU] = "fujitsu",
12282 [ALC262_HP_BPC] = "hp-bpc",
12283 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12284 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12285 [ALC262_HP_RP5700] = "hp-rp5700",
12286 [ALC262_BENQ_ED8] = "benq",
12287 [ALC262_BENQ_T31] = "benq-t31",
12288 [ALC262_SONY_ASSAMD] = "sony-assamd",
12289 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12290 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12291 [ALC262_ULTRA] = "ultra",
12292 [ALC262_LENOVO_3000] = "lenovo-3000",
12293 [ALC262_NEC] = "nec",
12294 [ALC262_TYAN] = "tyan",
12295 [ALC262_AUTO] = "auto",
12298 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12299 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12300 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12301 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12303 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12305 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12307 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12308 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12309 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12310 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12311 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12312 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12313 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12314 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12315 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12316 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12317 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12318 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12319 ALC262_HP_TC_T5735),
12320 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12321 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12322 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12323 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12324 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12325 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12326 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12327 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12328 #if 0 /* disable the quirk since model=auto works better in recent versions */
12329 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12330 ALC262_SONY_ASSAMD),
12332 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12333 ALC262_TOSHIBA_RX1),
12334 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12335 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12336 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12337 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12338 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12340 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12341 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12342 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12343 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12344 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12348 static struct alc_config_preset alc262_presets[] = {
12350 .mixers = { alc262_base_mixer },
12351 .init_verbs = { alc262_init_verbs },
12352 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12353 .dac_nids = alc262_dac_nids,
12355 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12356 .channel_mode = alc262_modes,
12357 .input_mux = &alc262_capture_source,
12360 .mixers = { alc262_hippo_mixer },
12361 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12362 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12363 .dac_nids = alc262_dac_nids,
12365 .dig_out_nid = ALC262_DIGOUT_NID,
12366 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12367 .channel_mode = alc262_modes,
12368 .input_mux = &alc262_capture_source,
12369 .unsol_event = alc262_hippo_unsol_event,
12370 .setup = alc262_hippo_setup,
12371 .init_hook = alc262_hippo_automute,
12373 [ALC262_HIPPO_1] = {
12374 .mixers = { alc262_hippo1_mixer },
12375 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12376 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12377 .dac_nids = alc262_dac_nids,
12379 .dig_out_nid = ALC262_DIGOUT_NID,
12380 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12381 .channel_mode = alc262_modes,
12382 .input_mux = &alc262_capture_source,
12383 .unsol_event = alc262_hippo_unsol_event,
12384 .setup = alc262_hippo1_setup,
12385 .init_hook = alc262_hippo_automute,
12387 [ALC262_FUJITSU] = {
12388 .mixers = { alc262_fujitsu_mixer },
12389 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12390 alc262_fujitsu_unsol_verbs },
12391 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12392 .dac_nids = alc262_dac_nids,
12394 .dig_out_nid = ALC262_DIGOUT_NID,
12395 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12396 .channel_mode = alc262_modes,
12397 .input_mux = &alc262_fujitsu_capture_source,
12398 .unsol_event = alc262_fujitsu_unsol_event,
12399 .init_hook = alc262_fujitsu_init_hook,
12401 [ALC262_HP_BPC] = {
12402 .mixers = { alc262_HP_BPC_mixer },
12403 .init_verbs = { alc262_HP_BPC_init_verbs },
12404 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12405 .dac_nids = alc262_dac_nids,
12407 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12408 .channel_mode = alc262_modes,
12409 .input_mux = &alc262_HP_capture_source,
12410 .unsol_event = alc262_hp_bpc_unsol_event,
12411 .init_hook = alc262_hp_bpc_automute,
12413 [ALC262_HP_BPC_D7000_WF] = {
12414 .mixers = { alc262_HP_BPC_WildWest_mixer },
12415 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12416 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12417 .dac_nids = alc262_dac_nids,
12419 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12420 .channel_mode = alc262_modes,
12421 .input_mux = &alc262_HP_D7000_capture_source,
12422 .unsol_event = alc262_hp_wildwest_unsol_event,
12423 .init_hook = alc262_hp_wildwest_automute,
12425 [ALC262_HP_BPC_D7000_WL] = {
12426 .mixers = { alc262_HP_BPC_WildWest_mixer,
12427 alc262_HP_BPC_WildWest_option_mixer },
12428 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12429 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12430 .dac_nids = alc262_dac_nids,
12432 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12433 .channel_mode = alc262_modes,
12434 .input_mux = &alc262_HP_D7000_capture_source,
12435 .unsol_event = alc262_hp_wildwest_unsol_event,
12436 .init_hook = alc262_hp_wildwest_automute,
12438 [ALC262_HP_TC_T5735] = {
12439 .mixers = { alc262_hp_t5735_mixer },
12440 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12441 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12442 .dac_nids = alc262_dac_nids,
12444 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12445 .channel_mode = alc262_modes,
12446 .input_mux = &alc262_capture_source,
12447 .unsol_event = alc_sku_unsol_event,
12448 .setup = alc262_hp_t5735_setup,
12449 .init_hook = alc_inithook,
12451 [ALC262_HP_RP5700] = {
12452 .mixers = { alc262_hp_rp5700_mixer },
12453 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12454 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12455 .dac_nids = alc262_dac_nids,
12456 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12457 .channel_mode = alc262_modes,
12458 .input_mux = &alc262_hp_rp5700_capture_source,
12460 [ALC262_BENQ_ED8] = {
12461 .mixers = { alc262_base_mixer },
12462 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12463 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12464 .dac_nids = alc262_dac_nids,
12466 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12467 .channel_mode = alc262_modes,
12468 .input_mux = &alc262_capture_source,
12470 [ALC262_SONY_ASSAMD] = {
12471 .mixers = { alc262_sony_mixer },
12472 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12473 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12474 .dac_nids = alc262_dac_nids,
12476 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12477 .channel_mode = alc262_modes,
12478 .input_mux = &alc262_capture_source,
12479 .unsol_event = alc262_hippo_unsol_event,
12480 .setup = alc262_hippo_setup,
12481 .init_hook = alc262_hippo_automute,
12483 [ALC262_BENQ_T31] = {
12484 .mixers = { alc262_benq_t31_mixer },
12485 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12486 alc_hp15_unsol_verbs },
12487 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12488 .dac_nids = alc262_dac_nids,
12490 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12491 .channel_mode = alc262_modes,
12492 .input_mux = &alc262_capture_source,
12493 .unsol_event = alc262_hippo_unsol_event,
12494 .setup = alc262_hippo_setup,
12495 .init_hook = alc262_hippo_automute,
12498 .mixers = { alc262_ultra_mixer },
12499 .cap_mixer = alc262_ultra_capture_mixer,
12500 .init_verbs = { alc262_ultra_verbs },
12501 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12502 .dac_nids = alc262_dac_nids,
12503 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12504 .channel_mode = alc262_modes,
12505 .input_mux = &alc262_ultra_capture_source,
12506 .adc_nids = alc262_adc_nids, /* ADC0 */
12507 .capsrc_nids = alc262_capsrc_nids,
12508 .num_adc_nids = 1, /* single ADC */
12509 .unsol_event = alc262_ultra_unsol_event,
12510 .init_hook = alc262_ultra_automute,
12512 [ALC262_LENOVO_3000] = {
12513 .mixers = { alc262_lenovo_3000_mixer },
12514 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12515 alc262_lenovo_3000_unsol_verbs,
12516 alc262_lenovo_3000_init_verbs },
12517 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12518 .dac_nids = alc262_dac_nids,
12520 .dig_out_nid = ALC262_DIGOUT_NID,
12521 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12522 .channel_mode = alc262_modes,
12523 .input_mux = &alc262_fujitsu_capture_source,
12524 .unsol_event = alc262_lenovo_3000_unsol_event,
12527 .mixers = { alc262_nec_mixer },
12528 .init_verbs = { alc262_nec_verbs },
12529 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12530 .dac_nids = alc262_dac_nids,
12532 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12533 .channel_mode = alc262_modes,
12534 .input_mux = &alc262_capture_source,
12536 [ALC262_TOSHIBA_S06] = {
12537 .mixers = { alc262_toshiba_s06_mixer },
12538 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12539 alc262_eapd_verbs },
12540 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12541 .capsrc_nids = alc262_dmic_capsrc_nids,
12542 .dac_nids = alc262_dac_nids,
12543 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12544 .num_adc_nids = 1, /* single ADC */
12545 .dig_out_nid = ALC262_DIGOUT_NID,
12546 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12547 .channel_mode = alc262_modes,
12548 .unsol_event = alc_sku_unsol_event,
12549 .setup = alc262_toshiba_s06_setup,
12550 .init_hook = alc_inithook,
12552 [ALC262_TOSHIBA_RX1] = {
12553 .mixers = { alc262_toshiba_rx1_mixer },
12554 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12555 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12556 .dac_nids = alc262_dac_nids,
12558 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12559 .channel_mode = alc262_modes,
12560 .input_mux = &alc262_capture_source,
12561 .unsol_event = alc262_hippo_unsol_event,
12562 .setup = alc262_hippo_setup,
12563 .init_hook = alc262_hippo_automute,
12566 .mixers = { alc262_tyan_mixer },
12567 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12568 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12569 .dac_nids = alc262_dac_nids,
12571 .dig_out_nid = ALC262_DIGOUT_NID,
12572 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12573 .channel_mode = alc262_modes,
12574 .input_mux = &alc262_capture_source,
12575 .unsol_event = alc_automute_amp_unsol_event,
12576 .setup = alc262_tyan_setup,
12577 .init_hook = alc_automute_amp,
12581 static int patch_alc262(struct hda_codec *codec)
12583 struct alc_spec *spec;
12587 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12591 codec->spec = spec;
12593 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12598 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12599 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12600 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12601 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12604 alc_auto_parse_customize_define(codec);
12606 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12608 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12612 if (board_config < 0) {
12613 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12615 board_config = ALC262_AUTO;
12618 if (board_config == ALC262_AUTO) {
12619 /* automatic parse from the BIOS config */
12620 err = alc262_parse_auto_config(codec);
12626 "hda_codec: Cannot set up configuration "
12627 "from BIOS. Using base mode...\n");
12628 board_config = ALC262_BASIC;
12632 if (!spec->no_analog && has_cdefine_beep(codec)) {
12633 err = snd_hda_attach_beep_device(codec, 0x1);
12640 if (board_config != ALC262_AUTO)
12641 setup_preset(codec, &alc262_presets[board_config]);
12643 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12644 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12646 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12647 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12649 if (!spec->adc_nids && spec->input_mux) {
12651 /* check whether the digital-mic has to be supported */
12652 for (i = 0; i < spec->input_mux->num_items; i++) {
12653 if (spec->input_mux->items[i].index >= 9)
12656 if (i < spec->input_mux->num_items) {
12657 /* use only ADC0 */
12658 spec->adc_nids = alc262_dmic_adc_nids;
12659 spec->num_adc_nids = 1;
12660 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12662 /* all analog inputs */
12663 /* check whether NID 0x07 is valid */
12664 unsigned int wcap = get_wcaps(codec, 0x07);
12667 wcap = get_wcaps_type(wcap);
12668 if (wcap != AC_WID_AUD_IN) {
12669 spec->adc_nids = alc262_adc_nids_alt;
12670 spec->num_adc_nids =
12671 ARRAY_SIZE(alc262_adc_nids_alt);
12672 spec->capsrc_nids = alc262_capsrc_nids_alt;
12674 spec->adc_nids = alc262_adc_nids;
12675 spec->num_adc_nids =
12676 ARRAY_SIZE(alc262_adc_nids);
12677 spec->capsrc_nids = alc262_capsrc_nids;
12681 if (!spec->cap_mixer && !spec->no_analog)
12682 set_capture_mixer(codec);
12683 if (!spec->no_analog && has_cdefine_beep(codec))
12684 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12686 spec->vmaster_nid = 0x0c;
12688 codec->patch_ops = alc_patch_ops;
12689 if (board_config == ALC262_AUTO)
12690 spec->init_hook = alc262_auto_init;
12691 #ifdef CONFIG_SND_HDA_POWER_SAVE
12692 if (!spec->loopback.amplist)
12693 spec->loopback.amplist = alc262_loopbacks;
12700 * ALC268 channel source setting (2 channel)
12702 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12703 #define alc268_modes alc260_modes
12705 static hda_nid_t alc268_dac_nids[2] = {
12710 static hda_nid_t alc268_adc_nids[2] = {
12715 static hda_nid_t alc268_adc_nids_alt[1] = {
12720 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12722 static struct snd_kcontrol_new alc268_base_mixer[] = {
12723 /* output mixer control */
12724 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12725 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12726 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12728 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12729 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12730 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12734 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12735 /* output mixer control */
12736 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12737 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12738 ALC262_HIPPO_MASTER_SWITCH,
12739 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12740 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12741 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12745 /* bind Beep switches of both NID 0x0f and 0x10 */
12746 static struct hda_bind_ctls alc268_bind_beep_sw = {
12747 .ops = &snd_hda_bind_sw,
12749 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12750 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12755 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12756 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12757 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12761 static struct hda_verb alc268_eapd_verbs[] = {
12762 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12763 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12767 /* Toshiba specific */
12768 static struct hda_verb alc268_toshiba_verbs[] = {
12769 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12773 /* Acer specific */
12774 /* bind volumes of both NID 0x02 and 0x03 */
12775 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12776 .ops = &snd_hda_bind_vol,
12778 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12779 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12784 /* mute/unmute internal speaker according to the hp jack and mute state */
12785 static void alc268_acer_automute(struct hda_codec *codec, int force)
12787 struct alc_spec *spec = codec->spec;
12790 if (force || !spec->sense_updated) {
12791 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12792 spec->sense_updated = 1;
12794 if (spec->jack_present)
12795 mute = HDA_AMP_MUTE; /* mute internal speaker */
12796 else /* unmute internal speaker if necessary */
12797 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12798 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12799 HDA_AMP_MUTE, mute);
12803 /* bind hp and internal speaker mute (with plug check) */
12804 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12805 struct snd_ctl_elem_value *ucontrol)
12807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12808 long *valp = ucontrol->value.integer.value;
12811 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12813 alc268_acer_automute(codec, 0);
12817 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12818 /* output mixer control */
12819 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12821 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12822 .name = "Master Playback Switch",
12823 .subdevice = HDA_SUBDEV_AMP_FLAG,
12824 .info = snd_hda_mixer_amp_switch_info,
12825 .get = snd_hda_mixer_amp_switch_get,
12826 .put = alc268_acer_master_sw_put,
12827 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12829 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12833 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12834 /* output mixer control */
12835 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12838 .name = "Master Playback Switch",
12839 .subdevice = HDA_SUBDEV_AMP_FLAG,
12840 .info = snd_hda_mixer_amp_switch_info,
12841 .get = snd_hda_mixer_amp_switch_get,
12842 .put = alc268_acer_master_sw_put,
12843 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12845 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12846 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12847 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12851 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12852 /* output mixer control */
12853 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12855 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12856 .name = "Master Playback Switch",
12857 .subdevice = HDA_SUBDEV_AMP_FLAG,
12858 .info = snd_hda_mixer_amp_switch_info,
12859 .get = snd_hda_mixer_amp_switch_get,
12860 .put = alc268_acer_master_sw_put,
12861 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12863 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12864 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12868 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12869 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12871 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12872 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12873 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12874 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12878 static struct hda_verb alc268_acer_verbs[] = {
12879 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12880 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12884 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12889 /* unsolicited event for HP jack sensing */
12890 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12891 #define alc268_toshiba_setup alc262_hippo_setup
12892 #define alc268_toshiba_automute alc262_hippo_automute
12894 static void alc268_acer_unsol_event(struct hda_codec *codec,
12897 if ((res >> 26) != ALC880_HP_EVENT)
12899 alc268_acer_automute(codec, 1);
12902 static void alc268_acer_init_hook(struct hda_codec *codec)
12904 alc268_acer_automute(codec, 1);
12907 /* toggle speaker-output according to the hp-jack state */
12908 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12910 unsigned int present;
12911 unsigned char bits;
12913 present = snd_hda_jack_detect(codec, 0x15);
12914 bits = present ? HDA_AMP_MUTE : 0;
12915 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12916 HDA_AMP_MUTE, bits);
12917 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12918 HDA_AMP_MUTE, bits);
12921 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12924 switch (res >> 26) {
12925 case ALC880_HP_EVENT:
12926 alc268_aspire_one_speaker_automute(codec);
12928 case ALC880_MIC_EVENT:
12929 alc_mic_automute(codec);
12934 static void alc268_acer_lc_setup(struct hda_codec *codec)
12936 struct alc_spec *spec = codec->spec;
12937 spec->ext_mic.pin = 0x18;
12938 spec->ext_mic.mux_idx = 0;
12939 spec->int_mic.pin = 0x12;
12940 spec->int_mic.mux_idx = 6;
12941 spec->auto_mic = 1;
12944 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12946 alc268_aspire_one_speaker_automute(codec);
12947 alc_mic_automute(codec);
12950 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12951 /* output mixer control */
12952 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12953 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12954 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12957 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12961 static struct hda_verb alc268_dell_verbs[] = {
12962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12964 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12965 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12969 /* mute/unmute internal speaker according to the hp jack and mute state */
12970 static void alc268_dell_setup(struct hda_codec *codec)
12972 struct alc_spec *spec = codec->spec;
12974 spec->autocfg.hp_pins[0] = 0x15;
12975 spec->autocfg.speaker_pins[0] = 0x14;
12976 spec->ext_mic.pin = 0x18;
12977 spec->ext_mic.mux_idx = 0;
12978 spec->int_mic.pin = 0x19;
12979 spec->int_mic.mux_idx = 1;
12980 spec->auto_mic = 1;
12983 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12984 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12985 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12986 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12988 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12989 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12990 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12991 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12995 static struct hda_verb alc267_quanta_il1_verbs[] = {
12996 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12997 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13001 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13003 struct alc_spec *spec = codec->spec;
13004 spec->autocfg.hp_pins[0] = 0x15;
13005 spec->autocfg.speaker_pins[0] = 0x14;
13006 spec->ext_mic.pin = 0x18;
13007 spec->ext_mic.mux_idx = 0;
13008 spec->int_mic.pin = 0x19;
13009 spec->int_mic.mux_idx = 1;
13010 spec->auto_mic = 1;
13014 * generic initialization of ADC, input mixers and output mixers
13016 static struct hda_verb alc268_base_init_verbs[] = {
13017 /* Unmute DAC0-1 and set vol = 0 */
13018 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13019 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13022 * Set up output mixers (0x0c - 0x0e)
13024 /* set vol=0 to output mixers */
13025 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13026 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13029 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13034 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13036 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13037 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13038 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13042 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13043 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13046 /* set PCBEEP vol = 0, mute connections */
13047 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13048 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13049 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13051 /* Unmute Selector 23h,24h and set the default input to mic-in */
13053 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13055 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13062 * generic initialization of ADC, input mixers and output mixers
13064 static struct hda_verb alc268_volume_init_verbs[] = {
13065 /* set output DAC */
13066 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13067 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13072 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13073 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13075 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13076 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13077 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13079 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13080 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13082 /* set PCBEEP vol = 0, mute connections */
13083 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13085 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13090 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13091 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13092 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13096 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13097 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13098 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13103 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13104 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13105 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13106 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13107 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13112 static struct hda_input_mux alc268_capture_source = {
13116 { "Front Mic", 0x1 },
13122 static struct hda_input_mux alc268_acer_capture_source = {
13126 { "Internal Mic", 0x1 },
13131 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13135 { "Internal Mic", 0x6 },
13140 #ifdef CONFIG_SND_DEBUG
13141 static struct snd_kcontrol_new alc268_test_mixer[] = {
13142 /* Volume widgets */
13143 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13144 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13145 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13146 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13147 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13148 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13149 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13150 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13151 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13152 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13153 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13154 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13155 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13156 /* The below appears problematic on some hardwares */
13157 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13158 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13159 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13160 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13161 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13163 /* Modes for retasking pin widgets */
13164 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13165 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13166 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13167 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13169 /* Controls for GPIO pins, assuming they are configured as outputs */
13170 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13171 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13172 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13173 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13175 /* Switches to allow the digital SPDIF output pin to be enabled.
13176 * The ALC268 does not have an SPDIF input.
13178 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13180 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13181 * this output to turn on an external amplifier.
13183 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13184 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13190 /* create input playback/capture controls for the given pin */
13191 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13192 const char *ctlname, int idx)
13203 case 0x1a: /* ALC259/269 only */
13204 case 0x1b: /* ALC259/269 only */
13205 case 0x21: /* ALC269vb has this pin, too */
13209 snd_printd(KERN_WARNING "hda_codec: "
13210 "ignoring pin 0x%x as unknown\n", nid);
13213 if (spec->multiout.dac_nids[0] != dac &&
13214 spec->multiout.dac_nids[1] != dac) {
13215 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13216 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13220 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13224 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13225 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13227 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13228 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13234 /* add playback controls from the parsed DAC table */
13235 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13236 const struct auto_pin_cfg *cfg)
13241 spec->multiout.dac_nids = spec->private_dac_nids;
13243 nid = cfg->line_out_pins[0];
13246 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13250 err = alc268_new_analog_output(spec, nid, name, 0);
13255 nid = cfg->speaker_pins[0];
13257 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13258 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13262 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13266 nid = cfg->hp_pins[0];
13268 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13273 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13275 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13276 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13283 /* create playback/capture controls for input pins */
13284 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13285 const struct auto_pin_cfg *cfg)
13287 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13290 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13291 hda_nid_t nid, int pin_type)
13295 alc_set_pin_output(codec, nid, pin_type);
13296 if (nid == 0x14 || nid == 0x16)
13300 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13303 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13305 struct alc_spec *spec = codec->spec;
13306 hda_nid_t nid = spec->autocfg.line_out_pins[0];
13308 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13309 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13313 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13315 struct alc_spec *spec = codec->spec;
13318 pin = spec->autocfg.hp_pins[0];
13320 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13321 pin = spec->autocfg.speaker_pins[0];
13323 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13326 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13328 struct alc_spec *spec = codec->spec;
13329 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13330 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13331 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13332 unsigned int dac_vol1, dac_vol2;
13334 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13335 snd_hda_codec_write(codec, speaker_nid, 0,
13336 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13337 /* mute mixer inputs from 0x1d */
13338 snd_hda_codec_write(codec, 0x0f, 0,
13339 AC_VERB_SET_AMP_GAIN_MUTE,
13341 snd_hda_codec_write(codec, 0x10, 0,
13342 AC_VERB_SET_AMP_GAIN_MUTE,
13345 /* unmute mixer inputs from 0x1d */
13346 snd_hda_codec_write(codec, 0x0f, 0,
13347 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13348 snd_hda_codec_write(codec, 0x10, 0,
13349 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13352 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13353 if (line_nid == 0x14)
13354 dac_vol2 = AMP_OUT_ZERO;
13355 else if (line_nid == 0x15)
13356 dac_vol1 = AMP_OUT_ZERO;
13357 if (hp_nid == 0x14)
13358 dac_vol2 = AMP_OUT_ZERO;
13359 else if (hp_nid == 0x15)
13360 dac_vol1 = AMP_OUT_ZERO;
13361 if (line_nid != 0x16 || hp_nid != 0x16 ||
13362 spec->autocfg.line_out_pins[1] != 0x16 ||
13363 spec->autocfg.line_out_pins[2] != 0x16)
13364 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13366 snd_hda_codec_write(codec, 0x02, 0,
13367 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13368 snd_hda_codec_write(codec, 0x03, 0,
13369 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13372 /* pcm configuration: identical with ALC880 */
13373 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13374 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13375 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13376 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13379 * BIOS auto configuration
13381 static int alc268_parse_auto_config(struct hda_codec *codec)
13383 struct alc_spec *spec = codec->spec;
13385 static hda_nid_t alc268_ignore[] = { 0 };
13387 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13391 if (!spec->autocfg.line_outs) {
13392 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13393 spec->multiout.max_channels = 2;
13394 spec->no_analog = 1;
13397 return 0; /* can't find valid BIOS pin config */
13399 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13402 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13406 spec->multiout.max_channels = 2;
13409 /* digital only support output */
13410 alc_auto_parse_digital(codec);
13411 if (spec->kctls.list)
13412 add_mixer(spec, spec->kctls.list);
13414 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13415 add_mixer(spec, alc268_beep_mixer);
13417 add_verb(spec, alc268_volume_init_verbs);
13418 spec->num_mux_defs = 2;
13419 spec->input_mux = &spec->private_imux[0];
13421 err = alc_auto_add_mic_boost(codec);
13425 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13430 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13432 /* init callback for auto-configuration model -- overriding the default init */
13433 static void alc268_auto_init(struct hda_codec *codec)
13435 struct alc_spec *spec = codec->spec;
13436 alc268_auto_init_multi_out(codec);
13437 alc268_auto_init_hp_out(codec);
13438 alc268_auto_init_mono_speaker_out(codec);
13439 alc268_auto_init_analog_input(codec);
13440 alc_auto_init_digital(codec);
13441 if (spec->unsol_event)
13442 alc_inithook(codec);
13446 * configuration and preset
13448 static const char *alc268_models[ALC268_MODEL_LAST] = {
13449 [ALC267_QUANTA_IL1] = "quanta-il1",
13450 [ALC268_3ST] = "3stack",
13451 [ALC268_TOSHIBA] = "toshiba",
13452 [ALC268_ACER] = "acer",
13453 [ALC268_ACER_DMIC] = "acer-dmic",
13454 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13455 [ALC268_DELL] = "dell",
13456 [ALC268_ZEPTO] = "zepto",
13457 #ifdef CONFIG_SND_DEBUG
13458 [ALC268_TEST] = "test",
13460 [ALC268_AUTO] = "auto",
13463 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13464 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13465 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13466 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13467 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13468 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13469 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13470 ALC268_ACER_ASPIRE_ONE),
13471 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13472 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13473 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13474 /* almost compatible with toshiba but with optional digital outs;
13475 * auto-probing seems working fine
13477 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13479 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13480 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13481 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13482 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13483 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13487 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13488 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13489 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13490 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13491 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13496 static struct alc_config_preset alc268_presets[] = {
13497 [ALC267_QUANTA_IL1] = {
13498 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13499 alc268_capture_nosrc_mixer },
13500 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13501 alc267_quanta_il1_verbs },
13502 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13503 .dac_nids = alc268_dac_nids,
13504 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13505 .adc_nids = alc268_adc_nids_alt,
13507 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13508 .channel_mode = alc268_modes,
13509 .unsol_event = alc_sku_unsol_event,
13510 .setup = alc267_quanta_il1_setup,
13511 .init_hook = alc_inithook,
13514 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13515 alc268_beep_mixer },
13516 .init_verbs = { alc268_base_init_verbs },
13517 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13518 .dac_nids = alc268_dac_nids,
13519 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13520 .adc_nids = alc268_adc_nids_alt,
13521 .capsrc_nids = alc268_capsrc_nids,
13523 .dig_out_nid = ALC268_DIGOUT_NID,
13524 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13525 .channel_mode = alc268_modes,
13526 .input_mux = &alc268_capture_source,
13528 [ALC268_TOSHIBA] = {
13529 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13530 alc268_beep_mixer },
13531 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13532 alc268_toshiba_verbs },
13533 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13534 .dac_nids = alc268_dac_nids,
13535 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13536 .adc_nids = alc268_adc_nids_alt,
13537 .capsrc_nids = alc268_capsrc_nids,
13539 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13540 .channel_mode = alc268_modes,
13541 .input_mux = &alc268_capture_source,
13542 .unsol_event = alc268_toshiba_unsol_event,
13543 .setup = alc268_toshiba_setup,
13544 .init_hook = alc268_toshiba_automute,
13547 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13548 alc268_beep_mixer },
13549 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13550 alc268_acer_verbs },
13551 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13552 .dac_nids = alc268_dac_nids,
13553 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13554 .adc_nids = alc268_adc_nids_alt,
13555 .capsrc_nids = alc268_capsrc_nids,
13557 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13558 .channel_mode = alc268_modes,
13559 .input_mux = &alc268_acer_capture_source,
13560 .unsol_event = alc268_acer_unsol_event,
13561 .init_hook = alc268_acer_init_hook,
13563 [ALC268_ACER_DMIC] = {
13564 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13565 alc268_beep_mixer },
13566 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13567 alc268_acer_verbs },
13568 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13569 .dac_nids = alc268_dac_nids,
13570 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13571 .adc_nids = alc268_adc_nids_alt,
13572 .capsrc_nids = alc268_capsrc_nids,
13574 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13575 .channel_mode = alc268_modes,
13576 .input_mux = &alc268_acer_dmic_capture_source,
13577 .unsol_event = alc268_acer_unsol_event,
13578 .init_hook = alc268_acer_init_hook,
13580 [ALC268_ACER_ASPIRE_ONE] = {
13581 .mixers = { alc268_acer_aspire_one_mixer,
13583 alc268_capture_nosrc_mixer },
13584 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13585 alc268_acer_aspire_one_verbs },
13586 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13587 .dac_nids = alc268_dac_nids,
13588 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13589 .adc_nids = alc268_adc_nids_alt,
13590 .capsrc_nids = alc268_capsrc_nids,
13592 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13593 .channel_mode = alc268_modes,
13594 .unsol_event = alc268_acer_lc_unsol_event,
13595 .setup = alc268_acer_lc_setup,
13596 .init_hook = alc268_acer_lc_init_hook,
13599 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13600 alc268_capture_nosrc_mixer },
13601 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13602 alc268_dell_verbs },
13603 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13604 .dac_nids = alc268_dac_nids,
13605 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13606 .adc_nids = alc268_adc_nids_alt,
13607 .capsrc_nids = alc268_capsrc_nids,
13609 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13610 .channel_mode = alc268_modes,
13611 .unsol_event = alc_sku_unsol_event,
13612 .setup = alc268_dell_setup,
13613 .init_hook = alc_inithook,
13616 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13617 alc268_beep_mixer },
13618 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13619 alc268_toshiba_verbs },
13620 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13621 .dac_nids = alc268_dac_nids,
13622 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13623 .adc_nids = alc268_adc_nids_alt,
13624 .capsrc_nids = alc268_capsrc_nids,
13626 .dig_out_nid = ALC268_DIGOUT_NID,
13627 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13628 .channel_mode = alc268_modes,
13629 .input_mux = &alc268_capture_source,
13630 .setup = alc268_toshiba_setup,
13631 .init_hook = alc268_toshiba_automute,
13633 #ifdef CONFIG_SND_DEBUG
13635 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13636 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13637 alc268_volume_init_verbs },
13638 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13639 .dac_nids = alc268_dac_nids,
13640 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13641 .adc_nids = alc268_adc_nids_alt,
13642 .capsrc_nids = alc268_capsrc_nids,
13644 .dig_out_nid = ALC268_DIGOUT_NID,
13645 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13646 .channel_mode = alc268_modes,
13647 .input_mux = &alc268_capture_source,
13652 static int patch_alc268(struct hda_codec *codec)
13654 struct alc_spec *spec;
13656 int i, has_beep, err;
13658 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13662 codec->spec = spec;
13664 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13668 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13669 board_config = snd_hda_check_board_codec_sid_config(codec,
13670 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13672 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13673 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13675 board_config = ALC268_AUTO;
13678 if (board_config == ALC268_AUTO) {
13679 /* automatic parse from the BIOS config */
13680 err = alc268_parse_auto_config(codec);
13686 "hda_codec: Cannot set up configuration "
13687 "from BIOS. Using base mode...\n");
13688 board_config = ALC268_3ST;
13692 if (board_config != ALC268_AUTO)
13693 setup_preset(codec, &alc268_presets[board_config]);
13695 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13696 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13697 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13699 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13702 for (i = 0; i < spec->num_mixers; i++) {
13703 if (spec->mixers[i] == alc268_beep_mixer) {
13710 err = snd_hda_attach_beep_device(codec, 0x1);
13715 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13716 /* override the amp caps for beep generator */
13717 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13718 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13719 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13720 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13721 (0 << AC_AMPCAP_MUTE_SHIFT));
13724 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13725 /* check whether NID 0x07 is valid */
13726 unsigned int wcap = get_wcaps(codec, 0x07);
13729 spec->capsrc_nids = alc268_capsrc_nids;
13731 wcap = get_wcaps_type(wcap);
13732 if (spec->auto_mic ||
13733 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13734 spec->adc_nids = alc268_adc_nids_alt;
13735 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13736 if (spec->auto_mic)
13737 fixup_automic_adc(codec);
13738 if (spec->auto_mic || spec->input_mux->num_items == 1)
13739 add_mixer(spec, alc268_capture_nosrc_mixer);
13741 add_mixer(spec, alc268_capture_alt_mixer);
13743 spec->adc_nids = alc268_adc_nids;
13744 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13745 add_mixer(spec, alc268_capture_mixer);
13747 /* set default input source */
13748 for (i = 0; i < spec->num_adc_nids; i++)
13749 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13750 0, AC_VERB_SET_CONNECT_SEL,
13751 i < spec->num_mux_defs ?
13752 spec->input_mux[i].items[0].index :
13753 spec->input_mux->items[0].index);
13756 spec->vmaster_nid = 0x02;
13758 codec->patch_ops = alc_patch_ops;
13759 if (board_config == ALC268_AUTO)
13760 spec->init_hook = alc268_auto_init;
13766 * ALC269 channel source setting (2 channel)
13768 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13770 #define alc269_dac_nids alc260_dac_nids
13772 static hda_nid_t alc269_adc_nids[1] = {
13777 static hda_nid_t alc269_capsrc_nids[1] = {
13781 static hda_nid_t alc269vb_adc_nids[1] = {
13786 static hda_nid_t alc269vb_capsrc_nids[1] = {
13790 static hda_nid_t alc269_adc_candidates[] = {
13794 #define alc269_modes alc260_modes
13795 #define alc269_capture_source alc880_lg_lw_capture_source
13797 static struct snd_kcontrol_new alc269_base_mixer[] = {
13798 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13799 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13800 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13801 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13802 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13804 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13805 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13806 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13807 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13808 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13809 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13813 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13814 /* output mixer control */
13815 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13817 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13818 .name = "Master Playback Switch",
13819 .subdevice = HDA_SUBDEV_AMP_FLAG,
13820 .info = snd_hda_mixer_amp_switch_info,
13821 .get = snd_hda_mixer_amp_switch_get,
13822 .put = alc268_acer_master_sw_put,
13823 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13825 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13826 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13827 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13828 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13829 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13830 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13834 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13835 /* output mixer control */
13836 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13839 .name = "Master Playback Switch",
13840 .subdevice = HDA_SUBDEV_AMP_FLAG,
13841 .info = snd_hda_mixer_amp_switch_info,
13842 .get = snd_hda_mixer_amp_switch_get,
13843 .put = alc268_acer_master_sw_put,
13844 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13848 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13849 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13850 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13851 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13852 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13853 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13854 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13858 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13859 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13860 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13862 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13866 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13867 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13868 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13870 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13874 static struct snd_kcontrol_new alc269_asus_mixer[] = {
13875 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13876 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
13880 /* capture mixer elements */
13881 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13882 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13883 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13885 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13889 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13890 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13891 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13896 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13897 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13898 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13899 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13900 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13904 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13905 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13906 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13907 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13912 #define alc269_fujitsu_mixer alc269_laptop_mixer
13914 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13915 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13916 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13917 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13918 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13919 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13920 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13924 static struct hda_verb alc269_lifebook_verbs[] = {
13925 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13926 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13927 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13928 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13930 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13932 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13933 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13934 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13938 /* toggle speaker-output according to the hp-jack state */
13939 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13941 unsigned int present;
13942 unsigned char bits;
13944 present = snd_hda_jack_detect(codec, 0x15);
13945 bits = present ? HDA_AMP_MUTE : 0;
13946 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13947 HDA_AMP_MUTE, bits);
13948 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13949 HDA_AMP_MUTE, bits);
13951 snd_hda_codec_write(codec, 0x20, 0,
13952 AC_VERB_SET_COEF_INDEX, 0x0c);
13953 snd_hda_codec_write(codec, 0x20, 0,
13954 AC_VERB_SET_PROC_COEF, 0x680);
13956 snd_hda_codec_write(codec, 0x20, 0,
13957 AC_VERB_SET_COEF_INDEX, 0x0c);
13958 snd_hda_codec_write(codec, 0x20, 0,
13959 AC_VERB_SET_PROC_COEF, 0x480);
13962 /* toggle speaker-output according to the hp-jacks state */
13963 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13965 unsigned int present;
13966 unsigned char bits;
13968 /* Check laptop headphone socket */
13969 present = snd_hda_jack_detect(codec, 0x15);
13971 /* Check port replicator headphone socket */
13972 present |= snd_hda_jack_detect(codec, 0x1a);
13974 bits = present ? HDA_AMP_MUTE : 0;
13975 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13976 HDA_AMP_MUTE, bits);
13977 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13978 HDA_AMP_MUTE, bits);
13980 snd_hda_codec_write(codec, 0x20, 0,
13981 AC_VERB_SET_COEF_INDEX, 0x0c);
13982 snd_hda_codec_write(codec, 0x20, 0,
13983 AC_VERB_SET_PROC_COEF, 0x680);
13985 snd_hda_codec_write(codec, 0x20, 0,
13986 AC_VERB_SET_COEF_INDEX, 0x0c);
13987 snd_hda_codec_write(codec, 0x20, 0,
13988 AC_VERB_SET_PROC_COEF, 0x480);
13991 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13993 unsigned int present_laptop;
13994 unsigned int present_dock;
13996 present_laptop = snd_hda_jack_detect(codec, 0x18);
13997 present_dock = snd_hda_jack_detect(codec, 0x1b);
13999 /* Laptop mic port overrides dock mic port, design decision */
14001 snd_hda_codec_write(codec, 0x23, 0,
14002 AC_VERB_SET_CONNECT_SEL, 0x3);
14003 if (present_laptop)
14004 snd_hda_codec_write(codec, 0x23, 0,
14005 AC_VERB_SET_CONNECT_SEL, 0x0);
14006 if (!present_dock && !present_laptop)
14007 snd_hda_codec_write(codec, 0x23, 0,
14008 AC_VERB_SET_CONNECT_SEL, 0x1);
14011 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14014 switch (res >> 26) {
14015 case ALC880_HP_EVENT:
14016 alc269_quanta_fl1_speaker_automute(codec);
14018 case ALC880_MIC_EVENT:
14019 alc_mic_automute(codec);
14024 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14027 if ((res >> 26) == ALC880_HP_EVENT)
14028 alc269_lifebook_speaker_automute(codec);
14029 if ((res >> 26) == ALC880_MIC_EVENT)
14030 alc269_lifebook_mic_autoswitch(codec);
14033 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14035 struct alc_spec *spec = codec->spec;
14036 spec->autocfg.hp_pins[0] = 0x15;
14037 spec->autocfg.speaker_pins[0] = 0x14;
14038 spec->ext_mic.pin = 0x18;
14039 spec->ext_mic.mux_idx = 0;
14040 spec->int_mic.pin = 0x19;
14041 spec->int_mic.mux_idx = 1;
14042 spec->auto_mic = 1;
14045 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14047 alc269_quanta_fl1_speaker_automute(codec);
14048 alc_mic_automute(codec);
14051 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14053 alc269_lifebook_speaker_automute(codec);
14054 alc269_lifebook_mic_autoswitch(codec);
14057 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14058 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14059 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14060 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14061 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14062 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14063 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14064 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14068 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14070 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14071 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14073 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14074 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14078 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14079 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14080 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14081 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14083 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14084 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14085 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14089 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14090 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14091 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14092 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14093 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14094 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14095 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14096 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14100 static struct hda_verb alc271_acer_dmic_verbs[] = {
14101 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14102 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14103 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14104 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14105 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14106 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14107 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14108 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14109 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14110 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14114 /* toggle speaker-output according to the hp-jack state */
14115 static void alc269_speaker_automute(struct hda_codec *codec)
14117 struct alc_spec *spec = codec->spec;
14118 unsigned int nid = spec->autocfg.hp_pins[0];
14119 unsigned int present;
14120 unsigned char bits;
14122 present = snd_hda_jack_detect(codec, nid);
14123 bits = present ? HDA_AMP_MUTE : 0;
14124 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14125 HDA_AMP_MUTE, bits);
14126 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14127 HDA_AMP_MUTE, bits);
14130 /* unsolicited event for HP jack sensing */
14131 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14134 switch (res >> 26) {
14135 case ALC880_HP_EVENT:
14136 alc269_speaker_automute(codec);
14138 case ALC880_MIC_EVENT:
14139 alc_mic_automute(codec);
14144 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14146 struct alc_spec *spec = codec->spec;
14147 spec->autocfg.hp_pins[0] = 0x15;
14148 spec->autocfg.speaker_pins[0] = 0x14;
14149 spec->ext_mic.pin = 0x18;
14150 spec->ext_mic.mux_idx = 0;
14151 spec->int_mic.pin = 0x19;
14152 spec->int_mic.mux_idx = 1;
14153 spec->auto_mic = 1;
14156 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14158 struct alc_spec *spec = codec->spec;
14159 spec->autocfg.hp_pins[0] = 0x15;
14160 spec->autocfg.speaker_pins[0] = 0x14;
14161 spec->ext_mic.pin = 0x18;
14162 spec->ext_mic.mux_idx = 0;
14163 spec->int_mic.pin = 0x12;
14164 spec->int_mic.mux_idx = 5;
14165 spec->auto_mic = 1;
14168 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14170 struct alc_spec *spec = codec->spec;
14171 spec->autocfg.hp_pins[0] = 0x21;
14172 spec->autocfg.speaker_pins[0] = 0x14;
14173 spec->ext_mic.pin = 0x18;
14174 spec->ext_mic.mux_idx = 0;
14175 spec->int_mic.pin = 0x19;
14176 spec->int_mic.mux_idx = 1;
14177 spec->auto_mic = 1;
14180 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14182 struct alc_spec *spec = codec->spec;
14183 spec->autocfg.hp_pins[0] = 0x21;
14184 spec->autocfg.speaker_pins[0] = 0x14;
14185 spec->ext_mic.pin = 0x18;
14186 spec->ext_mic.mux_idx = 0;
14187 spec->int_mic.pin = 0x12;
14188 spec->int_mic.mux_idx = 6;
14189 spec->auto_mic = 1;
14192 static void alc269_laptop_inithook(struct hda_codec *codec)
14194 alc269_speaker_automute(codec);
14195 alc_mic_automute(codec);
14199 * generic initialization of ADC, input mixers and output mixers
14201 static struct hda_verb alc269_init_verbs[] = {
14203 * Unmute ADC0 and set the default input to mic-in
14205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14208 * Set up output mixers (0x02 - 0x03)
14210 /* set vol=0 to output mixers */
14211 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14212 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14214 /* set up input amps for analog loopback */
14215 /* Amp Indices: DAC = 0, mixer = 1 */
14216 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14218 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14219 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14220 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14221 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14224 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14225 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14226 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14228 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14229 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14231 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14234 /* FIXME: use Mux-type input source selection */
14235 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14236 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14237 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14240 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14244 static struct hda_verb alc269vb_init_verbs[] = {
14246 * Unmute ADC0 and set the default input to mic-in
14248 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14251 * Set up output mixers (0x02 - 0x03)
14253 /* set vol=0 to output mixers */
14254 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14255 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14257 /* set up input amps for analog loopback */
14258 /* Amp Indices: DAC = 0, mixer = 1 */
14259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14266 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14267 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14268 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14270 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14274 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14275 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14277 /* FIXME: use Mux-type input source selection */
14278 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14279 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14280 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14283 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14287 #define alc269_auto_create_multi_out_ctls \
14288 alc268_auto_create_multi_out_ctls
14289 #define alc269_auto_create_input_ctls \
14290 alc268_auto_create_input_ctls
14292 #ifdef CONFIG_SND_HDA_POWER_SAVE
14293 #define alc269_loopbacks alc880_loopbacks
14296 /* pcm configuration: identical with ALC880 */
14297 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14298 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14299 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14300 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14302 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14306 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14307 /* NID is set in alc_build_pcms */
14309 .open = alc880_playback_pcm_open,
14310 .prepare = alc880_playback_pcm_prepare,
14311 .cleanup = alc880_playback_pcm_cleanup
14315 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14319 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14320 /* NID is set in alc_build_pcms */
14323 #ifdef CONFIG_SND_HDA_POWER_SAVE
14324 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14326 switch (codec->subsystem_id) {
14333 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14335 /* update mute-LED according to the speaker mute state */
14336 if (nid == 0x01 || nid == 0x14) {
14338 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14343 /* mic2 vref pin is used for mute LED control */
14344 snd_hda_codec_update_cache(codec, 0x19, 0,
14345 AC_VERB_SET_PIN_WIDGET_CONTROL,
14348 return alc_check_power_status(codec, nid);
14350 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14352 static int alc275_setup_dual_adc(struct hda_codec *codec)
14354 struct alc_spec *spec = codec->spec;
14356 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14358 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14359 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14360 if (spec->ext_mic.pin <= 0x12) {
14361 spec->private_adc_nids[0] = 0x08;
14362 spec->private_adc_nids[1] = 0x11;
14363 spec->private_capsrc_nids[0] = 0x23;
14364 spec->private_capsrc_nids[1] = 0x22;
14366 spec->private_adc_nids[0] = 0x11;
14367 spec->private_adc_nids[1] = 0x08;
14368 spec->private_capsrc_nids[0] = 0x22;
14369 spec->private_capsrc_nids[1] = 0x23;
14371 spec->adc_nids = spec->private_adc_nids;
14372 spec->capsrc_nids = spec->private_capsrc_nids;
14373 spec->num_adc_nids = 2;
14374 spec->dual_adc_switch = 1;
14375 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14376 spec->adc_nids[0], spec->adc_nids[1]);
14383 * BIOS auto configuration
14385 static int alc269_parse_auto_config(struct hda_codec *codec)
14387 struct alc_spec *spec = codec->spec;
14389 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14391 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14396 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14399 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14403 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14405 alc_auto_parse_digital(codec);
14407 if (spec->kctls.list)
14408 add_mixer(spec, spec->kctls.list);
14410 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
14411 add_verb(spec, alc269vb_init_verbs);
14412 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14414 add_verb(spec, alc269_init_verbs);
14415 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14418 spec->num_mux_defs = 1;
14419 spec->input_mux = &spec->private_imux[0];
14421 if (!alc275_setup_dual_adc(codec))
14422 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14423 sizeof(alc269_adc_candidates));
14425 /* set default input source */
14426 if (!spec->dual_adc_switch)
14427 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14428 spec->input_mux->items[0].index);
14430 err = alc_auto_add_mic_boost(codec);
14434 if (!spec->cap_mixer && !spec->no_analog)
14435 set_capture_mixer(codec);
14440 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14441 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14442 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14445 /* init callback for auto-configuration model -- overriding the default init */
14446 static void alc269_auto_init(struct hda_codec *codec)
14448 struct alc_spec *spec = codec->spec;
14449 alc269_auto_init_multi_out(codec);
14450 alc269_auto_init_hp_out(codec);
14451 alc269_auto_init_analog_input(codec);
14452 alc_auto_init_digital(codec);
14453 if (spec->unsol_event)
14454 alc_inithook(codec);
14458 ALC269_FIXUP_SONY_VAIO,
14461 static const struct alc_fixup alc269_fixups[] = {
14462 [ALC269_FIXUP_SONY_VAIO] = {
14463 .verbs = (const struct hda_verb[]) {
14464 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14470 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14471 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14472 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14478 * configuration and preset
14480 static const char *alc269_models[ALC269_MODEL_LAST] = {
14481 [ALC269_BASIC] = "basic",
14482 [ALC269_QUANTA_FL1] = "quanta",
14483 [ALC269_AMIC] = "laptop-amic",
14484 [ALC269_DMIC] = "laptop-dmic",
14485 [ALC269_FUJITSU] = "fujitsu",
14486 [ALC269_LIFEBOOK] = "lifebook",
14487 [ALC269_AUTO] = "auto",
14490 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14491 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14492 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14493 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14495 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14496 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14497 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14498 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14499 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14500 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14501 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14502 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14503 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14504 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14505 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14506 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14507 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14508 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14509 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14510 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14511 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14512 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14513 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14514 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14515 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14516 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14517 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14518 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14519 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14520 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14521 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14522 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14523 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14524 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14525 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14526 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14527 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14528 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14529 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14530 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14531 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14533 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14535 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14536 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14537 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14538 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14539 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14540 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14541 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14542 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14543 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14544 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14548 static struct alc_config_preset alc269_presets[] = {
14550 .mixers = { alc269_base_mixer },
14551 .init_verbs = { alc269_init_verbs },
14552 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14553 .dac_nids = alc269_dac_nids,
14555 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14556 .channel_mode = alc269_modes,
14557 .input_mux = &alc269_capture_source,
14559 [ALC269_QUANTA_FL1] = {
14560 .mixers = { alc269_quanta_fl1_mixer },
14561 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14562 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14563 .dac_nids = alc269_dac_nids,
14565 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14566 .channel_mode = alc269_modes,
14567 .input_mux = &alc269_capture_source,
14568 .unsol_event = alc269_quanta_fl1_unsol_event,
14569 .setup = alc269_quanta_fl1_setup,
14570 .init_hook = alc269_quanta_fl1_init_hook,
14573 .mixers = { alc269_laptop_mixer },
14574 .cap_mixer = alc269_laptop_analog_capture_mixer,
14575 .init_verbs = { alc269_init_verbs,
14576 alc269_laptop_amic_init_verbs },
14577 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14578 .dac_nids = alc269_dac_nids,
14580 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14581 .channel_mode = alc269_modes,
14582 .unsol_event = alc269_laptop_unsol_event,
14583 .setup = alc269_laptop_amic_setup,
14584 .init_hook = alc269_laptop_inithook,
14587 .mixers = { alc269_laptop_mixer },
14588 .cap_mixer = alc269_laptop_digital_capture_mixer,
14589 .init_verbs = { alc269_init_verbs,
14590 alc269_laptop_dmic_init_verbs },
14591 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14592 .dac_nids = alc269_dac_nids,
14594 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14595 .channel_mode = alc269_modes,
14596 .unsol_event = alc269_laptop_unsol_event,
14597 .setup = alc269_laptop_dmic_setup,
14598 .init_hook = alc269_laptop_inithook,
14600 [ALC269VB_AMIC] = {
14601 .mixers = { alc269vb_laptop_mixer },
14602 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14603 .init_verbs = { alc269vb_init_verbs,
14604 alc269vb_laptop_amic_init_verbs },
14605 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14606 .dac_nids = alc269_dac_nids,
14608 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14609 .channel_mode = alc269_modes,
14610 .unsol_event = alc269_laptop_unsol_event,
14611 .setup = alc269vb_laptop_amic_setup,
14612 .init_hook = alc269_laptop_inithook,
14614 [ALC269VB_DMIC] = {
14615 .mixers = { alc269vb_laptop_mixer },
14616 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14617 .init_verbs = { alc269vb_init_verbs,
14618 alc269vb_laptop_dmic_init_verbs },
14619 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14620 .dac_nids = alc269_dac_nids,
14622 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14623 .channel_mode = alc269_modes,
14624 .unsol_event = alc269_laptop_unsol_event,
14625 .setup = alc269vb_laptop_dmic_setup,
14626 .init_hook = alc269_laptop_inithook,
14628 [ALC269_FUJITSU] = {
14629 .mixers = { alc269_fujitsu_mixer },
14630 .cap_mixer = alc269_laptop_digital_capture_mixer,
14631 .init_verbs = { alc269_init_verbs,
14632 alc269_laptop_dmic_init_verbs },
14633 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14634 .dac_nids = alc269_dac_nids,
14636 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14637 .channel_mode = alc269_modes,
14638 .unsol_event = alc269_laptop_unsol_event,
14639 .setup = alc269_laptop_dmic_setup,
14640 .init_hook = alc269_laptop_inithook,
14642 [ALC269_LIFEBOOK] = {
14643 .mixers = { alc269_lifebook_mixer },
14644 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14645 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14646 .dac_nids = alc269_dac_nids,
14648 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14649 .channel_mode = alc269_modes,
14650 .input_mux = &alc269_capture_source,
14651 .unsol_event = alc269_lifebook_unsol_event,
14652 .init_hook = alc269_lifebook_init_hook,
14655 .mixers = { alc269_asus_mixer },
14656 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14657 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
14658 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14659 .dac_nids = alc269_dac_nids,
14660 .adc_nids = alc262_dmic_adc_nids,
14661 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
14662 .capsrc_nids = alc262_dmic_capsrc_nids,
14663 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14664 .channel_mode = alc269_modes,
14665 .input_mux = &alc269_capture_source,
14666 .dig_out_nid = ALC880_DIGOUT_NID,
14667 .unsol_event = alc_sku_unsol_event,
14668 .setup = alc269vb_laptop_dmic_setup,
14669 .init_hook = alc_inithook,
14673 static int patch_alc269(struct hda_codec *codec)
14675 struct alc_spec *spec;
14678 int is_alc269vb = 0;
14680 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14684 codec->spec = spec;
14686 alc_auto_parse_customize_define(codec);
14688 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
14689 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
14690 spec->cdefine.platform_type == 1)
14691 alc_codec_rename(codec, "ALC271X");
14693 alc_codec_rename(codec, "ALC259");
14696 alc_fix_pll_init(codec, 0x20, 0x04, 15);
14698 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
14702 if (board_config < 0) {
14703 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14705 board_config = ALC269_AUTO;
14708 if (board_config == ALC269_AUTO)
14709 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
14711 if (board_config == ALC269_AUTO) {
14712 /* automatic parse from the BIOS config */
14713 err = alc269_parse_auto_config(codec);
14719 "hda_codec: Cannot set up configuration "
14720 "from BIOS. Using base mode...\n");
14721 board_config = ALC269_BASIC;
14725 if (has_cdefine_beep(codec)) {
14726 err = snd_hda_attach_beep_device(codec, 0x1);
14733 if (board_config != ALC269_AUTO)
14734 setup_preset(codec, &alc269_presets[board_config]);
14736 if (board_config == ALC269_QUANTA_FL1) {
14737 /* Due to a hardware problem on Lenovo Ideadpad, we need to
14738 * fix the sample rate of analog I/O to 44.1kHz
14740 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14741 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14742 } else if (spec->dual_adc_switch) {
14743 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14744 /* switch ADC dynamically */
14745 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14747 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14748 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14750 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14751 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14753 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14754 if (!is_alc269vb) {
14755 spec->adc_nids = alc269_adc_nids;
14756 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14757 spec->capsrc_nids = alc269_capsrc_nids;
14759 spec->adc_nids = alc269vb_adc_nids;
14760 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14761 spec->capsrc_nids = alc269vb_capsrc_nids;
14765 if (!spec->cap_mixer)
14766 set_capture_mixer(codec);
14767 if (has_cdefine_beep(codec))
14768 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14770 if (board_config == ALC269_AUTO)
14771 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
14773 spec->vmaster_nid = 0x02;
14775 codec->patch_ops = alc_patch_ops;
14776 if (board_config == ALC269_AUTO)
14777 spec->init_hook = alc269_auto_init;
14778 #ifdef CONFIG_SND_HDA_POWER_SAVE
14779 if (!spec->loopback.amplist)
14780 spec->loopback.amplist = alc269_loopbacks;
14781 if (alc269_mic2_for_mute_led(codec))
14782 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
14789 * ALC861 channel source setting (2/6 channel selection for 3-stack)
14793 * set the path ways for 2 channel output
14794 * need to set the codec line out and mic 1 pin widgets to inputs
14796 static struct hda_verb alc861_threestack_ch2_init[] = {
14797 /* set pin widget 1Ah (line in) for input */
14798 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14799 /* set pin widget 18h (mic1/2) for input, for mic also enable
14802 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14804 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14806 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14807 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14813 * need to set the codec line out and mic 1 pin widgets to outputs
14815 static struct hda_verb alc861_threestack_ch6_init[] = {
14816 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14817 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14818 /* set pin widget 18h (mic1) for output (CLFE)*/
14819 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14821 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14822 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14824 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14826 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14827 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14832 static struct hda_channel_mode alc861_threestack_modes[2] = {
14833 { 2, alc861_threestack_ch2_init },
14834 { 6, alc861_threestack_ch6_init },
14836 /* Set mic1 as input and unmute the mixer */
14837 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14838 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14839 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14842 /* Set mic1 as output and mute mixer */
14843 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14844 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14845 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14849 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14850 { 2, alc861_uniwill_m31_ch2_init },
14851 { 4, alc861_uniwill_m31_ch4_init },
14854 /* Set mic1 and line-in as input and unmute the mixer */
14855 static struct hda_verb alc861_asus_ch2_init[] = {
14856 /* set pin widget 1Ah (line in) for input */
14857 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14858 /* set pin widget 18h (mic1/2) for input, for mic also enable
14861 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14863 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14865 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14866 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14870 /* Set mic1 nad line-in as output and mute mixer */
14871 static struct hda_verb alc861_asus_ch6_init[] = {
14872 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14873 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14874 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14875 /* set pin widget 18h (mic1) for output (CLFE)*/
14876 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14877 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14878 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14879 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14881 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14883 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14884 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14889 static struct hda_channel_mode alc861_asus_modes[2] = {
14890 { 2, alc861_asus_ch2_init },
14891 { 6, alc861_asus_ch6_init },
14896 static struct snd_kcontrol_new alc861_base_mixer[] = {
14897 /* output mixer control */
14898 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14899 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14900 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14901 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14902 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14904 /*Input mixer control */
14905 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14906 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14907 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14908 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14909 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14910 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14912 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14919 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14920 /* output mixer control */
14921 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14922 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14923 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14924 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14925 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14927 /* Input mixer control */
14928 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14929 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14930 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14931 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14932 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14933 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14934 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14935 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14936 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14937 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14940 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14941 .name = "Channel Mode",
14942 .info = alc_ch_mode_info,
14943 .get = alc_ch_mode_get,
14944 .put = alc_ch_mode_put,
14945 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14950 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14951 /* output mixer control */
14952 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14953 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14954 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14959 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14960 /* output mixer control */
14961 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14962 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14963 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14964 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14965 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14967 /* Input mixer control */
14968 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14969 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14970 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14971 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14972 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14973 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14974 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14975 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14977 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14980 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14981 .name = "Channel Mode",
14982 .info = alc_ch_mode_info,
14983 .get = alc_ch_mode_get,
14984 .put = alc_ch_mode_put,
14985 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14990 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14991 /* output mixer control */
14992 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14993 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14994 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14995 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14996 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14998 /* Input mixer control */
14999 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15000 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15001 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15002 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15003 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15004 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15006 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15007 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15011 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15012 .name = "Channel Mode",
15013 .info = alc_ch_mode_info,
15014 .get = alc_ch_mode_get,
15015 .put = alc_ch_mode_put,
15016 .private_value = ARRAY_SIZE(alc861_asus_modes),
15021 /* additional mixer */
15022 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15023 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15024 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15029 * generic initialization of ADC, input mixers and output mixers
15031 static struct hda_verb alc861_base_init_verbs[] = {
15033 * Unmute ADC0 and set the default input to mic-in
15035 /* port-A for surround (rear panel) */
15036 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15037 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15038 /* port-B for mic-in (rear panel) with vref */
15039 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15040 /* port-C for line-in (rear panel) */
15041 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15042 /* port-D for Front */
15043 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15044 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15045 /* port-E for HP out (front panel) */
15046 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15047 /* route front PCM to HP */
15048 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15049 /* port-F for mic-in (front panel) with vref */
15050 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15051 /* port-G for CLFE (rear panel) */
15052 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15053 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15054 /* port-H for side (rear panel) */
15055 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15056 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15058 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15059 /* route front mic to ADC1*/
15060 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15061 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15063 /* Unmute DAC0~3 & spdif out*/
15064 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15065 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15066 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15067 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15070 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15071 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15072 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15073 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15074 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15076 /* Unmute Stereo Mixer 15 */
15077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15078 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15079 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15082 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15083 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15084 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15085 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15086 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15088 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15089 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15090 /* hp used DAC 3 (Front) */
15091 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15092 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15097 static struct hda_verb alc861_threestack_init_verbs[] = {
15099 * Unmute ADC0 and set the default input to mic-in
15101 /* port-A for surround (rear panel) */
15102 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15103 /* port-B for mic-in (rear panel) with vref */
15104 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15105 /* port-C for line-in (rear panel) */
15106 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15107 /* port-D for Front */
15108 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15109 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15110 /* port-E for HP out (front panel) */
15111 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15112 /* route front PCM to HP */
15113 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15114 /* port-F for mic-in (front panel) with vref */
15115 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15116 /* port-G for CLFE (rear panel) */
15117 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15118 /* port-H for side (rear panel) */
15119 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15121 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15122 /* route front mic to ADC1*/
15123 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15124 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15125 /* Unmute DAC0~3 & spdif out*/
15126 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15127 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15128 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15129 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15132 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15133 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15134 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15135 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15136 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15138 /* Unmute Stereo Mixer 15 */
15139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15144 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15145 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15146 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15147 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15148 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15149 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15150 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15151 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15152 /* hp used DAC 3 (Front) */
15153 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15158 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15160 * Unmute ADC0 and set the default input to mic-in
15162 /* port-A for surround (rear panel) */
15163 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15164 /* port-B for mic-in (rear panel) with vref */
15165 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15166 /* port-C for line-in (rear panel) */
15167 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15168 /* port-D for Front */
15169 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15170 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15171 /* port-E for HP out (front panel) */
15172 /* this has to be set to VREF80 */
15173 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15174 /* route front PCM to HP */
15175 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15176 /* port-F for mic-in (front panel) with vref */
15177 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15178 /* port-G for CLFE (rear panel) */
15179 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15180 /* port-H for side (rear panel) */
15181 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15183 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15184 /* route front mic to ADC1*/
15185 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15186 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15187 /* Unmute DAC0~3 & spdif out*/
15188 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15189 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15190 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15191 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15192 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15194 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15195 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15196 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15197 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15198 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15200 /* Unmute Stereo Mixer 15 */
15201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15203 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15204 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15206 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15207 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15208 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15209 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15212 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15213 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15214 /* hp used DAC 3 (Front) */
15215 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15216 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15220 static struct hda_verb alc861_asus_init_verbs[] = {
15222 * Unmute ADC0 and set the default input to mic-in
15224 /* port-A for surround (rear panel)
15225 * according to codec#0 this is the HP jack
15227 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15228 /* route front PCM to HP */
15229 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15230 /* port-B for mic-in (rear panel) with vref */
15231 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15232 /* port-C for line-in (rear panel) */
15233 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15234 /* port-D for Front */
15235 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15236 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15237 /* port-E for HP out (front panel) */
15238 /* this has to be set to VREF80 */
15239 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15240 /* route front PCM to HP */
15241 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15242 /* port-F for mic-in (front panel) with vref */
15243 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15244 /* port-G for CLFE (rear panel) */
15245 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15246 /* port-H for side (rear panel) */
15247 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15249 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15250 /* route front mic to ADC1*/
15251 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15252 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15253 /* Unmute DAC0~3 & spdif out*/
15254 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15255 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15256 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15257 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15258 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15259 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15260 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15261 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15262 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15263 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15265 /* Unmute Stereo Mixer 15 */
15266 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15268 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15269 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15271 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15272 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15274 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15276 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15277 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15278 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15279 /* hp used DAC 3 (Front) */
15280 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15281 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15285 /* additional init verbs for ASUS laptops */
15286 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15287 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15288 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15293 * generic initialization of ADC, input mixers and output mixers
15295 static struct hda_verb alc861_auto_init_verbs[] = {
15297 * Unmute ADC0 and set the default input to mic-in
15299 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15300 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15302 /* Unmute DAC0~3 & spdif out*/
15303 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15304 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15305 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15306 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15309 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15310 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15311 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15312 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15313 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15315 /* Unmute Stereo Mixer 15 */
15316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15321 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15322 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15323 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15324 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15325 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15327 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15330 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15331 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15334 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15335 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15336 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15337 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15339 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15344 static struct hda_verb alc861_toshiba_init_verbs[] = {
15345 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15350 /* toggle speaker-output according to the hp-jack state */
15351 static void alc861_toshiba_automute(struct hda_codec *codec)
15353 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15355 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15356 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15357 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15358 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15361 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15364 if ((res >> 26) == ALC880_HP_EVENT)
15365 alc861_toshiba_automute(codec);
15368 /* pcm configuration: identical with ALC880 */
15369 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15370 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15371 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15372 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15375 #define ALC861_DIGOUT_NID 0x07
15377 static struct hda_channel_mode alc861_8ch_modes[1] = {
15381 static hda_nid_t alc861_dac_nids[4] = {
15382 /* front, surround, clfe, side */
15383 0x03, 0x06, 0x05, 0x04
15386 static hda_nid_t alc660_dac_nids[3] = {
15387 /* front, clfe, surround */
15391 static hda_nid_t alc861_adc_nids[1] = {
15396 static struct hda_input_mux alc861_capture_source = {
15400 { "Front Mic", 0x3 },
15407 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15409 struct alc_spec *spec = codec->spec;
15410 hda_nid_t mix, srcs[5];
15413 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15415 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15418 for (i = 0; i < num; i++) {
15420 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15421 if (type != AC_WID_AUD_OUT)
15423 for (j = 0; j < spec->multiout.num_dacs; j++)
15424 if (spec->multiout.dac_nids[j] == srcs[i])
15426 if (j >= spec->multiout.num_dacs)
15432 /* fill in the dac_nids table from the parsed pin configuration */
15433 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15434 const struct auto_pin_cfg *cfg)
15436 struct alc_spec *spec = codec->spec;
15438 hda_nid_t nid, dac;
15440 spec->multiout.dac_nids = spec->private_dac_nids;
15441 for (i = 0; i < cfg->line_outs; i++) {
15442 nid = cfg->line_out_pins[i];
15443 dac = alc861_look_for_dac(codec, nid);
15446 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15451 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15452 hda_nid_t nid, unsigned int chs)
15454 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15455 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15458 /* add playback controls from the parsed DAC table */
15459 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15460 const struct auto_pin_cfg *cfg)
15462 struct alc_spec *spec = codec->spec;
15463 static const char *chname[4] = {
15464 "Front", "Surround", NULL /*CLFE*/, "Side"
15469 if (cfg->line_outs == 1) {
15470 const char *pfx = NULL;
15473 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15476 nid = spec->multiout.dac_nids[0];
15477 return alc861_create_out_sw(codec, pfx, nid, 3);
15481 for (i = 0; i < cfg->line_outs; i++) {
15482 nid = spec->multiout.dac_nids[i];
15487 err = alc861_create_out_sw(codec, "Center", nid, 1);
15490 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15494 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15502 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15504 struct alc_spec *spec = codec->spec;
15511 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15512 nid = alc861_look_for_dac(codec, pin);
15514 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15517 spec->multiout.hp_nid = nid;
15523 /* create playback/capture controls for input pins */
15524 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15525 const struct auto_pin_cfg *cfg)
15527 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15530 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15532 int pin_type, hda_nid_t dac)
15534 hda_nid_t mix, srcs[5];
15537 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15539 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15541 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15543 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15546 for (i = 0; i < num; i++) {
15548 if (srcs[i] == dac || srcs[i] == 0x15)
15549 mute = AMP_IN_UNMUTE(i);
15551 mute = AMP_IN_MUTE(i);
15552 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15557 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15559 struct alc_spec *spec = codec->spec;
15562 for (i = 0; i < spec->autocfg.line_outs; i++) {
15563 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15564 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15566 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15567 spec->multiout.dac_nids[i]);
15571 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15573 struct alc_spec *spec = codec->spec;
15575 if (spec->autocfg.hp_outs)
15576 alc861_auto_set_output_and_unmute(codec,
15577 spec->autocfg.hp_pins[0],
15579 spec->multiout.hp_nid);
15580 if (spec->autocfg.speaker_outs)
15581 alc861_auto_set_output_and_unmute(codec,
15582 spec->autocfg.speaker_pins[0],
15584 spec->multiout.dac_nids[0]);
15587 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15589 struct alc_spec *spec = codec->spec;
15590 struct auto_pin_cfg *cfg = &spec->autocfg;
15593 for (i = 0; i < cfg->num_inputs; i++) {
15594 hda_nid_t nid = cfg->inputs[i].pin;
15595 if (nid >= 0x0c && nid <= 0x11)
15596 alc_set_input_pin(codec, nid, i);
15600 /* parse the BIOS configuration and set up the alc_spec */
15601 /* return 1 if successful, 0 if the proper config is not found,
15602 * or a negative error code
15604 static int alc861_parse_auto_config(struct hda_codec *codec)
15606 struct alc_spec *spec = codec->spec;
15608 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15610 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15614 if (!spec->autocfg.line_outs)
15615 return 0; /* can't find valid BIOS pin config */
15617 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15620 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15623 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15626 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15630 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15632 alc_auto_parse_digital(codec);
15634 if (spec->kctls.list)
15635 add_mixer(spec, spec->kctls.list);
15637 add_verb(spec, alc861_auto_init_verbs);
15639 spec->num_mux_defs = 1;
15640 spec->input_mux = &spec->private_imux[0];
15642 spec->adc_nids = alc861_adc_nids;
15643 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15644 set_capture_mixer(codec);
15646 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15651 /* additional initialization for auto-configuration model */
15652 static void alc861_auto_init(struct hda_codec *codec)
15654 struct alc_spec *spec = codec->spec;
15655 alc861_auto_init_multi_out(codec);
15656 alc861_auto_init_hp_out(codec);
15657 alc861_auto_init_analog_input(codec);
15658 alc_auto_init_digital(codec);
15659 if (spec->unsol_event)
15660 alc_inithook(codec);
15663 #ifdef CONFIG_SND_HDA_POWER_SAVE
15664 static struct hda_amp_list alc861_loopbacks[] = {
15665 { 0x15, HDA_INPUT, 0 },
15666 { 0x15, HDA_INPUT, 1 },
15667 { 0x15, HDA_INPUT, 2 },
15668 { 0x15, HDA_INPUT, 3 },
15675 * configuration and preset
15677 static const char *alc861_models[ALC861_MODEL_LAST] = {
15678 [ALC861_3ST] = "3stack",
15679 [ALC660_3ST] = "3stack-660",
15680 [ALC861_3ST_DIG] = "3stack-dig",
15681 [ALC861_6ST_DIG] = "6stack-dig",
15682 [ALC861_UNIWILL_M31] = "uniwill-m31",
15683 [ALC861_TOSHIBA] = "toshiba",
15684 [ALC861_ASUS] = "asus",
15685 [ALC861_ASUS_LAPTOP] = "asus-laptop",
15686 [ALC861_AUTO] = "auto",
15689 static struct snd_pci_quirk alc861_cfg_tbl[] = {
15690 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
15691 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15692 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
15693 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
15694 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
15695 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
15696 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
15697 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
15698 * Any other models that need this preset?
15700 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
15701 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
15702 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
15703 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
15704 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
15705 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
15706 /* FIXME: the below seems conflict */
15707 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
15708 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
15709 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
15713 static struct alc_config_preset alc861_presets[] = {
15715 .mixers = { alc861_3ST_mixer },
15716 .init_verbs = { alc861_threestack_init_verbs },
15717 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15718 .dac_nids = alc861_dac_nids,
15719 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15720 .channel_mode = alc861_threestack_modes,
15722 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15723 .adc_nids = alc861_adc_nids,
15724 .input_mux = &alc861_capture_source,
15726 [ALC861_3ST_DIG] = {
15727 .mixers = { alc861_base_mixer },
15728 .init_verbs = { alc861_threestack_init_verbs },
15729 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15730 .dac_nids = alc861_dac_nids,
15731 .dig_out_nid = ALC861_DIGOUT_NID,
15732 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15733 .channel_mode = alc861_threestack_modes,
15735 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15736 .adc_nids = alc861_adc_nids,
15737 .input_mux = &alc861_capture_source,
15739 [ALC861_6ST_DIG] = {
15740 .mixers = { alc861_base_mixer },
15741 .init_verbs = { alc861_base_init_verbs },
15742 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15743 .dac_nids = alc861_dac_nids,
15744 .dig_out_nid = ALC861_DIGOUT_NID,
15745 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
15746 .channel_mode = alc861_8ch_modes,
15747 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15748 .adc_nids = alc861_adc_nids,
15749 .input_mux = &alc861_capture_source,
15752 .mixers = { alc861_3ST_mixer },
15753 .init_verbs = { alc861_threestack_init_verbs },
15754 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
15755 .dac_nids = alc660_dac_nids,
15756 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
15757 .channel_mode = alc861_threestack_modes,
15759 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15760 .adc_nids = alc861_adc_nids,
15761 .input_mux = &alc861_capture_source,
15763 [ALC861_UNIWILL_M31] = {
15764 .mixers = { alc861_uniwill_m31_mixer },
15765 .init_verbs = { alc861_uniwill_m31_init_verbs },
15766 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15767 .dac_nids = alc861_dac_nids,
15768 .dig_out_nid = ALC861_DIGOUT_NID,
15769 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
15770 .channel_mode = alc861_uniwill_m31_modes,
15772 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15773 .adc_nids = alc861_adc_nids,
15774 .input_mux = &alc861_capture_source,
15776 [ALC861_TOSHIBA] = {
15777 .mixers = { alc861_toshiba_mixer },
15778 .init_verbs = { alc861_base_init_verbs,
15779 alc861_toshiba_init_verbs },
15780 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15781 .dac_nids = alc861_dac_nids,
15782 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15783 .channel_mode = alc883_3ST_2ch_modes,
15784 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15785 .adc_nids = alc861_adc_nids,
15786 .input_mux = &alc861_capture_source,
15787 .unsol_event = alc861_toshiba_unsol_event,
15788 .init_hook = alc861_toshiba_automute,
15791 .mixers = { alc861_asus_mixer },
15792 .init_verbs = { alc861_asus_init_verbs },
15793 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15794 .dac_nids = alc861_dac_nids,
15795 .dig_out_nid = ALC861_DIGOUT_NID,
15796 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
15797 .channel_mode = alc861_asus_modes,
15800 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15801 .adc_nids = alc861_adc_nids,
15802 .input_mux = &alc861_capture_source,
15804 [ALC861_ASUS_LAPTOP] = {
15805 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
15806 .init_verbs = { alc861_asus_init_verbs,
15807 alc861_asus_laptop_init_verbs },
15808 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
15809 .dac_nids = alc861_dac_nids,
15810 .dig_out_nid = ALC861_DIGOUT_NID,
15811 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
15812 .channel_mode = alc883_3ST_2ch_modes,
15814 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
15815 .adc_nids = alc861_adc_nids,
15816 .input_mux = &alc861_capture_source,
15820 /* Pin config fixes */
15822 PINFIX_FSC_AMILO_PI1505,
15825 static const struct alc_fixup alc861_fixups[] = {
15826 [PINFIX_FSC_AMILO_PI1505] = {
15827 .pins = (const struct alc_pincfg[]) {
15828 { 0x0b, 0x0221101f }, /* HP */
15829 { 0x0f, 0x90170310 }, /* speaker */
15835 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15836 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15840 static int patch_alc861(struct hda_codec *codec)
15842 struct alc_spec *spec;
15846 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15850 codec->spec = spec;
15852 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15856 if (board_config < 0) {
15857 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15859 board_config = ALC861_AUTO;
15862 if (board_config == ALC861_AUTO)
15863 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
15865 if (board_config == ALC861_AUTO) {
15866 /* automatic parse from the BIOS config */
15867 err = alc861_parse_auto_config(codec);
15873 "hda_codec: Cannot set up configuration "
15874 "from BIOS. Using base mode...\n");
15875 board_config = ALC861_3ST_DIG;
15879 err = snd_hda_attach_beep_device(codec, 0x23);
15885 if (board_config != ALC861_AUTO)
15886 setup_preset(codec, &alc861_presets[board_config]);
15888 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15889 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15891 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15892 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15894 if (!spec->cap_mixer)
15895 set_capture_mixer(codec);
15896 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15898 spec->vmaster_nid = 0x03;
15900 if (board_config == ALC861_AUTO)
15901 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
15903 codec->patch_ops = alc_patch_ops;
15904 if (board_config == ALC861_AUTO) {
15905 spec->init_hook = alc861_auto_init;
15906 #ifdef CONFIG_SND_HDA_POWER_SAVE
15907 spec->power_hook = alc_power_eapd;
15910 #ifdef CONFIG_SND_HDA_POWER_SAVE
15911 if (!spec->loopback.amplist)
15912 spec->loopback.amplist = alc861_loopbacks;
15919 * ALC861-VD support
15923 * In addition, an independent DAC
15925 #define ALC861VD_DIGOUT_NID 0x06
15927 static hda_nid_t alc861vd_dac_nids[4] = {
15928 /* front, surr, clfe, side surr */
15929 0x02, 0x03, 0x04, 0x05
15932 /* dac_nids for ALC660vd are in a different order - according to
15933 * Realtek's driver.
15934 * This should probably result in a different mixer for 6stack models
15935 * of ALC660vd codecs, but for now there is only 3stack mixer
15936 * - and it is the same as in 861vd.
15937 * adc_nids in ALC660vd are (is) the same as in 861vd
15939 static hda_nid_t alc660vd_dac_nids[3] = {
15940 /* front, rear, clfe, rear_surr */
15944 static hda_nid_t alc861vd_adc_nids[1] = {
15949 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15952 /* FIXME: should be a matrix-type input source selection */
15953 static struct hda_input_mux alc861vd_capture_source = {
15957 { "Front Mic", 0x1 },
15963 static struct hda_input_mux alc861vd_dallas_capture_source = {
15966 { "Ext Mic", 0x0 },
15967 { "Int Mic", 0x1 },
15971 static struct hda_input_mux alc861vd_hp_capture_source = {
15974 { "Front Mic", 0x0 },
15975 { "ATAPI Mic", 0x1 },
15982 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15989 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15990 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15991 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15992 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15993 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16000 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16001 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16002 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16003 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16004 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16008 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16009 { 6, alc861vd_6stack_ch6_init },
16010 { 8, alc861vd_6stack_ch8_init },
16013 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16015 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16016 .name = "Channel Mode",
16017 .info = alc_ch_mode_info,
16018 .get = alc_ch_mode_get,
16019 .put = alc_ch_mode_put,
16024 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16025 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16027 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16028 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16031 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16032 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16034 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16036 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16038 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16039 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16041 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16042 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16046 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16050 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16051 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16052 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16054 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16055 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16057 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16058 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16063 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16064 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16065 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16073 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16074 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16081 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16086 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16087 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16088 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16089 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16091 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16093 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16097 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16098 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16099 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16101 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16102 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16107 /* Pin assignment: Speaker=0x14, HP = 0x15,
16108 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16110 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16111 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16112 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16114 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16115 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16116 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16117 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16118 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16119 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16120 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16124 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16125 * Front Mic=0x18, ATAPI Mic = 0x19,
16127 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16128 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16129 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16130 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16131 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16132 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16133 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16134 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16135 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16141 * generic initialization of ADC, input mixers and output mixers
16143 static struct hda_verb alc861vd_volume_init_verbs[] = {
16145 * Unmute ADC0 and set the default input to mic-in
16147 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16150 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16151 * the analog-loopback mixer widget
16153 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16157 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16158 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16160 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16161 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16162 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16167 * Set up output mixers (0x02 - 0x05)
16169 /* set vol=0 to output mixers */
16170 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16171 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16172 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16173 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16175 /* set up input amps for analog loopback */
16176 /* Amp Indices: DAC = 0, mixer = 1 */
16177 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16179 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16181 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16182 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16183 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16190 * 3-stack pin configuration:
16191 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16193 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16195 * Set pin mode and muting
16197 /* set front pin widgets 0x14 for output */
16198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16199 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16200 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16202 /* Mic (rear) pin: input vref at 80% */
16203 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16204 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16205 /* Front Mic pin: input vref at 80% */
16206 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16207 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16208 /* Line In pin: input */
16209 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16210 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16211 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16212 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16213 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16214 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16215 /* CD pin widget for input */
16216 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16222 * 6-stack pin configuration:
16224 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16226 * Set pin mode and muting
16228 /* set front pin widgets 0x14 for output */
16229 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16230 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16231 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16233 /* Rear Pin: output 1 (0x0d) */
16234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16235 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16237 /* CLFE Pin: output 2 (0x0e) */
16238 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16239 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16240 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16241 /* Side Pin: output 3 (0x0f) */
16242 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16243 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16244 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16246 /* Mic (rear) pin: input vref at 80% */
16247 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16249 /* Front Mic pin: input vref at 80% */
16250 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16252 /* Line In pin: input */
16253 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16254 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16255 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16256 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16257 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16258 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16259 /* CD pin widget for input */
16260 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16265 static struct hda_verb alc861vd_eapd_verbs[] = {
16266 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16270 static struct hda_verb alc660vd_eapd_verbs[] = {
16271 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16272 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16276 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16280 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16281 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16285 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16287 unsigned int present;
16288 unsigned char bits;
16290 present = snd_hda_jack_detect(codec, 0x18);
16291 bits = present ? HDA_AMP_MUTE : 0;
16293 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16294 HDA_AMP_MUTE, bits);
16297 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16299 struct alc_spec *spec = codec->spec;
16300 spec->autocfg.hp_pins[0] = 0x1b;
16301 spec->autocfg.speaker_pins[0] = 0x14;
16304 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16306 alc_automute_amp(codec);
16307 alc861vd_lenovo_mic_automute(codec);
16310 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16313 switch (res >> 26) {
16314 case ALC880_MIC_EVENT:
16315 alc861vd_lenovo_mic_automute(codec);
16318 alc_automute_amp_unsol_event(codec, res);
16323 static struct hda_verb alc861vd_dallas_verbs[] = {
16324 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16325 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16326 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16327 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16331 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16335 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16336 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16341 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16343 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16344 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16345 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16349 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16350 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16351 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16352 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16353 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16354 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16356 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16358 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16359 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16361 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16362 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16368 /* toggle speaker-output according to the hp-jack state */
16369 static void alc861vd_dallas_setup(struct hda_codec *codec)
16371 struct alc_spec *spec = codec->spec;
16373 spec->autocfg.hp_pins[0] = 0x15;
16374 spec->autocfg.speaker_pins[0] = 0x14;
16377 #ifdef CONFIG_SND_HDA_POWER_SAVE
16378 #define alc861vd_loopbacks alc880_loopbacks
16381 /* pcm configuration: identical with ALC880 */
16382 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16383 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16384 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16385 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16388 * configuration and preset
16390 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16391 [ALC660VD_3ST] = "3stack-660",
16392 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16393 [ALC660VD_ASUS_V1S] = "asus-v1s",
16394 [ALC861VD_3ST] = "3stack",
16395 [ALC861VD_3ST_DIG] = "3stack-digout",
16396 [ALC861VD_6ST_DIG] = "6stack-digout",
16397 [ALC861VD_LENOVO] = "lenovo",
16398 [ALC861VD_DALLAS] = "dallas",
16399 [ALC861VD_HP] = "hp",
16400 [ALC861VD_AUTO] = "auto",
16403 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16404 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16405 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16406 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16407 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16408 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16409 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16410 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16411 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16412 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16413 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16414 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16415 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16416 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16417 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16418 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16422 static struct alc_config_preset alc861vd_presets[] = {
16424 .mixers = { alc861vd_3st_mixer },
16425 .init_verbs = { alc861vd_volume_init_verbs,
16426 alc861vd_3stack_init_verbs },
16427 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16428 .dac_nids = alc660vd_dac_nids,
16429 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16430 .channel_mode = alc861vd_3stack_2ch_modes,
16431 .input_mux = &alc861vd_capture_source,
16433 [ALC660VD_3ST_DIG] = {
16434 .mixers = { alc861vd_3st_mixer },
16435 .init_verbs = { alc861vd_volume_init_verbs,
16436 alc861vd_3stack_init_verbs },
16437 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16438 .dac_nids = alc660vd_dac_nids,
16439 .dig_out_nid = ALC861VD_DIGOUT_NID,
16440 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16441 .channel_mode = alc861vd_3stack_2ch_modes,
16442 .input_mux = &alc861vd_capture_source,
16445 .mixers = { alc861vd_3st_mixer },
16446 .init_verbs = { alc861vd_volume_init_verbs,
16447 alc861vd_3stack_init_verbs },
16448 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16449 .dac_nids = alc861vd_dac_nids,
16450 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16451 .channel_mode = alc861vd_3stack_2ch_modes,
16452 .input_mux = &alc861vd_capture_source,
16454 [ALC861VD_3ST_DIG] = {
16455 .mixers = { alc861vd_3st_mixer },
16456 .init_verbs = { alc861vd_volume_init_verbs,
16457 alc861vd_3stack_init_verbs },
16458 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16459 .dac_nids = alc861vd_dac_nids,
16460 .dig_out_nid = ALC861VD_DIGOUT_NID,
16461 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16462 .channel_mode = alc861vd_3stack_2ch_modes,
16463 .input_mux = &alc861vd_capture_source,
16465 [ALC861VD_6ST_DIG] = {
16466 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16467 .init_verbs = { alc861vd_volume_init_verbs,
16468 alc861vd_6stack_init_verbs },
16469 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16470 .dac_nids = alc861vd_dac_nids,
16471 .dig_out_nid = ALC861VD_DIGOUT_NID,
16472 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16473 .channel_mode = alc861vd_6stack_modes,
16474 .input_mux = &alc861vd_capture_source,
16476 [ALC861VD_LENOVO] = {
16477 .mixers = { alc861vd_lenovo_mixer },
16478 .init_verbs = { alc861vd_volume_init_verbs,
16479 alc861vd_3stack_init_verbs,
16480 alc861vd_eapd_verbs,
16481 alc861vd_lenovo_unsol_verbs },
16482 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16483 .dac_nids = alc660vd_dac_nids,
16484 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16485 .channel_mode = alc861vd_3stack_2ch_modes,
16486 .input_mux = &alc861vd_capture_source,
16487 .unsol_event = alc861vd_lenovo_unsol_event,
16488 .setup = alc861vd_lenovo_setup,
16489 .init_hook = alc861vd_lenovo_init_hook,
16491 [ALC861VD_DALLAS] = {
16492 .mixers = { alc861vd_dallas_mixer },
16493 .init_verbs = { alc861vd_dallas_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_dallas_capture_source,
16499 .unsol_event = alc_automute_amp_unsol_event,
16500 .setup = alc861vd_dallas_setup,
16501 .init_hook = alc_automute_amp,
16504 .mixers = { alc861vd_hp_mixer },
16505 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16506 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16507 .dac_nids = alc861vd_dac_nids,
16508 .dig_out_nid = ALC861VD_DIGOUT_NID,
16509 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16510 .channel_mode = alc861vd_3stack_2ch_modes,
16511 .input_mux = &alc861vd_hp_capture_source,
16512 .unsol_event = alc_automute_amp_unsol_event,
16513 .setup = alc861vd_dallas_setup,
16514 .init_hook = alc_automute_amp,
16516 [ALC660VD_ASUS_V1S] = {
16517 .mixers = { alc861vd_lenovo_mixer },
16518 .init_verbs = { alc861vd_volume_init_verbs,
16519 alc861vd_3stack_init_verbs,
16520 alc861vd_eapd_verbs,
16521 alc861vd_lenovo_unsol_verbs },
16522 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16523 .dac_nids = alc660vd_dac_nids,
16524 .dig_out_nid = ALC861VD_DIGOUT_NID,
16525 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16526 .channel_mode = alc861vd_3stack_2ch_modes,
16527 .input_mux = &alc861vd_capture_source,
16528 .unsol_event = alc861vd_lenovo_unsol_event,
16529 .setup = alc861vd_lenovo_setup,
16530 .init_hook = alc861vd_lenovo_init_hook,
16535 * BIOS auto configuration
16537 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16538 const struct auto_pin_cfg *cfg)
16540 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16544 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16545 hda_nid_t nid, int pin_type, int dac_idx)
16547 alc_set_pin_output(codec, nid, pin_type);
16550 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16552 struct alc_spec *spec = codec->spec;
16555 for (i = 0; i <= HDA_SIDE; i++) {
16556 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16557 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16559 alc861vd_auto_set_output_and_unmute(codec, nid,
16565 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16567 struct alc_spec *spec = codec->spec;
16570 pin = spec->autocfg.hp_pins[0];
16571 if (pin) /* connect to front and use dac 0 */
16572 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16573 pin = spec->autocfg.speaker_pins[0];
16575 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16578 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16580 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16582 struct alc_spec *spec = codec->spec;
16583 struct auto_pin_cfg *cfg = &spec->autocfg;
16586 for (i = 0; i < cfg->num_inputs; i++) {
16587 hda_nid_t nid = cfg->inputs[i].pin;
16588 if (alc_is_input_pin(codec, nid)) {
16589 alc_set_input_pin(codec, nid, i);
16590 if (nid != ALC861VD_PIN_CD_NID &&
16591 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16592 snd_hda_codec_write(codec, nid, 0,
16593 AC_VERB_SET_AMP_GAIN_MUTE,
16599 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16601 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16602 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16604 /* add playback controls from the parsed DAC table */
16605 /* Based on ALC880 version. But ALC861VD has separate,
16606 * different NIDs for mute/unmute switch and volume control */
16607 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16608 const struct auto_pin_cfg *cfg)
16610 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16611 hda_nid_t nid_v, nid_s;
16614 for (i = 0; i < cfg->line_outs; i++) {
16615 if (!spec->multiout.dac_nids[i])
16617 nid_v = alc861vd_idx_to_mixer_vol(
16619 spec->multiout.dac_nids[i]));
16620 nid_s = alc861vd_idx_to_mixer_switch(
16622 spec->multiout.dac_nids[i]));
16626 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16628 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16632 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16634 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16638 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16640 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16644 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16646 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
16652 if (cfg->line_outs == 1 &&
16653 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
16660 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16661 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
16665 if (cfg->line_outs == 1 &&
16666 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
16668 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16669 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
16678 /* add playback controls for speaker and HP outputs */
16679 /* Based on ALC880 version. But ALC861VD has separate,
16680 * different NIDs for mute/unmute switch and volume control */
16681 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
16682 hda_nid_t pin, const char *pfx)
16684 hda_nid_t nid_v, nid_s;
16690 if (alc880_is_fixed_pin(pin)) {
16691 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16692 /* specify the DAC as the extra output */
16693 if (!spec->multiout.hp_nid)
16694 spec->multiout.hp_nid = nid_v;
16696 spec->multiout.extra_out_nid[0] = nid_v;
16697 /* control HP volume/switch on the output mixer amp */
16698 nid_v = alc861vd_idx_to_mixer_vol(
16699 alc880_fixed_pin_idx(pin));
16700 nid_s = alc861vd_idx_to_mixer_switch(
16701 alc880_fixed_pin_idx(pin));
16703 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
16704 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
16707 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
16708 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
16711 } else if (alc880_is_multi_pin(pin)) {
16712 /* set manual connection */
16713 /* we have only a switch on HP-out PIN */
16714 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
16715 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16722 /* parse the BIOS configuration and set up the alc_spec
16723 * return 1 if successful, 0 if the proper config is not found,
16724 * or a negative error code
16725 * Based on ALC880 version - had to change it to override
16726 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
16727 static int alc861vd_parse_auto_config(struct hda_codec *codec)
16729 struct alc_spec *spec = codec->spec;
16731 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
16733 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16737 if (!spec->autocfg.line_outs)
16738 return 0; /* can't find valid BIOS pin config */
16740 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16743 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
16746 err = alc861vd_auto_create_extra_out(spec,
16747 spec->autocfg.speaker_pins[0],
16751 err = alc861vd_auto_create_extra_out(spec,
16752 spec->autocfg.hp_pins[0],
16756 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
16760 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16762 alc_auto_parse_digital(codec);
16764 if (spec->kctls.list)
16765 add_mixer(spec, spec->kctls.list);
16767 add_verb(spec, alc861vd_volume_init_verbs);
16769 spec->num_mux_defs = 1;
16770 spec->input_mux = &spec->private_imux[0];
16772 err = alc_auto_add_mic_boost(codec);
16776 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
16781 /* additional initialization for auto-configuration model */
16782 static void alc861vd_auto_init(struct hda_codec *codec)
16784 struct alc_spec *spec = codec->spec;
16785 alc861vd_auto_init_multi_out(codec);
16786 alc861vd_auto_init_hp_out(codec);
16787 alc861vd_auto_init_analog_input(codec);
16788 alc861vd_auto_init_input_src(codec);
16789 alc_auto_init_digital(codec);
16790 if (spec->unsol_event)
16791 alc_inithook(codec);
16795 ALC660VD_FIX_ASUS_GPIO1
16799 static const struct alc_fixup alc861vd_fixups[] = {
16800 [ALC660VD_FIX_ASUS_GPIO1] = {
16801 .verbs = (const struct hda_verb[]) {
16802 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
16803 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
16804 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
16810 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
16811 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
16815 static int patch_alc861vd(struct hda_codec *codec)
16817 struct alc_spec *spec;
16818 int err, board_config;
16820 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16824 codec->spec = spec;
16826 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16830 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16831 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16833 board_config = ALC861VD_AUTO;
16836 if (board_config == ALC861VD_AUTO)
16837 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
16839 if (board_config == ALC861VD_AUTO) {
16840 /* automatic parse from the BIOS config */
16841 err = alc861vd_parse_auto_config(codec);
16847 "hda_codec: Cannot set up configuration "
16848 "from BIOS. Using base mode...\n");
16849 board_config = ALC861VD_3ST;
16853 err = snd_hda_attach_beep_device(codec, 0x23);
16859 if (board_config != ALC861VD_AUTO)
16860 setup_preset(codec, &alc861vd_presets[board_config]);
16862 if (codec->vendor_id == 0x10ec0660) {
16863 /* always turn on EAPD */
16864 add_verb(spec, alc660vd_eapd_verbs);
16867 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16868 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16870 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16871 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16873 if (!spec->adc_nids) {
16874 spec->adc_nids = alc861vd_adc_nids;
16875 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16877 if (!spec->capsrc_nids)
16878 spec->capsrc_nids = alc861vd_capsrc_nids;
16880 set_capture_mixer(codec);
16881 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16883 spec->vmaster_nid = 0x02;
16885 if (board_config == ALC861VD_AUTO)
16886 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
16888 codec->patch_ops = alc_patch_ops;
16890 if (board_config == ALC861VD_AUTO)
16891 spec->init_hook = alc861vd_auto_init;
16892 #ifdef CONFIG_SND_HDA_POWER_SAVE
16893 if (!spec->loopback.amplist)
16894 spec->loopback.amplist = alc861vd_loopbacks;
16903 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16904 * configuration. Each pin widget can choose any input DACs and a mixer.
16905 * Each ADC is connected from a mixer of all inputs. This makes possible
16906 * 6-channel independent captures.
16908 * In addition, an independent DAC for the multi-playback (not used in this
16911 #define ALC662_DIGOUT_NID 0x06
16912 #define ALC662_DIGIN_NID 0x0a
16914 static hda_nid_t alc662_dac_nids[4] = {
16915 /* front, rear, clfe, rear_surr */
16919 static hda_nid_t alc272_dac_nids[2] = {
16923 static hda_nid_t alc662_adc_nids[2] = {
16928 static hda_nid_t alc272_adc_nids[1] = {
16933 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16934 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16938 /* FIXME: should be a matrix-type input source selection */
16939 static struct hda_input_mux alc662_capture_source = {
16943 { "Front Mic", 0x1 },
16949 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16957 static struct hda_input_mux alc663_capture_source = {
16961 { "Front Mic", 0x1 },
16966 #if 0 /* set to 1 for testing other input sources below */
16967 static struct hda_input_mux alc272_nc10_capture_source = {
16970 { "Autoselect Mic", 0x0 },
16971 { "Internal Mic", 0x1 },
16972 { "In-0x02", 0x2 },
16973 { "In-0x03", 0x3 },
16974 { "In-0x04", 0x4 },
16975 { "In-0x05", 0x5 },
16976 { "In-0x06", 0x6 },
16977 { "In-0x07", 0x7 },
16978 { "In-0x08", 0x8 },
16979 { "In-0x09", 0x9 },
16980 { "In-0x0a", 0x0a },
16981 { "In-0x0b", 0x0b },
16982 { "In-0x0c", 0x0c },
16983 { "In-0x0d", 0x0d },
16984 { "In-0x0e", 0x0e },
16985 { "In-0x0f", 0x0f },
16993 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17000 static struct hda_verb alc662_3ST_ch2_init[] = {
17001 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17002 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17003 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17004 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17011 static struct hda_verb alc662_3ST_ch6_init[] = {
17012 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17013 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17014 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17015 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17016 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17017 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17021 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17022 { 2, alc662_3ST_ch2_init },
17023 { 6, alc662_3ST_ch6_init },
17029 static struct hda_verb alc662_sixstack_ch6_init[] = {
17030 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17031 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17032 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17039 static struct hda_verb alc662_sixstack_ch8_init[] = {
17040 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17041 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17042 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17046 static struct hda_channel_mode alc662_5stack_modes[2] = {
17047 { 2, alc662_sixstack_ch6_init },
17048 { 6, alc662_sixstack_ch8_init },
17051 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17052 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17055 static struct snd_kcontrol_new alc662_base_mixer[] = {
17056 /* output mixer control */
17057 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17058 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17059 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17060 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17061 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17062 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17063 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17064 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17067 /*Input mixer control */
17068 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17069 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17070 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17071 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17072 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17073 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17074 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17079 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17080 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17081 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17082 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17083 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17084 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17085 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17086 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17089 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17090 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17094 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17095 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17096 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17097 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17098 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17099 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17100 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17101 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17102 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17115 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17116 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17117 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17118 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17119 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17128 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17129 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17130 ALC262_HIPPO_MASTER_SWITCH,
17132 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17133 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17134 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17136 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17137 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17138 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17142 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17143 ALC262_HIPPO_MASTER_SWITCH,
17144 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17145 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17146 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17147 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17148 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17149 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17150 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17156 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17157 .ops = &snd_hda_bind_vol,
17159 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17160 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17165 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17166 .ops = &snd_hda_bind_sw,
17168 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17169 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17174 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17175 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17176 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17182 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17183 .ops = &snd_hda_bind_sw,
17185 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17186 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17187 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17192 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17193 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17194 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17197 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17198 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17203 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17204 .ops = &snd_hda_bind_sw,
17206 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17207 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17208 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17213 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17214 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17215 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17218 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17219 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17223 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17227 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17228 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17229 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17230 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17234 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17235 .ops = &snd_hda_bind_vol,
17237 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17238 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17243 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17244 .ops = &snd_hda_bind_sw,
17246 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17247 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17252 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17253 HDA_BIND_VOL("Master Playback Volume",
17254 &alc663_asus_two_bind_master_vol),
17255 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17256 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17263 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17264 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17265 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17266 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17273 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17274 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17275 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17276 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17277 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17278 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17282 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17283 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17287 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17288 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17289 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17294 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17295 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17296 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17297 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17301 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17302 .ops = &snd_hda_bind_sw,
17304 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17305 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17306 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17307 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17308 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17313 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17314 .ops = &snd_hda_bind_sw,
17316 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17317 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17322 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17323 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17324 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17325 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17326 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17327 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17328 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17329 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17335 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17336 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17337 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17338 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17339 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17340 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17347 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17349 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17350 .name = "Channel Mode",
17351 .info = alc_ch_mode_info,
17352 .get = alc_ch_mode_get,
17353 .put = alc_ch_mode_put,
17358 static struct hda_verb alc662_init_verbs[] = {
17359 /* ADC: mute amp left and right */
17360 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17361 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17363 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17364 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17367 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17370 /* Front Pin: output 0 (0x0c) */
17371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17372 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17374 /* Rear Pin: output 1 (0x0d) */
17375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17378 /* CLFE Pin: output 2 (0x0e) */
17379 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17380 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17382 /* Mic (rear) pin: input vref at 80% */
17383 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17384 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17385 /* Front Mic pin: input vref at 80% */
17386 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17387 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17388 /* Line In pin: input */
17389 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17390 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17391 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17392 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17393 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17394 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17395 /* CD pin widget for input */
17396 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17398 /* FIXME: use matrix-type input source selection */
17399 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17404 /* always trun on EAPD */
17405 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17406 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17411 static struct hda_verb alc663_init_verbs[] = {
17412 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17413 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17414 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17415 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17416 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17421 static struct hda_verb alc272_init_verbs[] = {
17422 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17423 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17424 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17425 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17426 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17427 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17433 static struct hda_verb alc662_sue_init_verbs[] = {
17434 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17435 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17439 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17440 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17441 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17445 /* Set Unsolicited Event*/
17446 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17447 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17452 static struct hda_verb alc663_m51va_init_verbs[] = {
17453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17454 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17455 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17456 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17457 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17460 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17461 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17465 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17466 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17467 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17468 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17471 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17472 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17476 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17477 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17478 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17479 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17480 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17483 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17484 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17488 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17492 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17494 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17495 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17499 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
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, 0x0}, /* Headphone */
17504 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17505 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17506 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17507 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17509 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17510 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17511 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17515 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17516 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17517 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17518 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17519 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17522 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17525 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17526 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17527 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17531 static struct hda_verb alc663_g71v_init_verbs[] = {
17532 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17533 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17534 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17536 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17537 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17538 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17540 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17541 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17542 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17546 static struct hda_verb alc663_g50v_init_verbs[] = {
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, 0x00}, /* Headphone */
17551 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17552 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17556 static struct hda_verb alc662_ecs_init_verbs[] = {
17557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17559 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17560 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17564 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17565 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17566 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17568 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17569 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17570 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17571 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17574 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17575 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17579 static struct hda_verb alc272_dell_init_verbs[] = {
17580 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17581 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17583 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17584 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17585 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17586 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17589 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17590 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17594 static struct hda_verb alc663_mode7_init_verbs[] = {
17595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17596 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17597 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17598 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17599 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17600 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17601 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17602 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17603 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17604 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17607 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17608 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17609 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17613 static struct hda_verb alc663_mode8_init_verbs[] = {
17614 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17615 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17617 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17618 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17619 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17620 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17621 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17622 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17623 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17624 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17628 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17629 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17633 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17634 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17635 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17639 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17640 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17641 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17645 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17647 unsigned int present;
17648 unsigned char bits;
17650 present = snd_hda_jack_detect(codec, 0x14);
17651 bits = present ? HDA_AMP_MUTE : 0;
17653 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17654 HDA_AMP_MUTE, bits);
17657 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
17659 unsigned int present;
17660 unsigned char bits;
17662 present = snd_hda_jack_detect(codec, 0x1b);
17663 bits = present ? HDA_AMP_MUTE : 0;
17665 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17666 HDA_AMP_MUTE, bits);
17667 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17668 HDA_AMP_MUTE, bits);
17671 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
17674 if ((res >> 26) == ALC880_HP_EVENT)
17675 alc662_lenovo_101e_all_automute(codec);
17676 if ((res >> 26) == ALC880_FRONT_EVENT)
17677 alc662_lenovo_101e_ispeaker_automute(codec);
17680 /* unsolicited event for HP jack sensing */
17681 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
17684 if ((res >> 26) == ALC880_MIC_EVENT)
17685 alc_mic_automute(codec);
17687 alc262_hippo_unsol_event(codec, res);
17690 static void alc662_eeepc_setup(struct hda_codec *codec)
17692 struct alc_spec *spec = codec->spec;
17694 alc262_hippo1_setup(codec);
17695 spec->ext_mic.pin = 0x18;
17696 spec->ext_mic.mux_idx = 0;
17697 spec->int_mic.pin = 0x19;
17698 spec->int_mic.mux_idx = 1;
17699 spec->auto_mic = 1;
17702 static void alc662_eeepc_inithook(struct hda_codec *codec)
17704 alc262_hippo_automute(codec);
17705 alc_mic_automute(codec);
17708 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
17710 struct alc_spec *spec = codec->spec;
17712 spec->autocfg.hp_pins[0] = 0x14;
17713 spec->autocfg.speaker_pins[0] = 0x1b;
17716 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
17718 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17720 unsigned int present;
17721 unsigned char bits;
17723 present = snd_hda_jack_detect(codec, 0x21);
17724 bits = present ? HDA_AMP_MUTE : 0;
17725 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17726 HDA_AMP_MUTE, bits);
17727 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17728 HDA_AMP_MUTE, bits);
17731 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17733 unsigned int present;
17734 unsigned char bits;
17736 present = snd_hda_jack_detect(codec, 0x21);
17737 bits = present ? HDA_AMP_MUTE : 0;
17738 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17739 HDA_AMP_MUTE, bits);
17740 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17741 HDA_AMP_MUTE, bits);
17742 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17743 HDA_AMP_MUTE, bits);
17744 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17745 HDA_AMP_MUTE, bits);
17748 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17750 unsigned int present;
17751 unsigned char bits;
17753 present = snd_hda_jack_detect(codec, 0x15);
17754 bits = present ? HDA_AMP_MUTE : 0;
17755 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17756 HDA_AMP_MUTE, bits);
17757 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17758 HDA_AMP_MUTE, bits);
17759 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17760 HDA_AMP_MUTE, bits);
17761 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17762 HDA_AMP_MUTE, bits);
17765 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
17767 unsigned int present;
17768 unsigned char bits;
17770 present = snd_hda_jack_detect(codec, 0x1b);
17771 bits = present ? 0 : PIN_OUT;
17772 snd_hda_codec_write(codec, 0x14, 0,
17773 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
17776 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
17778 unsigned int present1, present2;
17780 present1 = snd_hda_jack_detect(codec, 0x21);
17781 present2 = snd_hda_jack_detect(codec, 0x15);
17783 if (present1 || present2) {
17784 snd_hda_codec_write_cache(codec, 0x14, 0,
17785 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17787 snd_hda_codec_write_cache(codec, 0x14, 0,
17788 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17792 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17794 unsigned int present1, present2;
17796 present1 = snd_hda_jack_detect(codec, 0x1b);
17797 present2 = snd_hda_jack_detect(codec, 0x15);
17799 if (present1 || present2) {
17800 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17801 HDA_AMP_MUTE, HDA_AMP_MUTE);
17802 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17803 HDA_AMP_MUTE, HDA_AMP_MUTE);
17805 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17807 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17812 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17814 unsigned int present1, present2;
17816 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17817 AC_VERB_GET_PIN_SENSE, 0)
17818 & AC_PINSENSE_PRESENCE;
17819 present2 = snd_hda_codec_read(codec, 0x21, 0,
17820 AC_VERB_GET_PIN_SENSE, 0)
17821 & AC_PINSENSE_PRESENCE;
17823 if (present1 || present2) {
17824 snd_hda_codec_write_cache(codec, 0x14, 0,
17825 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17826 snd_hda_codec_write_cache(codec, 0x17, 0,
17827 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17829 snd_hda_codec_write_cache(codec, 0x14, 0,
17830 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17831 snd_hda_codec_write_cache(codec, 0x17, 0,
17832 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17836 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17838 unsigned int present1, present2;
17840 present1 = snd_hda_codec_read(codec, 0x21, 0,
17841 AC_VERB_GET_PIN_SENSE, 0)
17842 & AC_PINSENSE_PRESENCE;
17843 present2 = snd_hda_codec_read(codec, 0x15, 0,
17844 AC_VERB_GET_PIN_SENSE, 0)
17845 & AC_PINSENSE_PRESENCE;
17847 if (present1 || present2) {
17848 snd_hda_codec_write_cache(codec, 0x14, 0,
17849 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17850 snd_hda_codec_write_cache(codec, 0x17, 0,
17851 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17853 snd_hda_codec_write_cache(codec, 0x14, 0,
17854 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17855 snd_hda_codec_write_cache(codec, 0x17, 0,
17856 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17860 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17863 switch (res >> 26) {
17864 case ALC880_HP_EVENT:
17865 alc663_m51va_speaker_automute(codec);
17867 case ALC880_MIC_EVENT:
17868 alc_mic_automute(codec);
17873 static void alc663_m51va_setup(struct hda_codec *codec)
17875 struct alc_spec *spec = codec->spec;
17876 spec->ext_mic.pin = 0x18;
17877 spec->ext_mic.mux_idx = 0;
17878 spec->int_mic.pin = 0x12;
17879 spec->int_mic.mux_idx = 9;
17880 spec->auto_mic = 1;
17883 static void alc663_m51va_inithook(struct hda_codec *codec)
17885 alc663_m51va_speaker_automute(codec);
17886 alc_mic_automute(codec);
17889 /* ***************** Mode1 ******************************/
17890 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17892 static void alc663_mode1_setup(struct hda_codec *codec)
17894 struct alc_spec *spec = codec->spec;
17895 spec->ext_mic.pin = 0x18;
17896 spec->ext_mic.mux_idx = 0;
17897 spec->int_mic.pin = 0x19;
17898 spec->int_mic.mux_idx = 1;
17899 spec->auto_mic = 1;
17902 #define alc663_mode1_inithook alc663_m51va_inithook
17904 /* ***************** Mode2 ******************************/
17905 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17908 switch (res >> 26) {
17909 case ALC880_HP_EVENT:
17910 alc662_f5z_speaker_automute(codec);
17912 case ALC880_MIC_EVENT:
17913 alc_mic_automute(codec);
17918 #define alc662_mode2_setup alc663_mode1_setup
17920 static void alc662_mode2_inithook(struct hda_codec *codec)
17922 alc662_f5z_speaker_automute(codec);
17923 alc_mic_automute(codec);
17925 /* ***************** Mode3 ******************************/
17926 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17929 switch (res >> 26) {
17930 case ALC880_HP_EVENT:
17931 alc663_two_hp_m1_speaker_automute(codec);
17933 case ALC880_MIC_EVENT:
17934 alc_mic_automute(codec);
17939 #define alc663_mode3_setup alc663_mode1_setup
17941 static void alc663_mode3_inithook(struct hda_codec *codec)
17943 alc663_two_hp_m1_speaker_automute(codec);
17944 alc_mic_automute(codec);
17946 /* ***************** Mode4 ******************************/
17947 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17950 switch (res >> 26) {
17951 case ALC880_HP_EVENT:
17952 alc663_21jd_two_speaker_automute(codec);
17954 case ALC880_MIC_EVENT:
17955 alc_mic_automute(codec);
17960 #define alc663_mode4_setup alc663_mode1_setup
17962 static void alc663_mode4_inithook(struct hda_codec *codec)
17964 alc663_21jd_two_speaker_automute(codec);
17965 alc_mic_automute(codec);
17967 /* ***************** Mode5 ******************************/
17968 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17971 switch (res >> 26) {
17972 case ALC880_HP_EVENT:
17973 alc663_15jd_two_speaker_automute(codec);
17975 case ALC880_MIC_EVENT:
17976 alc_mic_automute(codec);
17981 #define alc663_mode5_setup alc663_mode1_setup
17983 static void alc663_mode5_inithook(struct hda_codec *codec)
17985 alc663_15jd_two_speaker_automute(codec);
17986 alc_mic_automute(codec);
17988 /* ***************** Mode6 ******************************/
17989 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17992 switch (res >> 26) {
17993 case ALC880_HP_EVENT:
17994 alc663_two_hp_m2_speaker_automute(codec);
17996 case ALC880_MIC_EVENT:
17997 alc_mic_automute(codec);
18002 #define alc663_mode6_setup alc663_mode1_setup
18004 static void alc663_mode6_inithook(struct hda_codec *codec)
18006 alc663_two_hp_m2_speaker_automute(codec);
18007 alc_mic_automute(codec);
18010 /* ***************** Mode7 ******************************/
18011 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18014 switch (res >> 26) {
18015 case ALC880_HP_EVENT:
18016 alc663_two_hp_m7_speaker_automute(codec);
18018 case ALC880_MIC_EVENT:
18019 alc_mic_automute(codec);
18024 #define alc663_mode7_setup alc663_mode1_setup
18026 static void alc663_mode7_inithook(struct hda_codec *codec)
18028 alc663_two_hp_m7_speaker_automute(codec);
18029 alc_mic_automute(codec);
18032 /* ***************** Mode8 ******************************/
18033 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18036 switch (res >> 26) {
18037 case ALC880_HP_EVENT:
18038 alc663_two_hp_m8_speaker_automute(codec);
18040 case ALC880_MIC_EVENT:
18041 alc_mic_automute(codec);
18046 #define alc663_mode8_setup alc663_m51va_setup
18048 static void alc663_mode8_inithook(struct hda_codec *codec)
18050 alc663_two_hp_m8_speaker_automute(codec);
18051 alc_mic_automute(codec);
18054 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18056 unsigned int present;
18057 unsigned char bits;
18059 present = snd_hda_jack_detect(codec, 0x21);
18060 bits = present ? HDA_AMP_MUTE : 0;
18061 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18062 HDA_AMP_MUTE, bits);
18063 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18064 HDA_AMP_MUTE, bits);
18067 static void alc663_g71v_front_automute(struct hda_codec *codec)
18069 unsigned int present;
18070 unsigned char bits;
18072 present = snd_hda_jack_detect(codec, 0x15);
18073 bits = present ? HDA_AMP_MUTE : 0;
18074 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18075 HDA_AMP_MUTE, bits);
18078 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18081 switch (res >> 26) {
18082 case ALC880_HP_EVENT:
18083 alc663_g71v_hp_automute(codec);
18085 case ALC880_FRONT_EVENT:
18086 alc663_g71v_front_automute(codec);
18088 case ALC880_MIC_EVENT:
18089 alc_mic_automute(codec);
18094 #define alc663_g71v_setup alc663_m51va_setup
18096 static void alc663_g71v_inithook(struct hda_codec *codec)
18098 alc663_g71v_front_automute(codec);
18099 alc663_g71v_hp_automute(codec);
18100 alc_mic_automute(codec);
18103 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18106 switch (res >> 26) {
18107 case ALC880_HP_EVENT:
18108 alc663_m51va_speaker_automute(codec);
18110 case ALC880_MIC_EVENT:
18111 alc_mic_automute(codec);
18116 #define alc663_g50v_setup alc663_m51va_setup
18118 static void alc663_g50v_inithook(struct hda_codec *codec)
18120 alc663_m51va_speaker_automute(codec);
18121 alc_mic_automute(codec);
18124 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18125 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18126 ALC262_HIPPO_MASTER_SWITCH,
18128 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18129 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18130 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18132 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18133 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18134 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18138 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18139 /* Master Playback automatically created from Speaker and Headphone */
18140 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18141 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18145 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18146 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18147 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18149 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18150 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18151 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18155 #ifdef CONFIG_SND_HDA_POWER_SAVE
18156 #define alc662_loopbacks alc880_loopbacks
18160 /* pcm configuration: identical with ALC880 */
18161 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18162 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18163 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18164 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18167 * configuration and preset
18169 static const char *alc662_models[ALC662_MODEL_LAST] = {
18170 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18171 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18172 [ALC662_3ST_6ch] = "3stack-6ch",
18173 [ALC662_5ST_DIG] = "6stack-dig",
18174 [ALC662_LENOVO_101E] = "lenovo-101e",
18175 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18176 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18177 [ALC662_ECS] = "ecs",
18178 [ALC663_ASUS_M51VA] = "m51va",
18179 [ALC663_ASUS_G71V] = "g71v",
18180 [ALC663_ASUS_H13] = "h13",
18181 [ALC663_ASUS_G50V] = "g50v",
18182 [ALC663_ASUS_MODE1] = "asus-mode1",
18183 [ALC662_ASUS_MODE2] = "asus-mode2",
18184 [ALC663_ASUS_MODE3] = "asus-mode3",
18185 [ALC663_ASUS_MODE4] = "asus-mode4",
18186 [ALC663_ASUS_MODE5] = "asus-mode5",
18187 [ALC663_ASUS_MODE6] = "asus-mode6",
18188 [ALC663_ASUS_MODE7] = "asus-mode7",
18189 [ALC663_ASUS_MODE8] = "asus-mode8",
18190 [ALC272_DELL] = "dell",
18191 [ALC272_DELL_ZM1] = "dell-zm1",
18192 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18193 [ALC662_AUTO] = "auto",
18196 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18197 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18198 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18199 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18200 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18201 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18202 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18203 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18204 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18205 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18206 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18207 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18208 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18209 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18210 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18211 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18212 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18213 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18214 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18215 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18216 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18217 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18218 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18219 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18220 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18221 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18222 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18223 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18224 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18225 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18226 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18227 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18228 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18229 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18230 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18231 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18232 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18233 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18234 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18235 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18236 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18237 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18238 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18239 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18240 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18241 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18242 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18243 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18244 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18245 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18246 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18247 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18248 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18249 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18250 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18251 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18252 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18253 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18254 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18255 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18256 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18257 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18258 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18259 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18260 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18261 ALC662_3ST_6ch_DIG),
18262 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18263 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18264 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18265 ALC662_3ST_6ch_DIG),
18266 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18267 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18268 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18269 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18270 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18271 ALC662_3ST_6ch_DIG),
18272 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18277 static struct alc_config_preset alc662_presets[] = {
18278 [ALC662_3ST_2ch_DIG] = {
18279 .mixers = { alc662_3ST_2ch_mixer },
18280 .init_verbs = { alc662_init_verbs },
18281 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18282 .dac_nids = alc662_dac_nids,
18283 .dig_out_nid = ALC662_DIGOUT_NID,
18284 .dig_in_nid = ALC662_DIGIN_NID,
18285 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18286 .channel_mode = alc662_3ST_2ch_modes,
18287 .input_mux = &alc662_capture_source,
18289 [ALC662_3ST_6ch_DIG] = {
18290 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18291 .init_verbs = { alc662_init_verbs },
18292 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18293 .dac_nids = alc662_dac_nids,
18294 .dig_out_nid = ALC662_DIGOUT_NID,
18295 .dig_in_nid = ALC662_DIGIN_NID,
18296 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18297 .channel_mode = alc662_3ST_6ch_modes,
18299 .input_mux = &alc662_capture_source,
18301 [ALC662_3ST_6ch] = {
18302 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18303 .init_verbs = { alc662_init_verbs },
18304 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18305 .dac_nids = alc662_dac_nids,
18306 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18307 .channel_mode = alc662_3ST_6ch_modes,
18309 .input_mux = &alc662_capture_source,
18311 [ALC662_5ST_DIG] = {
18312 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18313 .init_verbs = { alc662_init_verbs },
18314 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18315 .dac_nids = alc662_dac_nids,
18316 .dig_out_nid = ALC662_DIGOUT_NID,
18317 .dig_in_nid = ALC662_DIGIN_NID,
18318 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18319 .channel_mode = alc662_5stack_modes,
18320 .input_mux = &alc662_capture_source,
18322 [ALC662_LENOVO_101E] = {
18323 .mixers = { alc662_lenovo_101e_mixer },
18324 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18325 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18326 .dac_nids = alc662_dac_nids,
18327 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18328 .channel_mode = alc662_3ST_2ch_modes,
18329 .input_mux = &alc662_lenovo_101e_capture_source,
18330 .unsol_event = alc662_lenovo_101e_unsol_event,
18331 .init_hook = alc662_lenovo_101e_all_automute,
18333 [ALC662_ASUS_EEEPC_P701] = {
18334 .mixers = { alc662_eeepc_p701_mixer },
18335 .init_verbs = { alc662_init_verbs,
18336 alc662_eeepc_sue_init_verbs },
18337 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18338 .dac_nids = alc662_dac_nids,
18339 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18340 .channel_mode = alc662_3ST_2ch_modes,
18341 .unsol_event = alc662_eeepc_unsol_event,
18342 .setup = alc662_eeepc_setup,
18343 .init_hook = alc662_eeepc_inithook,
18345 [ALC662_ASUS_EEEPC_EP20] = {
18346 .mixers = { alc662_eeepc_ep20_mixer,
18347 alc662_chmode_mixer },
18348 .init_verbs = { alc662_init_verbs,
18349 alc662_eeepc_ep20_sue_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,
18354 .input_mux = &alc662_lenovo_101e_capture_source,
18355 .unsol_event = alc662_eeepc_unsol_event,
18356 .setup = alc662_eeepc_ep20_setup,
18357 .init_hook = alc662_eeepc_ep20_inithook,
18360 .mixers = { alc662_ecs_mixer },
18361 .init_verbs = { alc662_init_verbs,
18362 alc662_ecs_init_verbs },
18363 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18364 .dac_nids = alc662_dac_nids,
18365 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18366 .channel_mode = alc662_3ST_2ch_modes,
18367 .unsol_event = alc662_eeepc_unsol_event,
18368 .setup = alc662_eeepc_setup,
18369 .init_hook = alc662_eeepc_inithook,
18371 [ALC663_ASUS_M51VA] = {
18372 .mixers = { alc663_m51va_mixer },
18373 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18374 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18375 .dac_nids = alc662_dac_nids,
18376 .dig_out_nid = ALC662_DIGOUT_NID,
18377 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18378 .channel_mode = alc662_3ST_2ch_modes,
18379 .unsol_event = alc663_m51va_unsol_event,
18380 .setup = alc663_m51va_setup,
18381 .init_hook = alc663_m51va_inithook,
18383 [ALC663_ASUS_G71V] = {
18384 .mixers = { alc663_g71v_mixer },
18385 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18386 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18387 .dac_nids = alc662_dac_nids,
18388 .dig_out_nid = ALC662_DIGOUT_NID,
18389 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18390 .channel_mode = alc662_3ST_2ch_modes,
18391 .unsol_event = alc663_g71v_unsol_event,
18392 .setup = alc663_g71v_setup,
18393 .init_hook = alc663_g71v_inithook,
18395 [ALC663_ASUS_H13] = {
18396 .mixers = { alc663_m51va_mixer },
18397 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18398 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18399 .dac_nids = alc662_dac_nids,
18400 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18401 .channel_mode = alc662_3ST_2ch_modes,
18402 .unsol_event = alc663_m51va_unsol_event,
18403 .init_hook = alc663_m51va_inithook,
18405 [ALC663_ASUS_G50V] = {
18406 .mixers = { alc663_g50v_mixer },
18407 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18408 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18409 .dac_nids = alc662_dac_nids,
18410 .dig_out_nid = ALC662_DIGOUT_NID,
18411 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18412 .channel_mode = alc662_3ST_6ch_modes,
18413 .input_mux = &alc663_capture_source,
18414 .unsol_event = alc663_g50v_unsol_event,
18415 .setup = alc663_g50v_setup,
18416 .init_hook = alc663_g50v_inithook,
18418 [ALC663_ASUS_MODE1] = {
18419 .mixers = { alc663_m51va_mixer },
18420 .cap_mixer = alc662_auto_capture_mixer,
18421 .init_verbs = { alc662_init_verbs,
18422 alc663_21jd_amic_init_verbs },
18423 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18425 .dac_nids = alc662_dac_nids,
18426 .dig_out_nid = ALC662_DIGOUT_NID,
18427 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18428 .channel_mode = alc662_3ST_2ch_modes,
18429 .unsol_event = alc663_mode1_unsol_event,
18430 .setup = alc663_mode1_setup,
18431 .init_hook = alc663_mode1_inithook,
18433 [ALC662_ASUS_MODE2] = {
18434 .mixers = { alc662_1bjd_mixer },
18435 .cap_mixer = alc662_auto_capture_mixer,
18436 .init_verbs = { alc662_init_verbs,
18437 alc662_1bjd_amic_init_verbs },
18438 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18439 .dac_nids = alc662_dac_nids,
18440 .dig_out_nid = ALC662_DIGOUT_NID,
18441 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18442 .channel_mode = alc662_3ST_2ch_modes,
18443 .unsol_event = alc662_mode2_unsol_event,
18444 .setup = alc662_mode2_setup,
18445 .init_hook = alc662_mode2_inithook,
18447 [ALC663_ASUS_MODE3] = {
18448 .mixers = { alc663_two_hp_m1_mixer },
18449 .cap_mixer = alc662_auto_capture_mixer,
18450 .init_verbs = { alc662_init_verbs,
18451 alc663_two_hp_amic_m1_init_verbs },
18452 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18454 .dac_nids = alc662_dac_nids,
18455 .dig_out_nid = ALC662_DIGOUT_NID,
18456 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18457 .channel_mode = alc662_3ST_2ch_modes,
18458 .unsol_event = alc663_mode3_unsol_event,
18459 .setup = alc663_mode3_setup,
18460 .init_hook = alc663_mode3_inithook,
18462 [ALC663_ASUS_MODE4] = {
18463 .mixers = { alc663_asus_21jd_clfe_mixer },
18464 .cap_mixer = alc662_auto_capture_mixer,
18465 .init_verbs = { alc662_init_verbs,
18466 alc663_21jd_amic_init_verbs},
18467 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18469 .dac_nids = alc662_dac_nids,
18470 .dig_out_nid = ALC662_DIGOUT_NID,
18471 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18472 .channel_mode = alc662_3ST_2ch_modes,
18473 .unsol_event = alc663_mode4_unsol_event,
18474 .setup = alc663_mode4_setup,
18475 .init_hook = alc663_mode4_inithook,
18477 [ALC663_ASUS_MODE5] = {
18478 .mixers = { alc663_asus_15jd_clfe_mixer },
18479 .cap_mixer = alc662_auto_capture_mixer,
18480 .init_verbs = { alc662_init_verbs,
18481 alc663_15jd_amic_init_verbs },
18482 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18484 .dac_nids = alc662_dac_nids,
18485 .dig_out_nid = ALC662_DIGOUT_NID,
18486 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18487 .channel_mode = alc662_3ST_2ch_modes,
18488 .unsol_event = alc663_mode5_unsol_event,
18489 .setup = alc663_mode5_setup,
18490 .init_hook = alc663_mode5_inithook,
18492 [ALC663_ASUS_MODE6] = {
18493 .mixers = { alc663_two_hp_m2_mixer },
18494 .cap_mixer = alc662_auto_capture_mixer,
18495 .init_verbs = { alc662_init_verbs,
18496 alc663_two_hp_amic_m2_init_verbs },
18497 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18499 .dac_nids = alc662_dac_nids,
18500 .dig_out_nid = ALC662_DIGOUT_NID,
18501 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18502 .channel_mode = alc662_3ST_2ch_modes,
18503 .unsol_event = alc663_mode6_unsol_event,
18504 .setup = alc663_mode6_setup,
18505 .init_hook = alc663_mode6_inithook,
18507 [ALC663_ASUS_MODE7] = {
18508 .mixers = { alc663_mode7_mixer },
18509 .cap_mixer = alc662_auto_capture_mixer,
18510 .init_verbs = { alc662_init_verbs,
18511 alc663_mode7_init_verbs },
18512 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18514 .dac_nids = alc662_dac_nids,
18515 .dig_out_nid = ALC662_DIGOUT_NID,
18516 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18517 .channel_mode = alc662_3ST_2ch_modes,
18518 .unsol_event = alc663_mode7_unsol_event,
18519 .setup = alc663_mode7_setup,
18520 .init_hook = alc663_mode7_inithook,
18522 [ALC663_ASUS_MODE8] = {
18523 .mixers = { alc663_mode8_mixer },
18524 .cap_mixer = alc662_auto_capture_mixer,
18525 .init_verbs = { alc662_init_verbs,
18526 alc663_mode8_init_verbs },
18527 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18529 .dac_nids = alc662_dac_nids,
18530 .dig_out_nid = ALC662_DIGOUT_NID,
18531 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18532 .channel_mode = alc662_3ST_2ch_modes,
18533 .unsol_event = alc663_mode8_unsol_event,
18534 .setup = alc663_mode8_setup,
18535 .init_hook = alc663_mode8_inithook,
18538 .mixers = { alc663_m51va_mixer },
18539 .cap_mixer = alc272_auto_capture_mixer,
18540 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18541 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18542 .dac_nids = alc662_dac_nids,
18543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18544 .adc_nids = alc272_adc_nids,
18545 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18546 .capsrc_nids = alc272_capsrc_nids,
18547 .channel_mode = alc662_3ST_2ch_modes,
18548 .unsol_event = alc663_m51va_unsol_event,
18549 .setup = alc663_m51va_setup,
18550 .init_hook = alc663_m51va_inithook,
18552 [ALC272_DELL_ZM1] = {
18553 .mixers = { alc663_m51va_mixer },
18554 .cap_mixer = alc662_auto_capture_mixer,
18555 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18556 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18557 .dac_nids = alc662_dac_nids,
18558 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18559 .adc_nids = alc662_adc_nids,
18561 .capsrc_nids = alc662_capsrc_nids,
18562 .channel_mode = alc662_3ST_2ch_modes,
18563 .unsol_event = alc663_m51va_unsol_event,
18564 .setup = alc663_m51va_setup,
18565 .init_hook = alc663_m51va_inithook,
18567 [ALC272_SAMSUNG_NC10] = {
18568 .mixers = { alc272_nc10_mixer },
18569 .init_verbs = { alc662_init_verbs,
18570 alc663_21jd_amic_init_verbs },
18571 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18572 .dac_nids = alc272_dac_nids,
18573 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18574 .channel_mode = alc662_3ST_2ch_modes,
18575 /*.input_mux = &alc272_nc10_capture_source,*/
18576 .unsol_event = alc663_mode4_unsol_event,
18577 .setup = alc663_mode4_setup,
18578 .init_hook = alc663_mode4_inithook,
18584 * BIOS auto configuration
18587 /* convert from MIX nid to DAC */
18588 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18592 else if (nid >= 0x0c && nid <= 0x0e)
18593 return nid - 0x0c + 0x02;
18598 /* get MIX nid connected to the given pin targeted to DAC */
18599 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18605 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18606 for (i = 0; i < num; i++) {
18607 if (alc662_mix_to_dac(mix[i]) == dac)
18613 /* look for an empty DAC slot */
18614 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18616 struct alc_spec *spec = codec->spec;
18620 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18623 for (i = 0; i < num; i++) {
18624 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18627 for (j = 0; j < spec->multiout.num_dacs; j++)
18628 if (spec->multiout.dac_nids[j] == nid)
18630 if (j >= spec->multiout.num_dacs)
18636 /* fill in the dac_nids table from the parsed pin configuration */
18637 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18638 const struct auto_pin_cfg *cfg)
18640 struct alc_spec *spec = codec->spec;
18644 spec->multiout.dac_nids = spec->private_dac_nids;
18645 for (i = 0; i < cfg->line_outs; i++) {
18646 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18649 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
18654 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18655 hda_nid_t nid, unsigned int chs)
18657 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
18658 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18661 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18662 hda_nid_t nid, unsigned int chs)
18664 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18665 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18668 #define alc662_add_stereo_vol(spec, pfx, nid) \
18669 alc662_add_vol_ctl(spec, pfx, nid, 3)
18670 #define alc662_add_stereo_sw(spec, pfx, nid) \
18671 alc662_add_sw_ctl(spec, pfx, nid, 3)
18673 /* add playback controls from the parsed DAC table */
18674 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18675 const struct auto_pin_cfg *cfg)
18677 struct alc_spec *spec = codec->spec;
18678 static const char *chname[4] = {
18679 "Front", "Surround", NULL /*CLFE*/, "Side"
18681 hda_nid_t nid, mix;
18684 for (i = 0; i < cfg->line_outs; i++) {
18685 nid = spec->multiout.dac_nids[i];
18688 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
18693 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18696 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18699 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18702 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18707 if (cfg->line_outs == 1 &&
18708 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
18715 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18718 if (cfg->line_outs == 1 &&
18719 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
18721 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18729 /* add playback controls for speaker and HP outputs */
18730 /* return DAC nid if any new DAC is assigned */
18731 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18734 struct alc_spec *spec = codec->spec;
18735 hda_nid_t nid, mix;
18740 nid = alc662_look_for_dac(codec, pin);
18742 /* the corresponding DAC is already occupied */
18743 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18744 return 0; /* no way */
18745 /* create a switch only */
18746 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18747 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18750 mix = alc662_dac_to_mix(codec, pin, nid);
18753 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
18756 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18762 /* create playback/capture controls for input pins */
18763 #define alc662_auto_create_input_ctls \
18764 alc882_auto_create_input_ctls
18766 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18767 hda_nid_t nid, int pin_type,
18771 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18773 alc_set_pin_output(codec, nid, pin_type);
18774 /* need the manual connection? */
18775 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18778 for (i = 0; i < num; i++) {
18779 if (alc662_mix_to_dac(srcs[i]) != dac)
18781 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
18786 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18788 struct alc_spec *spec = codec->spec;
18789 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18792 for (i = 0; i <= HDA_SIDE; i++) {
18793 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18795 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18796 spec->multiout.dac_nids[i]);
18800 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18802 struct alc_spec *spec = codec->spec;
18805 pin = spec->autocfg.hp_pins[0];
18807 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18808 spec->multiout.hp_nid);
18809 pin = spec->autocfg.speaker_pins[0];
18811 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18812 spec->multiout.extra_out_nid[0]);
18815 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18817 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18819 struct alc_spec *spec = codec->spec;
18820 struct auto_pin_cfg *cfg = &spec->autocfg;
18823 for (i = 0; i < cfg->num_inputs; i++) {
18824 hda_nid_t nid = cfg->inputs[i].pin;
18825 if (alc_is_input_pin(codec, nid)) {
18826 alc_set_input_pin(codec, nid, i);
18827 if (nid != ALC662_PIN_CD_NID &&
18828 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18829 snd_hda_codec_write(codec, nid, 0,
18830 AC_VERB_SET_AMP_GAIN_MUTE,
18836 #define alc662_auto_init_input_src alc882_auto_init_input_src
18838 static int alc662_parse_auto_config(struct hda_codec *codec)
18840 struct alc_spec *spec = codec->spec;
18842 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18844 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18848 if (!spec->autocfg.line_outs)
18849 return 0; /* can't find valid BIOS pin config */
18851 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18854 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18857 err = alc662_auto_create_extra_out(codec,
18858 spec->autocfg.speaker_pins[0],
18863 spec->multiout.extra_out_nid[0] = err;
18864 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18869 spec->multiout.hp_nid = err;
18870 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18874 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18876 alc_auto_parse_digital(codec);
18878 if (spec->kctls.list)
18879 add_mixer(spec, spec->kctls.list);
18881 spec->num_mux_defs = 1;
18882 spec->input_mux = &spec->private_imux[0];
18884 add_verb(spec, alc662_init_verbs);
18885 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18886 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18887 add_verb(spec, alc663_init_verbs);
18889 if (codec->vendor_id == 0x10ec0272)
18890 add_verb(spec, alc272_init_verbs);
18892 err = alc_auto_add_mic_boost(codec);
18896 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18897 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18898 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18900 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
18905 /* additional initialization for auto-configuration model */
18906 static void alc662_auto_init(struct hda_codec *codec)
18908 struct alc_spec *spec = codec->spec;
18909 alc662_auto_init_multi_out(codec);
18910 alc662_auto_init_hp_out(codec);
18911 alc662_auto_init_analog_input(codec);
18912 alc662_auto_init_input_src(codec);
18913 alc_auto_init_digital(codec);
18914 if (spec->unsol_event)
18915 alc_inithook(codec);
18918 static int patch_alc662(struct hda_codec *codec)
18920 struct alc_spec *spec;
18921 int err, board_config;
18923 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18927 codec->spec = spec;
18929 alc_auto_parse_customize_define(codec);
18931 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18933 if (alc_read_coef_idx(codec, 0) == 0x8020)
18934 alc_codec_rename(codec, "ALC661");
18935 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
18936 codec->bus->pci->subsystem_vendor == 0x1025 &&
18937 spec->cdefine.platform_type == 1)
18938 alc_codec_rename(codec, "ALC272X");
18940 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18943 if (board_config < 0) {
18944 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18946 board_config = ALC662_AUTO;
18949 if (board_config == ALC662_AUTO) {
18950 /* automatic parse from the BIOS config */
18951 err = alc662_parse_auto_config(codec);
18957 "hda_codec: Cannot set up configuration "
18958 "from BIOS. Using base mode...\n");
18959 board_config = ALC662_3ST_2ch_DIG;
18963 if (has_cdefine_beep(codec)) {
18964 err = snd_hda_attach_beep_device(codec, 0x1);
18971 if (board_config != ALC662_AUTO)
18972 setup_preset(codec, &alc662_presets[board_config]);
18974 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18975 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18977 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18978 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18980 if (!spec->adc_nids) {
18981 spec->adc_nids = alc662_adc_nids;
18982 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18984 if (!spec->capsrc_nids)
18985 spec->capsrc_nids = alc662_capsrc_nids;
18987 if (!spec->cap_mixer)
18988 set_capture_mixer(codec);
18990 if (has_cdefine_beep(codec)) {
18991 switch (codec->vendor_id) {
18993 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18998 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19001 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19005 spec->vmaster_nid = 0x02;
19007 codec->patch_ops = alc_patch_ops;
19008 if (board_config == ALC662_AUTO)
19009 spec->init_hook = alc662_auto_init;
19010 #ifdef CONFIG_SND_HDA_POWER_SAVE
19011 if (!spec->loopback.amplist)
19012 spec->loopback.amplist = alc662_loopbacks;
19018 static int patch_alc888(struct hda_codec *codec)
19020 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19021 kfree(codec->chip_name);
19022 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19023 if (!codec->chip_name) {
19027 return patch_alc662(codec);
19029 return patch_alc882(codec);
19035 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19036 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19037 #define alc680_modes alc260_modes
19039 static hda_nid_t alc680_dac_nids[3] = {
19040 /* Lout1, Lout2, hp */
19044 static hda_nid_t alc680_adc_nids[3] = {
19046 /* DMIC, MIC, Line-in*/
19051 * Analog capture ADC cgange
19053 static void alc680_rec_autoswitch(struct hda_codec *codec)
19055 struct alc_spec *spec = codec->spec;
19056 struct auto_pin_cfg *cfg = &spec->autocfg;
19058 int type_found = AUTO_PIN_LAST;
19062 for (i = 0; i < cfg->num_inputs; i++) {
19063 nid = cfg->inputs[i].pin;
19064 if (!(snd_hda_query_pin_caps(codec, nid) &
19065 AC_PINCAP_PRES_DETECT))
19067 if (snd_hda_jack_detect(codec, nid)) {
19068 if (cfg->inputs[i].type < type_found) {
19069 type_found = cfg->inputs[i].type;
19077 snd_hda_get_connections(codec, pin_found, &nid, 1);
19079 if (nid != spec->cur_adc)
19080 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19081 spec->cur_adc = nid;
19082 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19083 spec->cur_adc_format);
19086 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19087 struct hda_codec *codec,
19088 unsigned int stream_tag,
19089 unsigned int format,
19090 struct snd_pcm_substream *substream)
19092 struct alc_spec *spec = codec->spec;
19094 spec->cur_adc = 0x07;
19095 spec->cur_adc_stream_tag = stream_tag;
19096 spec->cur_adc_format = format;
19098 alc680_rec_autoswitch(codec);
19102 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19103 struct hda_codec *codec,
19104 struct snd_pcm_substream *substream)
19106 snd_hda_codec_cleanup_stream(codec, 0x07);
19107 snd_hda_codec_cleanup_stream(codec, 0x08);
19108 snd_hda_codec_cleanup_stream(codec, 0x09);
19112 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19113 .substreams = 1, /* can be overridden */
19116 /* NID is set in alc_build_pcms */
19118 .prepare = alc680_capture_pcm_prepare,
19119 .cleanup = alc680_capture_pcm_cleanup
19123 static struct snd_kcontrol_new alc680_base_mixer[] = {
19124 /* output mixer control */
19125 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19126 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19129 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19131 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19135 static struct hda_bind_ctls alc680_bind_cap_vol = {
19136 .ops = &snd_hda_bind_vol,
19138 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19139 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19140 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19145 static struct hda_bind_ctls alc680_bind_cap_switch = {
19146 .ops = &snd_hda_bind_sw,
19148 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19149 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19150 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19155 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19156 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19157 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19162 * generic initialization of ADC, input mixers and output mixers
19164 static struct hda_verb alc680_init_verbs[] = {
19165 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19166 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19167 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19169 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19172 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19173 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19174 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19176 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19178 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19182 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19183 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19184 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19189 /* toggle speaker-output according to the hp-jack state */
19190 static void alc680_base_setup(struct hda_codec *codec)
19192 struct alc_spec *spec = codec->spec;
19194 spec->autocfg.hp_pins[0] = 0x16;
19195 spec->autocfg.speaker_pins[0] = 0x14;
19196 spec->autocfg.speaker_pins[1] = 0x15;
19197 spec->autocfg.num_inputs = 2;
19198 spec->autocfg.inputs[0].pin = 0x18;
19199 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19200 spec->autocfg.inputs[1].pin = 0x19;
19201 spec->autocfg.inputs[1].type = AUTO_PIN_LINE;
19204 static void alc680_unsol_event(struct hda_codec *codec,
19207 if ((res >> 26) == ALC880_HP_EVENT)
19208 alc_automute_amp(codec);
19209 if ((res >> 26) == ALC880_MIC_EVENT)
19210 alc680_rec_autoswitch(codec);
19213 static void alc680_inithook(struct hda_codec *codec)
19215 alc_automute_amp(codec);
19216 alc680_rec_autoswitch(codec);
19219 /* create input playback/capture controls for the given pin */
19220 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19221 const char *ctlname, int idx)
19239 if (spec->multiout.dac_nids[0] != dac &&
19240 spec->multiout.dac_nids[1] != dac) {
19241 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19242 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19247 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19248 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19252 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19258 /* add playback controls from the parsed DAC table */
19259 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19260 const struct auto_pin_cfg *cfg)
19265 spec->multiout.dac_nids = spec->private_dac_nids;
19267 nid = cfg->line_out_pins[0];
19270 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19274 err = alc680_new_analog_output(spec, nid, name, 0);
19279 nid = cfg->speaker_pins[0];
19281 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19285 nid = cfg->hp_pins[0];
19287 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19295 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19296 hda_nid_t nid, int pin_type)
19298 alc_set_pin_output(codec, nid, pin_type);
19301 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19303 struct alc_spec *spec = codec->spec;
19304 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19306 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19307 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19311 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19313 struct alc_spec *spec = codec->spec;
19316 pin = spec->autocfg.hp_pins[0];
19318 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19319 pin = spec->autocfg.speaker_pins[0];
19321 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19324 /* pcm configuration: identical with ALC880 */
19325 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19326 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19327 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19328 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19329 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19332 * BIOS auto configuration
19334 static int alc680_parse_auto_config(struct hda_codec *codec)
19336 struct alc_spec *spec = codec->spec;
19338 static hda_nid_t alc680_ignore[] = { 0 };
19340 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19345 if (!spec->autocfg.line_outs) {
19346 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19347 spec->multiout.max_channels = 2;
19348 spec->no_analog = 1;
19351 return 0; /* can't find valid BIOS pin config */
19353 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19357 spec->multiout.max_channels = 2;
19360 /* digital only support output */
19361 alc_auto_parse_digital(codec);
19362 if (spec->kctls.list)
19363 add_mixer(spec, spec->kctls.list);
19365 add_verb(spec, alc680_init_verbs);
19367 err = alc_auto_add_mic_boost(codec);
19374 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19376 /* init callback for auto-configuration model -- overriding the default init */
19377 static void alc680_auto_init(struct hda_codec *codec)
19379 struct alc_spec *spec = codec->spec;
19380 alc680_auto_init_multi_out(codec);
19381 alc680_auto_init_hp_out(codec);
19382 alc680_auto_init_analog_input(codec);
19383 alc_auto_init_digital(codec);
19384 if (spec->unsol_event)
19385 alc_inithook(codec);
19389 * configuration and preset
19391 static const char *alc680_models[ALC680_MODEL_LAST] = {
19392 [ALC680_BASE] = "base",
19393 [ALC680_AUTO] = "auto",
19396 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19397 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19401 static struct alc_config_preset alc680_presets[] = {
19403 .mixers = { alc680_base_mixer },
19404 .cap_mixer = alc680_master_capture_mixer,
19405 .init_verbs = { alc680_init_verbs },
19406 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19407 .dac_nids = alc680_dac_nids,
19408 .dig_out_nid = ALC680_DIGOUT_NID,
19409 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19410 .channel_mode = alc680_modes,
19411 .unsol_event = alc680_unsol_event,
19412 .setup = alc680_base_setup,
19413 .init_hook = alc680_inithook,
19418 static int patch_alc680(struct hda_codec *codec)
19420 struct alc_spec *spec;
19424 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19428 codec->spec = spec;
19430 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19434 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19435 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19437 board_config = ALC680_AUTO;
19440 if (board_config == ALC680_AUTO) {
19441 /* automatic parse from the BIOS config */
19442 err = alc680_parse_auto_config(codec);
19448 "hda_codec: Cannot set up configuration "
19449 "from BIOS. Using base mode...\n");
19450 board_config = ALC680_BASE;
19454 if (board_config != ALC680_AUTO)
19455 setup_preset(codec, &alc680_presets[board_config]);
19457 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19458 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19459 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19460 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19462 if (!spec->adc_nids) {
19463 spec->adc_nids = alc680_adc_nids;
19464 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19467 if (!spec->cap_mixer)
19468 set_capture_mixer(codec);
19470 spec->vmaster_nid = 0x02;
19472 codec->patch_ops = alc_patch_ops;
19473 if (board_config == ALC680_AUTO)
19474 spec->init_hook = alc680_auto_init;
19482 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19483 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19484 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19485 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19486 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19487 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19488 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19489 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19490 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19491 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19492 .patch = patch_alc861 },
19493 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19494 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19495 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19496 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19497 .patch = patch_alc882 },
19498 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19499 .patch = patch_alc662 },
19500 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19501 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19502 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19503 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19504 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19505 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19506 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19507 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19508 .patch = patch_alc882 },
19509 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19510 .patch = patch_alc882 },
19511 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19512 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19513 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19514 .patch = patch_alc882 },
19515 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19516 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19517 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19518 {} /* terminator */
19521 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19523 MODULE_LICENSE("GPL");
19524 MODULE_DESCRIPTION("Realtek HD-audio codec");
19526 static struct hda_codec_preset_list realtek_list = {
19527 .preset = snd_hda_preset_realtek,
19528 .owner = THIS_MODULE,
19531 static int __init patch_realtek_init(void)
19533 return snd_hda_add_codec_preset(&realtek_list);
19536 static void __exit patch_realtek_exit(void)
19538 snd_hda_delete_codec_preset(&realtek_list);
19541 module_init(patch_realtek_init)
19542 module_exit(patch_realtek_exit)