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 <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 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;
297 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
302 struct alc_multi_io {
303 hda_nid_t pin; /* multi-io widget pin NID */
304 hda_nid_t dac; /* DAC to be connected */
305 unsigned int ctl_in; /* cached input-pin control value */
309 ALC_AUTOMUTE_PIN, /* change the pin control */
310 ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */
311 ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */
315 /* codec parameterization */
316 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
317 unsigned int num_mixers;
318 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
319 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
321 const struct hda_verb *init_verbs[10]; /* initialization verbs
325 unsigned int num_init_verbs;
327 char stream_name_analog[32]; /* analog PCM stream */
328 const struct hda_pcm_stream *stream_analog_playback;
329 const struct hda_pcm_stream *stream_analog_capture;
330 const struct hda_pcm_stream *stream_analog_alt_playback;
331 const struct hda_pcm_stream *stream_analog_alt_capture;
333 char stream_name_digital[32]; /* digital PCM stream */
334 const struct hda_pcm_stream *stream_digital_playback;
335 const struct hda_pcm_stream *stream_digital_capture;
338 struct hda_multi_out multiout; /* playback set-up
339 * max_channels, dacs must be set
340 * dig_out_nid and hp_nid are optional
342 hda_nid_t alt_dac_nid;
343 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
347 unsigned int num_adc_nids;
348 const hda_nid_t *adc_nids;
349 const hda_nid_t *capsrc_nids;
350 hda_nid_t dig_in_nid; /* digital-in NID; optional */
352 /* capture setup for dynamic dual-adc switch */
353 unsigned int cur_adc_idx;
355 unsigned int cur_adc_stream_tag;
356 unsigned int cur_adc_format;
359 unsigned int num_mux_defs;
360 const struct hda_input_mux *input_mux;
361 unsigned int cur_mux[3];
362 struct alc_mic_route ext_mic;
363 struct alc_mic_route dock_mic;
364 struct alc_mic_route int_mic;
367 const struct hda_channel_mode *channel_mode;
368 int num_channel_mode;
370 int const_channel_count;
371 int ext_channel_count;
373 /* PCM information */
374 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
376 /* dynamic controls, init_verbs and input_mux */
377 struct auto_pin_cfg autocfg;
378 struct alc_customize_define cdefine;
379 struct snd_array kctls;
380 struct hda_input_mux private_imux[3];
381 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
382 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
383 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
386 void (*init_hook)(struct hda_codec *codec);
387 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
388 #ifdef CONFIG_SND_HDA_POWER_SAVE
389 void (*power_hook)(struct hda_codec *codec);
391 void (*shutup)(struct hda_codec *codec);
393 /* for pin sensing */
394 unsigned int jack_present: 1;
395 unsigned int line_jack_present:1;
396 unsigned int master_mute:1;
397 unsigned int auto_mic:1;
398 unsigned int automute:1; /* HP automute enabled */
399 unsigned int detect_line:1; /* Line-out detection enabled */
400 unsigned int automute_lines:1; /* automute line-out as well */
401 unsigned int automute_hp_lo:1; /* both HP and LO available */
404 unsigned int no_analog :1; /* digital I/O only */
405 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
406 unsigned int single_input_src:1;
408 /* auto-mute control */
410 hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS];
413 int codec_variant; /* flag for other variants */
415 /* for virtual master */
416 hda_nid_t vmaster_nid;
417 #ifdef CONFIG_SND_HDA_POWER_SAVE
418 struct hda_loopback_check loopback;
423 unsigned int pll_coef_idx, pll_coef_bit;
427 const struct alc_fixup *fixup_list;
428 const char *fixup_name;
432 struct alc_multi_io multi_io[4];
436 * configuration template - to be copied to the spec instance
438 struct alc_config_preset {
439 const struct snd_kcontrol_new *mixers[5]; /* should be identical size
442 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
443 const struct hda_verb *init_verbs[5];
444 unsigned int num_dacs;
445 const hda_nid_t *dac_nids;
446 hda_nid_t dig_out_nid; /* optional */
447 hda_nid_t hp_nid; /* optional */
448 const hda_nid_t *slave_dig_outs;
449 unsigned int num_adc_nids;
450 const hda_nid_t *adc_nids;
451 const hda_nid_t *capsrc_nids;
452 hda_nid_t dig_in_nid;
453 unsigned int num_channel_mode;
454 const struct hda_channel_mode *channel_mode;
456 int const_channel_count;
457 unsigned int num_mux_defs;
458 const struct hda_input_mux *input_mux;
459 void (*unsol_event)(struct hda_codec *, unsigned int);
460 void (*setup)(struct hda_codec *);
461 void (*init_hook)(struct hda_codec *);
462 #ifdef CONFIG_SND_HDA_POWER_SAVE
463 const struct hda_amp_list *loopbacks;
464 void (*power_hook)(struct hda_codec *codec);
472 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
473 struct snd_ctl_elem_info *uinfo)
475 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
476 struct alc_spec *spec = codec->spec;
477 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
478 if (mux_idx >= spec->num_mux_defs)
480 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
482 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
485 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
486 struct snd_ctl_elem_value *ucontrol)
488 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
489 struct alc_spec *spec = codec->spec;
490 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
492 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
496 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
497 struct snd_ctl_elem_value *ucontrol)
499 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
500 struct alc_spec *spec = codec->spec;
501 const struct hda_input_mux *imux;
502 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
503 unsigned int mux_idx;
504 hda_nid_t nid = spec->capsrc_nids ?
505 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
508 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
509 imux = &spec->input_mux[mux_idx];
510 if (!imux->num_items && mux_idx > 0)
511 imux = &spec->input_mux[0];
513 type = get_wcaps_type(get_wcaps(codec, nid));
514 if (type == AC_WID_AUD_MIX) {
515 /* Matrix-mixer style (e.g. ALC882) */
516 unsigned int *cur_val = &spec->cur_mux[adc_idx];
519 idx = ucontrol->value.enumerated.item[0];
520 if (idx >= imux->num_items)
521 idx = imux->num_items - 1;
524 for (i = 0; i < imux->num_items; i++) {
525 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
526 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
527 imux->items[i].index,
533 /* MUX style (e.g. ALC880) */
534 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
535 &spec->cur_mux[adc_idx]);
540 * channel mode setting
542 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
543 struct snd_ctl_elem_info *uinfo)
545 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
546 struct alc_spec *spec = codec->spec;
547 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
548 spec->num_channel_mode);
551 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_value *ucontrol)
554 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
555 struct alc_spec *spec = codec->spec;
556 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
557 spec->num_channel_mode,
558 spec->ext_channel_count);
561 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
562 struct snd_ctl_elem_value *ucontrol)
564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
565 struct alc_spec *spec = codec->spec;
566 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
567 spec->num_channel_mode,
568 &spec->ext_channel_count);
569 if (err >= 0 && !spec->const_channel_count) {
570 spec->multiout.max_channels = spec->ext_channel_count;
571 if (spec->need_dac_fix)
572 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
578 * Control the mode of pin widget settings via the mixer. "pc" is used
579 * instead of "%" to avoid consequences of accidentally treating the % as
580 * being part of a format specifier. Maximum allowed length of a value is
581 * 63 characters plus NULL terminator.
583 * Note: some retasking pin complexes seem to ignore requests for input
584 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
585 * are requested. Therefore order this list so that this behaviour will not
586 * cause problems when mixer clients move through the enum sequentially.
587 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
590 static const char * const alc_pin_mode_names[] = {
591 "Mic 50pc bias", "Mic 80pc bias",
592 "Line in", "Line out", "Headphone out",
594 static const unsigned char alc_pin_mode_values[] = {
595 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
597 /* The control can present all 5 options, or it can limit the options based
598 * in the pin being assumed to be exclusively an input or an output pin. In
599 * addition, "input" pins may or may not process the mic bias option
600 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
601 * accept requests for bias as of chip versions up to March 2006) and/or
602 * wiring in the computer.
604 #define ALC_PIN_DIR_IN 0x00
605 #define ALC_PIN_DIR_OUT 0x01
606 #define ALC_PIN_DIR_INOUT 0x02
607 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
608 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
610 /* Info about the pin modes supported by the different pin direction modes.
611 * For each direction the minimum and maximum values are given.
613 static const signed char alc_pin_mode_dir_info[5][2] = {
614 { 0, 2 }, /* ALC_PIN_DIR_IN */
615 { 3, 4 }, /* ALC_PIN_DIR_OUT */
616 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
617 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
618 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
620 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
621 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
622 #define alc_pin_mode_n_items(_dir) \
623 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
625 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
626 struct snd_ctl_elem_info *uinfo)
628 unsigned int item_num = uinfo->value.enumerated.item;
629 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
631 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
633 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
635 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
636 item_num = alc_pin_mode_min(dir);
637 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
641 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
642 struct snd_ctl_elem_value *ucontrol)
645 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
646 hda_nid_t nid = kcontrol->private_value & 0xffff;
647 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
648 long *valp = ucontrol->value.integer.value;
649 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
650 AC_VERB_GET_PIN_WIDGET_CONTROL,
653 /* Find enumerated value for current pinctl setting */
654 i = alc_pin_mode_min(dir);
655 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
657 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
661 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
662 struct snd_ctl_elem_value *ucontrol)
665 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
666 hda_nid_t nid = kcontrol->private_value & 0xffff;
667 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
668 long val = *ucontrol->value.integer.value;
669 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
670 AC_VERB_GET_PIN_WIDGET_CONTROL,
673 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
674 val = alc_pin_mode_min(dir);
676 change = pinctl != alc_pin_mode_values[val];
678 /* Set pin mode to that requested */
679 snd_hda_codec_write_cache(codec, nid, 0,
680 AC_VERB_SET_PIN_WIDGET_CONTROL,
681 alc_pin_mode_values[val]);
683 /* Also enable the retasking pin's input/output as required
684 * for the requested pin mode. Enum values of 2 or less are
687 * Dynamically switching the input/output buffers probably
688 * reduces noise slightly (particularly on input) so we'll
689 * do it. However, having both input and output buffers
690 * enabled simultaneously doesn't seem to be problematic if
691 * this turns out to be necessary in the future.
694 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
695 HDA_AMP_MUTE, HDA_AMP_MUTE);
696 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
699 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
700 HDA_AMP_MUTE, HDA_AMP_MUTE);
701 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
708 #define ALC_PIN_MODE(xname, nid, dir) \
709 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
710 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
711 .info = alc_pin_mode_info, \
712 .get = alc_pin_mode_get, \
713 .put = alc_pin_mode_put, \
714 .private_value = nid | (dir<<16) }
716 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
717 * together using a mask with more than one bit set. This control is
718 * currently used only by the ALC260 test model. At this stage they are not
719 * needed for any "production" models.
721 #ifdef CONFIG_SND_DEBUG
722 #define alc_gpio_data_info snd_ctl_boolean_mono_info
724 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
725 struct snd_ctl_elem_value *ucontrol)
727 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
728 hda_nid_t nid = kcontrol->private_value & 0xffff;
729 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
730 long *valp = ucontrol->value.integer.value;
731 unsigned int val = snd_hda_codec_read(codec, nid, 0,
732 AC_VERB_GET_GPIO_DATA, 0x00);
734 *valp = (val & mask) != 0;
737 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
738 struct snd_ctl_elem_value *ucontrol)
741 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
742 hda_nid_t nid = kcontrol->private_value & 0xffff;
743 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
744 long val = *ucontrol->value.integer.value;
745 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
746 AC_VERB_GET_GPIO_DATA,
749 /* Set/unset the masked GPIO bit(s) as needed */
750 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
755 snd_hda_codec_write_cache(codec, nid, 0,
756 AC_VERB_SET_GPIO_DATA, gpio_data);
760 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
761 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
762 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
763 .info = alc_gpio_data_info, \
764 .get = alc_gpio_data_get, \
765 .put = alc_gpio_data_put, \
766 .private_value = nid | (mask<<16) }
767 #endif /* CONFIG_SND_DEBUG */
769 /* A switch control to allow the enabling of the digital IO pins on the
770 * ALC260. This is incredibly simplistic; the intention of this control is
771 * to provide something in the test model allowing digital outputs to be
772 * identified if present. If models are found which can utilise these
773 * outputs a more complete mixer control can be devised for those models if
776 #ifdef CONFIG_SND_DEBUG
777 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
779 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
780 struct snd_ctl_elem_value *ucontrol)
782 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
783 hda_nid_t nid = kcontrol->private_value & 0xffff;
784 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
785 long *valp = ucontrol->value.integer.value;
786 unsigned int val = snd_hda_codec_read(codec, nid, 0,
787 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
789 *valp = (val & mask) != 0;
792 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
793 struct snd_ctl_elem_value *ucontrol)
796 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
797 hda_nid_t nid = kcontrol->private_value & 0xffff;
798 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
799 long val = *ucontrol->value.integer.value;
800 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
801 AC_VERB_GET_DIGI_CONVERT_1,
804 /* Set/unset the masked control bit(s) as needed */
805 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
810 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
815 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
816 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
817 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
818 .info = alc_spdif_ctrl_info, \
819 .get = alc_spdif_ctrl_get, \
820 .put = alc_spdif_ctrl_put, \
821 .private_value = nid | (mask<<16) }
822 #endif /* CONFIG_SND_DEBUG */
824 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
825 * Again, this is only used in the ALC26x test models to help identify when
826 * the EAPD line must be asserted for features to work.
828 #ifdef CONFIG_SND_DEBUG
829 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
831 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
832 struct snd_ctl_elem_value *ucontrol)
834 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
835 hda_nid_t nid = kcontrol->private_value & 0xffff;
836 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
837 long *valp = ucontrol->value.integer.value;
838 unsigned int val = snd_hda_codec_read(codec, nid, 0,
839 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
841 *valp = (val & mask) != 0;
845 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
846 struct snd_ctl_elem_value *ucontrol)
849 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
850 hda_nid_t nid = kcontrol->private_value & 0xffff;
851 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
852 long val = *ucontrol->value.integer.value;
853 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
854 AC_VERB_GET_EAPD_BTLENABLE,
857 /* Set/unset the masked control bit(s) as needed */
858 change = (!val ? 0 : mask) != (ctrl_data & mask);
863 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
869 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
870 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
871 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
872 .info = alc_eapd_ctrl_info, \
873 .get = alc_eapd_ctrl_get, \
874 .put = alc_eapd_ctrl_put, \
875 .private_value = nid | (mask<<16) }
876 #endif /* CONFIG_SND_DEBUG */
879 * set up the input pin config (depending on the given auto-pin type)
881 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
884 unsigned int val = PIN_IN;
886 if (auto_pin_type == AUTO_PIN_MIC) {
889 oldval = snd_hda_codec_read(codec, nid, 0,
890 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
891 pincap = snd_hda_query_pin_caps(codec, nid);
892 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
893 /* if the default pin setup is vref50, we give it priority */
894 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
896 else if (pincap & AC_PINCAP_VREF_50)
898 else if (pincap & AC_PINCAP_VREF_100)
900 else if (pincap & AC_PINCAP_VREF_GRD)
903 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
906 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
908 struct alc_spec *spec = codec->spec;
909 struct auto_pin_cfg *cfg = &spec->autocfg;
911 if (!cfg->line_outs) {
912 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
913 cfg->line_out_pins[cfg->line_outs])
916 if (!cfg->speaker_outs) {
917 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
918 cfg->speaker_pins[cfg->speaker_outs])
922 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
923 cfg->hp_pins[cfg->hp_outs])
930 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
932 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
934 spec->mixers[spec->num_mixers++] = mix;
937 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
939 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
941 spec->init_verbs[spec->num_init_verbs++] = verb;
945 * set up from the preset table
947 static void setup_preset(struct hda_codec *codec,
948 const struct alc_config_preset *preset)
950 struct alc_spec *spec = codec->spec;
953 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
954 add_mixer(spec, preset->mixers[i]);
955 spec->cap_mixer = preset->cap_mixer;
956 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
958 add_verb(spec, preset->init_verbs[i]);
960 spec->channel_mode = preset->channel_mode;
961 spec->num_channel_mode = preset->num_channel_mode;
962 spec->need_dac_fix = preset->need_dac_fix;
963 spec->const_channel_count = preset->const_channel_count;
965 if (preset->const_channel_count)
966 spec->multiout.max_channels = preset->const_channel_count;
968 spec->multiout.max_channels = spec->channel_mode[0].channels;
969 spec->ext_channel_count = spec->channel_mode[0].channels;
971 spec->multiout.num_dacs = preset->num_dacs;
972 spec->multiout.dac_nids = preset->dac_nids;
973 spec->multiout.dig_out_nid = preset->dig_out_nid;
974 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
975 spec->multiout.hp_nid = preset->hp_nid;
977 spec->num_mux_defs = preset->num_mux_defs;
978 if (!spec->num_mux_defs)
979 spec->num_mux_defs = 1;
980 spec->input_mux = preset->input_mux;
982 spec->num_adc_nids = preset->num_adc_nids;
983 spec->adc_nids = preset->adc_nids;
984 spec->capsrc_nids = preset->capsrc_nids;
985 spec->dig_in_nid = preset->dig_in_nid;
987 spec->unsol_event = preset->unsol_event;
988 spec->init_hook = preset->init_hook;
989 #ifdef CONFIG_SND_HDA_POWER_SAVE
990 spec->power_hook = preset->power_hook;
991 spec->loopback.amplist = preset->loopbacks;
995 preset->setup(codec);
997 alc_fixup_autocfg_pin_nums(codec);
1000 /* Enable GPIO mask and set output */
1001 static const struct hda_verb alc_gpio1_init_verbs[] = {
1002 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
1003 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
1004 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
1008 static const struct hda_verb alc_gpio2_init_verbs[] = {
1009 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
1010 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
1011 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
1015 static const struct hda_verb alc_gpio3_init_verbs[] = {
1016 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
1017 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
1018 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
1023 * Fix hardware PLL issue
1024 * On some codecs, the analog PLL gating control must be off while
1025 * the default value is 1.
1027 static void alc_fix_pll(struct hda_codec *codec)
1029 struct alc_spec *spec = codec->spec;
1034 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1035 spec->pll_coef_idx);
1036 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1037 AC_VERB_GET_PROC_COEF, 0);
1038 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1039 spec->pll_coef_idx);
1040 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1041 val & ~(1 << spec->pll_coef_bit));
1044 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1045 unsigned int coef_idx, unsigned int coef_bit)
1047 struct alc_spec *spec = codec->spec;
1048 spec->pll_nid = nid;
1049 spec->pll_coef_idx = coef_idx;
1050 spec->pll_coef_bit = coef_bit;
1054 static int alc_init_jacks(struct hda_codec *codec)
1056 #ifdef CONFIG_SND_HDA_INPUT_JACK
1057 struct alc_spec *spec = codec->spec;
1059 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1060 unsigned int mic_nid = spec->ext_mic.pin;
1061 unsigned int dock_nid = spec->dock_mic.pin;
1064 err = snd_hda_input_jack_add(codec, hp_nid,
1065 SND_JACK_HEADPHONE, NULL);
1068 snd_hda_input_jack_report(codec, hp_nid);
1072 err = snd_hda_input_jack_add(codec, mic_nid,
1073 SND_JACK_MICROPHONE, NULL);
1076 snd_hda_input_jack_report(codec, mic_nid);
1079 err = snd_hda_input_jack_add(codec, dock_nid,
1080 SND_JACK_MICROPHONE, NULL);
1083 snd_hda_input_jack_report(codec, dock_nid);
1085 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1089 static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
1093 for (i = 0; i < num_pins; i++) {
1094 hda_nid_t nid = pins[i];
1097 snd_hda_input_jack_report(codec, nid);
1098 present |= snd_hda_jack_detect(codec, nid);
1103 static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
1104 bool mute, bool hp_out)
1106 struct alc_spec *spec = codec->spec;
1107 unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0;
1108 unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT);
1111 for (i = 0; i < num_pins; i++) {
1112 hda_nid_t nid = pins[i];
1115 switch (spec->automute_mode) {
1116 case ALC_AUTOMUTE_PIN:
1117 snd_hda_codec_write(codec, nid, 0,
1118 AC_VERB_SET_PIN_WIDGET_CONTROL,
1121 case ALC_AUTOMUTE_AMP:
1122 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1123 HDA_AMP_MUTE, mute_bits);
1125 case ALC_AUTOMUTE_MIXER:
1126 nid = spec->automute_mixer_nid[i];
1129 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
1130 HDA_AMP_MUTE, mute_bits);
1131 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1,
1132 HDA_AMP_MUTE, mute_bits);
1138 /* Toggle internal speakers muting */
1139 static void update_speakers(struct hda_codec *codec)
1141 struct alc_spec *spec = codec->spec;
1144 /* Control HP pins/amps depending on master_mute state;
1145 * in general, HP pins/amps control should be enabled in all cases,
1146 * but currently set only for master_mute, just to be safe
1148 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1149 spec->autocfg.hp_pins, spec->master_mute, true);
1151 if (!spec->automute)
1154 on = spec->jack_present | spec->line_jack_present;
1155 on |= spec->master_mute;
1156 do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins),
1157 spec->autocfg.speaker_pins, on, false);
1159 /* toggle line-out mutes if needed, too */
1160 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1161 if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
1162 spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
1164 if (!spec->automute_lines || !spec->automute)
1167 on = spec->jack_present;
1168 on |= spec->master_mute;
1169 do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1170 spec->autocfg.line_out_pins, on, false);
1173 static void alc_hp_automute(struct hda_codec *codec)
1175 struct alc_spec *spec = codec->spec;
1177 if (!spec->automute)
1179 spec->jack_present =
1180 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1181 spec->autocfg.hp_pins);
1182 update_speakers(codec);
1185 static void alc_line_automute(struct hda_codec *codec)
1187 struct alc_spec *spec = codec->spec;
1189 if (!spec->automute || !spec->detect_line)
1191 spec->line_jack_present =
1192 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1193 spec->autocfg.line_out_pins);
1194 update_speakers(codec);
1197 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1200 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1203 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1204 for (i = 0; i < nums; i++)
1210 /* switch the current ADC according to the jack state */
1211 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1213 struct alc_spec *spec = codec->spec;
1214 unsigned int present;
1217 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1219 spec->cur_adc_idx = 1;
1221 spec->cur_adc_idx = 0;
1222 new_adc = spec->adc_nids[spec->cur_adc_idx];
1223 if (spec->cur_adc && spec->cur_adc != new_adc) {
1224 /* stream is running, let's swap the current ADC */
1225 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1226 spec->cur_adc = new_adc;
1227 snd_hda_codec_setup_stream(codec, new_adc,
1228 spec->cur_adc_stream_tag, 0,
1229 spec->cur_adc_format);
1233 static void alc_mic_automute(struct hda_codec *codec)
1235 struct alc_spec *spec = codec->spec;
1236 struct alc_mic_route *dead1, *dead2, *alive;
1237 unsigned int present, type;
1240 if (!spec->auto_mic)
1242 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1244 if (snd_BUG_ON(!spec->adc_nids))
1247 if (spec->dual_adc_switch) {
1248 alc_dual_mic_adc_auto_switch(codec);
1252 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1254 alive = &spec->int_mic;
1255 dead1 = &spec->ext_mic;
1256 dead2 = &spec->dock_mic;
1258 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1260 alive = &spec->ext_mic;
1261 dead1 = &spec->int_mic;
1262 dead2 = &spec->dock_mic;
1264 if (!present && spec->dock_mic.pin > 0) {
1265 present = snd_hda_jack_detect(codec, spec->dock_mic.pin);
1267 alive = &spec->dock_mic;
1268 dead1 = &spec->int_mic;
1269 dead2 = &spec->ext_mic;
1271 snd_hda_input_jack_report(codec, spec->dock_mic.pin);
1274 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1275 if (type == AC_WID_AUD_MIX) {
1276 /* Matrix-mixer style (e.g. ALC882) */
1277 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1281 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1283 HDA_AMP_MUTE, HDA_AMP_MUTE);
1285 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1287 HDA_AMP_MUTE, HDA_AMP_MUTE);
1289 /* MUX style (e.g. ALC880) */
1290 snd_hda_codec_write_cache(codec, cap_nid, 0,
1291 AC_VERB_SET_CONNECT_SEL,
1294 snd_hda_input_jack_report(codec, spec->ext_mic.pin);
1296 /* FIXME: analog mixer */
1299 /* unsolicited event for HP jack sensing */
1300 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1302 if (codec->vendor_id == 0x10ec0880)
1307 case ALC880_HP_EVENT:
1308 alc_hp_automute(codec);
1310 case ALC880_FRONT_EVENT:
1311 alc_line_automute(codec);
1313 case ALC880_MIC_EVENT:
1314 alc_mic_automute(codec);
1319 static void alc_inithook(struct hda_codec *codec)
1321 alc_hp_automute(codec);
1322 alc_line_automute(codec);
1323 alc_mic_automute(codec);
1326 /* additional initialization for ALC888 variants */
1327 static void alc888_coef_init(struct hda_codec *codec)
1331 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1332 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1333 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1334 if ((tmp & 0xf0) == 0x20)
1336 snd_hda_codec_read(codec, 0x20, 0,
1337 AC_VERB_SET_PROC_COEF, 0x830);
1340 snd_hda_codec_read(codec, 0x20, 0,
1341 AC_VERB_SET_PROC_COEF, 0x3030);
1344 static void alc889_coef_init(struct hda_codec *codec)
1348 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1349 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1350 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1351 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1354 /* turn on/off EAPD control (only if available) */
1355 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1357 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1359 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1360 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1364 /* turn on/off EAPD controls of the codec */
1365 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
1367 /* We currently only handle front, HP */
1368 switch (codec->vendor_id) {
1370 set_eapd(codec, 0x0f, on);
1371 set_eapd(codec, 0x10, on);
1386 set_eapd(codec, 0x14, on);
1387 set_eapd(codec, 0x15, on);
1392 /* generic shutup callback;
1393 * just turning off EPAD and a little pause for avoiding pop-noise
1395 static void alc_eapd_shutup(struct hda_codec *codec)
1397 alc_auto_setup_eapd(codec, false);
1401 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1406 case ALC_INIT_GPIO1:
1407 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1409 case ALC_INIT_GPIO2:
1410 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1412 case ALC_INIT_GPIO3:
1413 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1415 case ALC_INIT_DEFAULT:
1416 alc_auto_setup_eapd(codec, true);
1417 switch (codec->vendor_id) {
1419 snd_hda_codec_write(codec, 0x1a, 0,
1420 AC_VERB_SET_COEF_INDEX, 7);
1421 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1422 AC_VERB_GET_PROC_COEF, 0);
1423 snd_hda_codec_write(codec, 0x1a, 0,
1424 AC_VERB_SET_COEF_INDEX, 7);
1425 snd_hda_codec_write(codec, 0x1a, 0,
1426 AC_VERB_SET_PROC_COEF,
1435 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1436 alc889_coef_init(codec);
1439 alc888_coef_init(codec);
1441 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1444 snd_hda_codec_write(codec, 0x20, 0,
1445 AC_VERB_SET_COEF_INDEX, 7);
1446 tmp = snd_hda_codec_read(codec, 0x20, 0,
1447 AC_VERB_GET_PROC_COEF, 0);
1448 snd_hda_codec_write(codec, 0x20, 0,
1449 AC_VERB_SET_COEF_INDEX, 7);
1450 snd_hda_codec_write(codec, 0x20, 0,
1451 AC_VERB_SET_PROC_COEF,
1460 static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
1461 struct snd_ctl_elem_info *uinfo)
1463 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1464 struct alc_spec *spec = codec->spec;
1465 static const char * const texts2[] = {
1466 "Disabled", "Enabled"
1468 static const char * const texts3[] = {
1469 "Disabled", "Speaker Only", "Line-Out+Speaker"
1471 const char * const *texts;
1473 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1475 if (spec->automute_hp_lo) {
1476 uinfo->value.enumerated.items = 3;
1479 uinfo->value.enumerated.items = 2;
1482 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1483 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
1484 strcpy(uinfo->value.enumerated.name,
1485 texts[uinfo->value.enumerated.item]);
1489 static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
1490 struct snd_ctl_elem_value *ucontrol)
1492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1493 struct alc_spec *spec = codec->spec;
1495 if (!spec->automute)
1497 else if (!spec->automute_lines)
1501 ucontrol->value.enumerated.item[0] = val;
1505 static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
1506 struct snd_ctl_elem_value *ucontrol)
1508 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1509 struct alc_spec *spec = codec->spec;
1511 switch (ucontrol->value.enumerated.item[0]) {
1513 if (!spec->automute)
1518 if (spec->automute && !spec->automute_lines)
1521 spec->automute_lines = 0;
1524 if (!spec->automute_hp_lo)
1526 if (spec->automute && spec->automute_lines)
1529 spec->automute_lines = 1;
1534 update_speakers(codec);
1538 static const struct snd_kcontrol_new alc_automute_mode_enum = {
1539 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1540 .name = "Auto-Mute Mode",
1541 .info = alc_automute_mode_info,
1542 .get = alc_automute_mode_get,
1543 .put = alc_automute_mode_put,
1546 static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec);
1548 static int alc_add_automute_mode_enum(struct hda_codec *codec)
1550 struct alc_spec *spec = codec->spec;
1551 struct snd_kcontrol_new *knew;
1553 knew = alc_kcontrol_new(spec);
1556 *knew = alc_automute_mode_enum;
1557 knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
1563 static void alc_init_auto_hp(struct hda_codec *codec)
1565 struct alc_spec *spec = codec->spec;
1566 struct auto_pin_cfg *cfg = &spec->autocfg;
1570 if (cfg->hp_pins[0])
1572 if (cfg->line_out_pins[0])
1574 if (cfg->speaker_pins[0])
1576 if (present < 2) /* need two different output types */
1579 spec->automute_hp_lo = 1; /* both HP and LO automute */
1581 if (!cfg->speaker_pins[0]) {
1582 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1583 sizeof(cfg->speaker_pins));
1584 cfg->speaker_outs = cfg->line_outs;
1587 if (!cfg->hp_pins[0]) {
1588 memcpy(cfg->hp_pins, cfg->line_out_pins,
1589 sizeof(cfg->hp_pins));
1590 cfg->hp_outs = cfg->line_outs;
1593 for (i = 0; i < cfg->hp_outs; i++) {
1594 hda_nid_t nid = cfg->hp_pins[i];
1595 if (!is_jack_detectable(codec, nid))
1597 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1599 snd_hda_codec_write_cache(codec, nid, 0,
1600 AC_VERB_SET_UNSOLICITED_ENABLE,
1601 AC_USRSP_EN | ALC880_HP_EVENT);
1603 spec->automute_mode = ALC_AUTOMUTE_PIN;
1605 if (spec->automute && cfg->line_out_pins[0] &&
1606 cfg->line_out_pins[0] != cfg->hp_pins[0] &&
1607 cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1608 for (i = 0; i < cfg->line_outs; i++) {
1609 hda_nid_t nid = cfg->line_out_pins[i];
1610 if (!is_jack_detectable(codec, nid))
1612 snd_printdd("realtek: Enable Line-Out auto-muting "
1613 "on NID 0x%x\n", nid);
1614 snd_hda_codec_write_cache(codec, nid, 0,
1615 AC_VERB_SET_UNSOLICITED_ENABLE,
1616 AC_USRSP_EN | ALC880_FRONT_EVENT);
1617 spec->detect_line = 1;
1619 spec->automute_lines = spec->detect_line;
1622 if (spec->automute) {
1623 /* create a control for automute mode */
1624 alc_add_automute_mode_enum(codec);
1625 spec->unsol_event = alc_sku_unsol_event;
1629 static void alc_init_auto_mic(struct hda_codec *codec)
1631 struct alc_spec *spec = codec->spec;
1632 struct auto_pin_cfg *cfg = &spec->autocfg;
1633 hda_nid_t fixed, ext, dock;
1636 fixed = ext = dock = 0;
1637 for (i = 0; i < cfg->num_inputs; i++) {
1638 hda_nid_t nid = cfg->inputs[i].pin;
1639 unsigned int defcfg;
1640 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1641 switch (snd_hda_get_input_pin_attr(defcfg)) {
1642 case INPUT_PIN_ATTR_INT:
1644 return; /* already occupied */
1645 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1646 return; /* invalid type */
1649 case INPUT_PIN_ATTR_UNUSED:
1650 return; /* invalid entry */
1651 case INPUT_PIN_ATTR_DOCK:
1653 return; /* already occupied */
1654 if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
1655 return; /* invalid type */
1660 return; /* already occupied */
1661 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1662 return; /* invalid type */
1673 if (!is_jack_detectable(codec, ext))
1674 return; /* no unsol support */
1675 if (dock && !is_jack_detectable(codec, dock))
1676 return; /* no unsol support */
1677 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1679 spec->ext_mic.pin = ext;
1680 spec->dock_mic.pin = dock;
1681 spec->int_mic.pin = fixed;
1682 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1683 spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1684 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1686 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1687 AC_VERB_SET_UNSOLICITED_ENABLE,
1688 AC_USRSP_EN | ALC880_MIC_EVENT);
1689 spec->unsol_event = alc_sku_unsol_event;
1692 /* Could be any non-zero and even value. When used as fixup, tells
1693 * the driver to ignore any present sku defines.
1695 #define ALC_FIXUP_SKU_IGNORE (2)
1697 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1699 unsigned int ass, tmp, i;
1701 struct alc_spec *spec = codec->spec;
1703 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1705 if (spec->cdefine.fixup) {
1706 ass = spec->cdefine.sku_cfg;
1707 if (ass == ALC_FIXUP_SKU_IGNORE)
1712 ass = codec->subsystem_id & 0xffff;
1713 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1717 if (codec->vendor_id == 0x10ec0260)
1719 ass = snd_hda_codec_get_pincfg(codec, nid);
1722 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1723 codec->chip_name, ass);
1729 for (i = 1; i < 16; i++) {
1733 if (((ass >> 16) & 0xf) != tmp)
1736 spec->cdefine.port_connectivity = ass >> 30;
1737 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1738 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1739 spec->cdefine.customization = ass >> 8;
1741 spec->cdefine.sku_cfg = ass;
1742 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1743 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1744 spec->cdefine.swap = (ass & 0x2) >> 1;
1745 spec->cdefine.override = ass & 0x1;
1747 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1748 nid, spec->cdefine.sku_cfg);
1749 snd_printd("SKU: port_connectivity=0x%x\n",
1750 spec->cdefine.port_connectivity);
1751 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1752 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1753 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1754 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1755 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1756 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1757 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1762 /* check subsystem ID and set up device-specific initialization;
1763 * return 1 if initialized, 0 if invalid SSID
1765 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1766 * 31 ~ 16 : Manufacture ID
1768 * 7 ~ 0 : Assembly ID
1769 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1771 static int alc_subsystem_id(struct hda_codec *codec,
1772 hda_nid_t porta, hda_nid_t porte,
1773 hda_nid_t portd, hda_nid_t porti)
1775 unsigned int ass, tmp, i;
1777 struct alc_spec *spec = codec->spec;
1779 if (spec->cdefine.fixup) {
1780 ass = spec->cdefine.sku_cfg;
1781 if (ass == ALC_FIXUP_SKU_IGNORE)
1786 ass = codec->subsystem_id & 0xffff;
1787 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1790 /* invalid SSID, check the special NID pin defcfg instead */
1792 * 31~30 : port connectivity
1795 * 19~16 : Check sum (15:1)
1800 if (codec->vendor_id == 0x10ec0260)
1802 ass = snd_hda_codec_get_pincfg(codec, nid);
1803 snd_printd("realtek: No valid SSID, "
1804 "checking pincfg 0x%08x for NID 0x%x\n",
1808 if ((ass >> 30) != 1) /* no physical connection */
1813 for (i = 1; i < 16; i++) {
1817 if (((ass >> 16) & 0xf) != tmp)
1820 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1821 ass & 0xffff, codec->vendor_id);
1825 * 2 : 0 --> Desktop, 1 --> Laptop
1826 * 3~5 : External Amplifier control
1829 tmp = (ass & 0x38) >> 3; /* external Amp control */
1832 spec->init_amp = ALC_INIT_GPIO1;
1835 spec->init_amp = ALC_INIT_GPIO2;
1838 spec->init_amp = ALC_INIT_GPIO3;
1842 spec->init_amp = ALC_INIT_DEFAULT;
1846 /* is laptop or Desktop and enable the function "Mute internal speaker
1847 * when the external headphone out jack is plugged"
1849 if (!(ass & 0x8000))
1852 * 10~8 : Jack location
1853 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1855 * 15 : 1 --> enable the function "Mute internal speaker
1856 * when the external headphone out jack is plugged"
1858 if (!spec->autocfg.hp_pins[0]) {
1860 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1871 for (i = 0; i < spec->autocfg.line_outs; i++)
1872 if (spec->autocfg.line_out_pins[i] == nid)
1874 spec->autocfg.hp_pins[0] = nid;
1879 static void alc_ssid_check(struct hda_codec *codec,
1880 hda_nid_t porta, hda_nid_t porte,
1881 hda_nid_t portd, hda_nid_t porti)
1883 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1884 struct alc_spec *spec = codec->spec;
1885 snd_printd("realtek: "
1886 "Enable default setup for auto mode as fallback\n");
1887 spec->init_amp = ALC_INIT_DEFAULT;
1890 alc_init_auto_hp(codec);
1891 alc_init_auto_mic(codec);
1895 * Fix-up pin default configurations and add default verbs
1903 struct alc_model_fixup {
1914 const struct alc_pincfg *pins;
1915 const struct hda_verb *verbs;
1916 void (*func)(struct hda_codec *codec,
1917 const struct alc_fixup *fix,
1931 ALC_FIXUP_ACT_PRE_PROBE,
1932 ALC_FIXUP_ACT_PROBE,
1936 static void alc_apply_fixup(struct hda_codec *codec, int action)
1938 struct alc_spec *spec = codec->spec;
1939 int id = spec->fixup_id;
1940 #ifdef CONFIG_SND_DEBUG_VERBOSE
1941 const char *modelname = spec->fixup_name;
1945 if (!spec->fixup_list)
1949 const struct alc_fixup *fix = spec->fixup_list + id;
1950 const struct alc_pincfg *cfg;
1952 switch (fix->type) {
1954 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1956 snd_printdd(KERN_INFO "hda_codec: %s: "
1957 "Apply sku override for %s\n",
1958 codec->chip_name, modelname);
1959 spec->cdefine.sku_cfg = fix->v.sku;
1960 spec->cdefine.fixup = 1;
1962 case ALC_FIXUP_PINS:
1964 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1966 snd_printdd(KERN_INFO "hda_codec: %s: "
1967 "Apply pincfg for %s\n",
1968 codec->chip_name, modelname);
1969 for (; cfg->nid; cfg++)
1970 snd_hda_codec_set_pincfg(codec, cfg->nid,
1973 case ALC_FIXUP_VERBS:
1974 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1976 snd_printdd(KERN_INFO "hda_codec: %s: "
1977 "Apply fix-verbs for %s\n",
1978 codec->chip_name, modelname);
1979 add_verb(codec->spec, fix->v.verbs);
1981 case ALC_FIXUP_FUNC:
1984 snd_printdd(KERN_INFO "hda_codec: %s: "
1985 "Apply fix-func for %s\n",
1986 codec->chip_name, modelname);
1987 fix->v.func(codec, fix, action);
1990 snd_printk(KERN_ERR "hda_codec: %s: "
1991 "Invalid fixup type %d\n",
1992 codec->chip_name, fix->type);
2003 static void alc_pick_fixup(struct hda_codec *codec,
2004 const struct alc_model_fixup *models,
2005 const struct snd_pci_quirk *quirk,
2006 const struct alc_fixup *fixlist)
2008 struct alc_spec *spec = codec->spec;
2010 const char *name = NULL;
2012 if (codec->modelname && models) {
2013 while (models->name) {
2014 if (!strcmp(codec->modelname, models->name)) {
2016 name = models->name;
2023 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
2026 #ifdef CONFIG_SND_DEBUG_VERBOSE
2032 spec->fixup_id = id;
2034 spec->fixup_list = fixlist;
2035 spec->fixup_name = name;
2039 static int alc_read_coef_idx(struct hda_codec *codec,
2040 unsigned int coef_idx)
2043 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
2045 val = snd_hda_codec_read(codec, 0x20, 0,
2046 AC_VERB_GET_PROC_COEF, 0);
2050 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
2051 unsigned int coef_val)
2053 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
2055 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
2059 /* set right pin controls for digital I/O */
2060 static void alc_auto_init_digital(struct hda_codec *codec)
2062 struct alc_spec *spec = codec->spec;
2066 for (i = 0; i < spec->autocfg.dig_outs; i++) {
2067 pin = spec->autocfg.dig_out_pins[i];
2069 snd_hda_codec_write(codec, pin, 0,
2070 AC_VERB_SET_PIN_WIDGET_CONTROL,
2074 pin = spec->autocfg.dig_in_pin;
2076 snd_hda_codec_write(codec, pin, 0,
2077 AC_VERB_SET_PIN_WIDGET_CONTROL,
2081 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
2082 static void alc_auto_parse_digital(struct hda_codec *codec)
2084 struct alc_spec *spec = codec->spec;
2088 /* support multiple SPDIFs; the secondary is set up as a slave */
2089 for (i = 0; i < spec->autocfg.dig_outs; i++) {
2090 err = snd_hda_get_connections(codec,
2091 spec->autocfg.dig_out_pins[i],
2096 spec->multiout.dig_out_nid = dig_nid;
2097 spec->dig_out_type = spec->autocfg.dig_out_type[0];
2099 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
2100 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
2102 spec->slave_dig_outs[i - 1] = dig_nid;
2106 if (spec->autocfg.dig_in_pin) {
2107 dig_nid = codec->start_nid;
2108 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
2109 unsigned int wcaps = get_wcaps(codec, dig_nid);
2110 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
2112 if (!(wcaps & AC_WCAP_DIGITAL))
2114 if (!(wcaps & AC_WCAP_CONN_LIST))
2116 err = get_connection_index(codec, dig_nid,
2117 spec->autocfg.dig_in_pin);
2119 spec->dig_in_nid = dig_nid;
2133 static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
2134 /* Mic-in jack as mic in */
2135 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2136 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2137 /* Line-in jack as Line in */
2138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2140 /* Line-Out as Front */
2141 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
2148 static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
2149 /* Mic-in jack as mic in */
2150 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2151 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2152 /* Line-in jack as Surround */
2153 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2154 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2155 /* Line-Out as Front */
2156 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
2163 static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
2164 /* Mic-in jack as CLFE */
2165 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2166 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2167 /* Line-in jack as Surround */
2168 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2169 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2170 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
2171 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2178 static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
2179 /* Mic-in jack as CLFE */
2180 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2181 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2182 /* Line-in jack as Surround */
2183 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2184 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2185 /* Line-Out as Side */
2186 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2190 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
2191 { 2, alc888_4ST_ch2_intel_init },
2192 { 4, alc888_4ST_ch4_intel_init },
2193 { 6, alc888_4ST_ch6_intel_init },
2194 { 8, alc888_4ST_ch8_intel_init },
2198 * ALC888 Fujitsu Siemens Amillo xa3530
2201 static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
2202 /* Front Mic: set to PIN_IN (empty by default) */
2203 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2204 /* Connect Internal HP to Front */
2205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2206 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2207 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2208 /* Connect Bass HP to Front */
2209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2211 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2212 /* Connect Line-Out side jack (SPDIF) to Side */
2213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2214 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2215 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2216 /* Connect Mic jack to CLFE */
2217 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2218 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2219 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2220 /* Connect Line-in jack to Surround */
2221 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2222 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2223 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2224 /* Connect HP out jack to Front */
2225 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2226 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2227 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2228 /* Enable unsolicited event for HP jack and Line-out jack */
2229 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2230 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2234 static void alc889_automute_setup(struct hda_codec *codec)
2236 struct alc_spec *spec = codec->spec;
2238 spec->autocfg.hp_pins[0] = 0x15;
2239 spec->autocfg.speaker_pins[0] = 0x14;
2240 spec->autocfg.speaker_pins[1] = 0x16;
2241 spec->autocfg.speaker_pins[2] = 0x17;
2242 spec->autocfg.speaker_pins[3] = 0x19;
2243 spec->autocfg.speaker_pins[4] = 0x1a;
2245 spec->automute_mode = ALC_AUTOMUTE_AMP;
2248 static void alc889_intel_init_hook(struct hda_codec *codec)
2250 alc889_coef_init(codec);
2251 alc_hp_automute(codec);
2254 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2256 struct alc_spec *spec = codec->spec;
2258 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2259 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2260 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2261 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2263 spec->automute_mode = ALC_AUTOMUTE_AMP;
2267 * ALC888 Acer Aspire 4930G model
2270 static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2271 /* Front Mic: set to PIN_IN (empty by default) */
2272 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2273 /* Unselect Front Mic by default in input mixer 3 */
2274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2275 /* Enable unsolicited event for HP jack */
2276 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2277 /* Connect Internal HP to front */
2278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2279 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2280 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2281 /* Connect HP out to front */
2282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2285 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2290 * ALC888 Acer Aspire 6530G model
2293 static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2294 /* Route to built-in subwoofer as well as speakers */
2295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2298 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2299 /* Bias voltage on for external mic port */
2300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2301 /* Front Mic: set to PIN_IN (empty by default) */
2302 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2303 /* Unselect Front Mic by default in input mixer 3 */
2304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2305 /* Enable unsolicited event for HP jack */
2306 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2307 /* Enable speaker output */
2308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2310 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2311 /* Enable headphone output */
2312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2314 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2315 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2320 *ALC888 Acer Aspire 7730G model
2323 static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2324 /* Bias voltage on for external mic port */
2325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2326 /* Front Mic: set to PIN_IN (empty by default) */
2327 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2328 /* Unselect Front Mic by default in input mixer 3 */
2329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2330 /* Enable unsolicited event for HP jack */
2331 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2332 /* Enable speaker output */
2333 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2334 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2335 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2336 /* Enable headphone output */
2337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2339 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2340 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2341 /*Enable internal subwoofer */
2342 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2343 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2344 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2345 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2350 * ALC889 Acer Aspire 8930G model
2353 static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2354 /* Front Mic: set to PIN_IN (empty by default) */
2355 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2356 /* Unselect Front Mic by default in input mixer 3 */
2357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2358 /* Enable unsolicited event for HP jack */
2359 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2360 /* Connect Internal Front to Front */
2361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2362 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2363 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2364 /* Connect Internal Rear to Rear */
2365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2366 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2367 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2368 /* Connect Internal CLFE to CLFE */
2369 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2370 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2371 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2372 /* Connect HP out to Front */
2373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2374 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2376 /* Enable all DACs */
2377 /* DAC DISABLE/MUTE 1? */
2378 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2379 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2380 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2381 /* DAC DISABLE/MUTE 2? */
2382 /* some bit here disables the other DACs. Init=0x4900 */
2383 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2384 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2386 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2387 * which makes the stereo useless. However, either the mic or the ALC889
2388 * makes the signal become a difference/sum signal instead of standard
2389 * stereo, which is annoying. So instead we flip this bit which makes the
2390 * codec replicate the sum signal to both channels, turning it into a
2393 /* DMIC_CONTROL? Init value = 0x0001 */
2394 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2395 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2399 static const struct hda_input_mux alc888_2_capture_sources[2] = {
2400 /* Front mic only available on one ADC */
2407 { "Front Mic", 0xb },
2420 static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2421 /* Interal mic only available on one ADC */
2428 { "Input Mix", 0xa },
2429 { "Internal Mic", 0xb },
2438 { "Input Mix", 0xa },
2443 static const struct hda_input_mux alc889_capture_sources[3] = {
2444 /* Digital mic only available on first "ADC" */
2451 { "Front Mic", 0xb },
2452 { "Input Mix", 0xa },
2461 { "Input Mix", 0xa },
2470 { "Input Mix", 0xa },
2475 static const struct snd_kcontrol_new alc888_base_mixer[] = {
2476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2478 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2479 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2480 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2482 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2483 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2484 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2485 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2486 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2487 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2488 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2489 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2490 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2491 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2492 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2497 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2498 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2499 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2500 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2501 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2502 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2504 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2505 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2506 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2507 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2508 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2514 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2519 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2522 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2523 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2524 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2526 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2527 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2528 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2529 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2530 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2532 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2538 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2540 struct alc_spec *spec = codec->spec;
2542 spec->autocfg.hp_pins[0] = 0x15;
2543 spec->autocfg.speaker_pins[0] = 0x14;
2544 spec->autocfg.speaker_pins[1] = 0x16;
2545 spec->autocfg.speaker_pins[2] = 0x17;
2547 spec->automute_mode = ALC_AUTOMUTE_AMP;
2550 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2552 struct alc_spec *spec = codec->spec;
2554 spec->autocfg.hp_pins[0] = 0x15;
2555 spec->autocfg.speaker_pins[0] = 0x14;
2556 spec->autocfg.speaker_pins[1] = 0x16;
2557 spec->autocfg.speaker_pins[2] = 0x17;
2559 spec->automute_mode = ALC_AUTOMUTE_AMP;
2562 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2564 struct alc_spec *spec = codec->spec;
2566 spec->autocfg.hp_pins[0] = 0x15;
2567 spec->autocfg.speaker_pins[0] = 0x14;
2568 spec->autocfg.speaker_pins[1] = 0x16;
2569 spec->autocfg.speaker_pins[2] = 0x17;
2571 spec->automute_mode = ALC_AUTOMUTE_AMP;
2574 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2576 struct alc_spec *spec = codec->spec;
2578 spec->autocfg.hp_pins[0] = 0x15;
2579 spec->autocfg.speaker_pins[0] = 0x14;
2580 spec->autocfg.speaker_pins[1] = 0x16;
2581 spec->autocfg.speaker_pins[2] = 0x1b;
2583 spec->automute_mode = ALC_AUTOMUTE_AMP;
2587 * ALC880 3-stack model
2589 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2590 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2591 * F-Mic = 0x1b, HP = 0x19
2594 static const hda_nid_t alc880_dac_nids[4] = {
2595 /* front, rear, clfe, rear_surr */
2596 0x02, 0x05, 0x04, 0x03
2599 static const hda_nid_t alc880_adc_nids[3] = {
2604 /* The datasheet says the node 0x07 is connected from inputs,
2605 * but it shows zero connection in the real implementation on some devices.
2606 * Note: this is a 915GAV bug, fixed on 915GLV
2608 static const hda_nid_t alc880_adc_nids_alt[2] = {
2613 #define ALC880_DIGOUT_NID 0x06
2614 #define ALC880_DIGIN_NID 0x0a
2616 static const struct hda_input_mux alc880_capture_source = {
2620 { "Front Mic", 0x3 },
2626 /* channel source setting (2/6 channel selection for 3-stack) */
2628 static const struct hda_verb alc880_threestack_ch2_init[] = {
2629 /* set line-in to input, mute it */
2630 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2631 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2632 /* set mic-in to input vref 80%, mute it */
2633 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2634 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2639 static const struct hda_verb alc880_threestack_ch6_init[] = {
2640 /* set line-in to output, unmute it */
2641 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2642 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2643 /* set mic-in to output, unmute it */
2644 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2645 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2649 static const struct hda_channel_mode alc880_threestack_modes[2] = {
2650 { 2, alc880_threestack_ch2_init },
2651 { 6, alc880_threestack_ch6_init },
2654 static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2655 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2656 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2658 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2660 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2661 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2662 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2663 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2664 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2669 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2671 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2673 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2674 .name = "Channel Mode",
2675 .info = alc_ch_mode_info,
2676 .get = alc_ch_mode_get,
2677 .put = alc_ch_mode_put,
2682 /* capture mixer elements */
2683 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2684 struct snd_ctl_elem_info *uinfo)
2686 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2687 struct alc_spec *spec = codec->spec;
2690 mutex_lock(&codec->control_mutex);
2691 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2693 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2694 mutex_unlock(&codec->control_mutex);
2698 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2699 unsigned int size, unsigned int __user *tlv)
2701 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2702 struct alc_spec *spec = codec->spec;
2705 mutex_lock(&codec->control_mutex);
2706 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2708 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2709 mutex_unlock(&codec->control_mutex);
2713 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2714 struct snd_ctl_elem_value *ucontrol);
2716 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2717 struct snd_ctl_elem_value *ucontrol,
2720 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2721 struct alc_spec *spec = codec->spec;
2722 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2725 mutex_lock(&codec->control_mutex);
2726 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2728 err = func(kcontrol, ucontrol);
2729 mutex_unlock(&codec->control_mutex);
2733 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2734 struct snd_ctl_elem_value *ucontrol)
2736 return alc_cap_getput_caller(kcontrol, ucontrol,
2737 snd_hda_mixer_amp_volume_get);
2740 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2741 struct snd_ctl_elem_value *ucontrol)
2743 return alc_cap_getput_caller(kcontrol, ucontrol,
2744 snd_hda_mixer_amp_volume_put);
2747 /* capture mixer elements */
2748 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2750 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2751 struct snd_ctl_elem_value *ucontrol)
2753 return alc_cap_getput_caller(kcontrol, ucontrol,
2754 snd_hda_mixer_amp_switch_get);
2757 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2758 struct snd_ctl_elem_value *ucontrol)
2760 return alc_cap_getput_caller(kcontrol, ucontrol,
2761 snd_hda_mixer_amp_switch_put);
2764 #define _DEFINE_CAPMIX(num) \
2766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2767 .name = "Capture Switch", \
2768 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2770 .info = alc_cap_sw_info, \
2771 .get = alc_cap_sw_get, \
2772 .put = alc_cap_sw_put, \
2775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2776 .name = "Capture Volume", \
2777 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2778 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2779 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2781 .info = alc_cap_vol_info, \
2782 .get = alc_cap_vol_get, \
2783 .put = alc_cap_vol_put, \
2784 .tlv = { .c = alc_cap_vol_tlv }, \
2787 #define _DEFINE_CAPSRC(num) \
2789 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2790 /* .name = "Capture Source", */ \
2791 .name = "Input Source", \
2793 .info = alc_mux_enum_info, \
2794 .get = alc_mux_enum_get, \
2795 .put = alc_mux_enum_put, \
2798 #define DEFINE_CAPMIX(num) \
2799 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2800 _DEFINE_CAPMIX(num), \
2801 _DEFINE_CAPSRC(num), \
2805 #define DEFINE_CAPMIX_NOSRC(num) \
2806 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2807 _DEFINE_CAPMIX(num), \
2811 /* up to three ADCs */
2815 DEFINE_CAPMIX_NOSRC(1);
2816 DEFINE_CAPMIX_NOSRC(2);
2817 DEFINE_CAPMIX_NOSRC(3);
2820 * ALC880 5-stack model
2822 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2824 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2825 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2828 /* additional mixers to alc880_three_stack_mixer */
2829 static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2830 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2831 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2835 /* channel source setting (6/8 channel selection for 5-stack) */
2837 static const struct hda_verb alc880_fivestack_ch6_init[] = {
2838 /* set line-in to input, mute it */
2839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2845 static const struct hda_verb alc880_fivestack_ch8_init[] = {
2846 /* set line-in to output, unmute it */
2847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2852 static const struct hda_channel_mode alc880_fivestack_modes[2] = {
2853 { 6, alc880_fivestack_ch6_init },
2854 { 8, alc880_fivestack_ch8_init },
2859 * ALC880 6-stack model
2861 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2862 * Side = 0x05 (0x0f)
2863 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2864 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2867 static const hda_nid_t alc880_6st_dac_nids[4] = {
2868 /* front, rear, clfe, rear_surr */
2869 0x02, 0x03, 0x04, 0x05
2872 static const struct hda_input_mux alc880_6stack_capture_source = {
2876 { "Front Mic", 0x1 },
2882 /* fixed 8-channels */
2883 static const struct hda_channel_mode alc880_sixstack_modes[1] = {
2887 static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2888 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2889 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2890 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2891 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2892 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2893 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2894 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2895 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2896 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2897 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2902 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2903 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2904 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2905 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2907 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2908 .name = "Channel Mode",
2909 .info = alc_ch_mode_info,
2910 .get = alc_ch_mode_get,
2911 .put = alc_ch_mode_put,
2920 * W810 has rear IO for:
2923 * Center/LFE (DAC 04)
2926 * The system also has a pair of internal speakers, and a headphone jack.
2927 * These are both connected to Line2 on the codec, hence to DAC 02.
2929 * There is a variable resistor to control the speaker or headphone
2930 * volume. This is a hardware-only device without a software API.
2932 * Plugging headphones in will disable the internal speakers. This is
2933 * implemented in hardware, not via the driver using jack sense. In
2934 * a similar fashion, plugging into the rear socket marked "front" will
2935 * disable both the speakers and headphones.
2937 * For input, there's a microphone jack, and an "audio in" jack.
2938 * These may not do anything useful with this driver yet, because I
2939 * haven't setup any initialization verbs for these yet...
2942 static const hda_nid_t alc880_w810_dac_nids[3] = {
2943 /* front, rear/surround, clfe */
2947 /* fixed 6 channels */
2948 static const struct hda_channel_mode alc880_w810_modes[1] = {
2952 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2953 static const struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2955 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2957 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2958 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2959 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2960 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2961 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2962 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2970 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2971 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2975 static const hda_nid_t alc880_z71v_dac_nids[1] = {
2978 #define ALC880_Z71V_HP_DAC 0x03
2980 /* fixed 2 channels */
2981 static const struct hda_channel_mode alc880_2_jack_modes[1] = {
2985 static const struct snd_kcontrol_new alc880_z71v_mixer[] = {
2986 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2987 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2988 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2989 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2999 * ALC880 F1734 model
3001 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
3002 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
3005 static const hda_nid_t alc880_f1734_dac_nids[1] = {
3008 #define ALC880_F1734_HP_DAC 0x02
3010 static const struct snd_kcontrol_new alc880_f1734_mixer[] = {
3011 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3012 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3014 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3015 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3016 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3017 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3018 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3022 static const struct hda_input_mux alc880_f1734_capture_source = {
3034 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3035 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3036 * Mic = 0x18, Line = 0x1a
3039 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3040 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3042 static const struct snd_kcontrol_new alc880_asus_mixer[] = {
3043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3045 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3046 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3048 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3049 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3050 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3051 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3052 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3053 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3054 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3059 .name = "Channel Mode",
3060 .info = alc_ch_mode_info,
3061 .get = alc_ch_mode_get,
3062 .put = alc_ch_mode_put,
3068 * ALC880 ASUS W1V model
3070 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3071 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3072 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
3075 /* additional mixers to alc880_asus_mixer */
3076 static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
3077 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
3078 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
3083 static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
3084 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3085 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
3086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
3087 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
3088 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
3089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
3090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
3091 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
3092 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
3097 static const struct snd_kcontrol_new alc880_uniwill_mixer[] = {
3098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3099 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3101 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3102 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3103 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3104 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3105 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3106 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3107 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3108 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3109 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3116 .name = "Channel Mode",
3117 .info = alc_ch_mode_info,
3118 .get = alc_ch_mode_get,
3119 .put = alc_ch_mode_put,
3124 static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
3125 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3126 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3128 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3129 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3130 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3133 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3134 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3138 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
3139 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3140 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3141 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3142 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3149 * virtual master controls
3153 * slave controls for virtual master
3155 static const char * const alc_slave_vols[] = {
3156 "Front Playback Volume",
3157 "Surround Playback Volume",
3158 "Center Playback Volume",
3159 "LFE Playback Volume",
3160 "Side Playback Volume",
3161 "Headphone Playback Volume",
3162 "Speaker Playback Volume",
3163 "Mono Playback Volume",
3164 "Line-Out Playback Volume",
3168 static const char * const alc_slave_sws[] = {
3169 "Front Playback Switch",
3170 "Surround Playback Switch",
3171 "Center Playback Switch",
3172 "LFE Playback Switch",
3173 "Side Playback Switch",
3174 "Headphone Playback Switch",
3175 "Speaker Playback Switch",
3176 "Mono Playback Switch",
3177 "IEC958 Playback Switch",
3178 "Line-Out Playback Switch",
3183 * build control elements
3186 #define NID_MAPPING (-1)
3188 #define SUBDEV_SPEAKER_ (0 << 6)
3189 #define SUBDEV_HP_ (1 << 6)
3190 #define SUBDEV_LINE_ (2 << 6)
3191 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
3192 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
3193 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
3195 static void alc_free_kctls(struct hda_codec *codec);
3197 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3198 /* additional beep mixers; the actual parameters are overwritten at build */
3199 static const struct snd_kcontrol_new alc_beep_mixer[] = {
3200 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
3201 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
3206 static int alc_build_controls(struct hda_codec *codec)
3208 struct alc_spec *spec = codec->spec;
3209 struct snd_kcontrol *kctl = NULL;
3210 const struct snd_kcontrol_new *knew;
3215 for (i = 0; i < spec->num_mixers; i++) {
3216 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3220 if (spec->cap_mixer) {
3221 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3225 if (spec->multiout.dig_out_nid) {
3226 err = snd_hda_create_spdif_out_ctls(codec,
3227 spec->multiout.dig_out_nid);
3230 if (!spec->no_analog) {
3231 err = snd_hda_create_spdif_share_sw(codec,
3235 spec->multiout.share_spdif = 1;
3238 if (spec->dig_in_nid) {
3239 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3244 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3245 /* create beep controls if needed */
3246 if (spec->beep_amp) {
3247 const struct snd_kcontrol_new *knew;
3248 for (knew = alc_beep_mixer; knew->name; knew++) {
3249 struct snd_kcontrol *kctl;
3250 kctl = snd_ctl_new1(knew, codec);
3253 kctl->private_value = spec->beep_amp;
3254 err = snd_hda_ctl_add(codec, 0, kctl);
3261 /* if we have no master control, let's create it */
3262 if (!spec->no_analog &&
3263 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3264 unsigned int vmaster_tlv[4];
3265 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3266 HDA_OUTPUT, vmaster_tlv);
3267 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3268 vmaster_tlv, alc_slave_vols);
3272 if (!spec->no_analog &&
3273 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3274 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3275 NULL, alc_slave_sws);
3280 /* assign Capture Source enums to NID */
3281 if (spec->capsrc_nids || spec->adc_nids) {
3282 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3284 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3285 for (i = 0; kctl && i < kctl->count; i++) {
3286 const hda_nid_t *nids = spec->capsrc_nids;
3288 nids = spec->adc_nids;
3289 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3294 if (spec->cap_mixer) {
3295 const char *kname = kctl ? kctl->id.name : NULL;
3296 for (knew = spec->cap_mixer; knew->name; knew++) {
3297 if (kname && strcmp(knew->name, kname) == 0)
3299 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3300 for (i = 0; kctl && i < kctl->count; i++) {
3301 err = snd_hda_add_nid(codec, kctl, i,
3309 /* other nid->control mapping */
3310 for (i = 0; i < spec->num_mixers; i++) {
3311 for (knew = spec->mixers[i]; knew->name; knew++) {
3312 if (knew->iface != NID_MAPPING)
3314 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3317 u = knew->subdevice;
3318 for (j = 0; j < 4; j++, u >>= 8) {
3323 case SUBDEV_SPEAKER_:
3324 nid = spec->autocfg.speaker_pins[nid];
3327 nid = spec->autocfg.line_out_pins[nid];
3330 nid = spec->autocfg.hp_pins[nid];
3335 err = snd_hda_add_nid(codec, kctl, 0, nid);
3339 u = knew->private_value;
3340 for (j = 0; j < 4; j++, u >>= 8) {
3344 err = snd_hda_add_nid(codec, kctl, 0, nid);
3351 alc_free_kctls(codec); /* no longer needed */
3358 * initialize the codec volumes, etc
3362 * generic initialization of ADC, input mixers and output mixers
3364 static const struct hda_verb alc880_volume_init_verbs[] = {
3366 * Unmute ADC0-2 and set the default input to mic-in
3368 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3370 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3372 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3375 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3377 * Note: PASD motherboards uses the Line In 2 as the input for front
3380 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3390 * Set up output mixers (0x0c - 0x0f)
3392 /* set vol=0 to output mixers */
3393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3395 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3396 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3397 /* set up input amps for analog loopback */
3398 /* Amp Indices: DAC = 0, mixer = 1 */
3399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3412 * 3-stack pin configuration:
3413 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3415 static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
3417 * preset connection lists of input pins
3418 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3420 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3421 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3422 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3425 * Set pin mode and muting
3427 /* set front pin widgets 0x14 for output */
3428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3429 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3430 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3431 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3432 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3433 /* Mic2 (as headphone out) for HP output */
3434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3436 /* Line In pin widget for input */
3437 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3438 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3439 /* Line2 (as front mic) pin widget for input and vref at 80% */
3440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3441 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3442 /* CD pin widget for input */
3443 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3449 * 5-stack pin configuration:
3450 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3451 * line-in/side = 0x1a, f-mic = 0x1b
3453 static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
3455 * preset connection lists of input pins
3456 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3458 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3459 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3462 * Set pin mode and muting
3464 /* set pin widgets 0x14-0x17 for output */
3465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3467 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3468 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3469 /* unmute pins for output (no gain on this amp) */
3470 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3472 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3473 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3478 /* Mic2 (as headphone out) for HP output */
3479 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3480 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3481 /* Line In pin widget for input */
3482 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3483 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3484 /* Line2 (as front mic) pin widget for input and vref at 80% */
3485 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3486 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3487 /* CD pin widget for input */
3488 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3494 * W810 pin configuration:
3495 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3497 static const struct hda_verb alc880_pin_w810_init_verbs[] = {
3498 /* hphone/speaker input selector: front DAC */
3499 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3505 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3506 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3508 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3515 * Z71V pin configuration:
3516 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3518 static const struct hda_verb alc880_pin_z71v_init_verbs[] = {
3519 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3520 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3522 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3525 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3526 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3527 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3533 * 6-stack pin configuration:
3534 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3535 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3537 static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
3538 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3541 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3542 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3545 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3546 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3547 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3551 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3552 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3553 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3554 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3556 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3557 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3563 * Uniwill pin configuration:
3564 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3567 static const struct hda_verb alc880_uniwill_init_verbs[] = {
3568 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3571 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3574 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3575 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3576 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3577 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3582 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3583 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3586 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3587 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3588 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3589 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3590 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3591 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3592 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3593 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3595 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3596 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3603 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3605 static const struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3606 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3609 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3613 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3621 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3622 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3623 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3624 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3625 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3628 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3629 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3634 static const struct hda_verb alc880_beep_init_verbs[] = {
3635 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3639 /* auto-toggle front mic */
3640 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3642 unsigned int present;
3645 present = snd_hda_jack_detect(codec, 0x18);
3646 bits = present ? HDA_AMP_MUTE : 0;
3647 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3650 static void alc880_uniwill_setup(struct hda_codec *codec)
3652 struct alc_spec *spec = codec->spec;
3654 spec->autocfg.hp_pins[0] = 0x14;
3655 spec->autocfg.speaker_pins[0] = 0x15;
3656 spec->autocfg.speaker_pins[0] = 0x16;
3658 spec->automute_mode = ALC_AUTOMUTE_AMP;
3661 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3663 alc_hp_automute(codec);
3664 alc88x_simple_mic_automute(codec);
3667 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3670 /* Looks like the unsol event is incompatible with the standard
3671 * definition. 4bit tag is placed at 28 bit!
3673 switch (res >> 28) {
3674 case ALC880_MIC_EVENT:
3675 alc88x_simple_mic_automute(codec);
3678 alc_sku_unsol_event(codec, res);
3683 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3685 struct alc_spec *spec = codec->spec;
3687 spec->autocfg.hp_pins[0] = 0x14;
3688 spec->autocfg.speaker_pins[0] = 0x15;
3690 spec->automute_mode = ALC_AUTOMUTE_AMP;
3693 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3695 unsigned int present;
3697 present = snd_hda_codec_read(codec, 0x21, 0,
3698 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3699 present &= HDA_AMP_VOLMASK;
3700 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3701 HDA_AMP_VOLMASK, present);
3702 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3703 HDA_AMP_VOLMASK, present);
3706 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3709 /* Looks like the unsol event is incompatible with the standard
3710 * definition. 4bit tag is placed at 28 bit!
3712 if ((res >> 28) == ALC880_DCVOL_EVENT)
3713 alc880_uniwill_p53_dcvol_automute(codec);
3715 alc_sku_unsol_event(codec, res);
3719 * F1734 pin configuration:
3720 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3722 static const struct hda_verb alc880_pin_f1734_init_verbs[] = {
3723 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3724 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3725 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3726 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3727 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3734 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3735 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3736 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3737 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3738 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3739 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3741 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3742 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3744 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3745 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3751 * ASUS pin configuration:
3752 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3754 static const struct hda_verb alc880_pin_asus_init_verbs[] = {
3755 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3756 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3757 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3758 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3764 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3765 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3766 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3769 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3773 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3774 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3776 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3777 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3782 /* Enable GPIO mask and set output */
3783 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3784 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3785 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3787 /* Clevo m520g init */
3788 static const struct hda_verb alc880_pin_clevo_init_verbs[] = {
3789 /* headphone output */
3790 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3792 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3793 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3796 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3799 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3800 /* Mic1 (rear panel) */
3801 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3802 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3803 /* Mic2 (front panel) */
3804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3805 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3809 /* change to EAPD mode */
3810 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3811 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3816 static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3817 /* change to EAPD mode */
3818 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3819 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3821 /* Headphone output */
3822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3824 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3825 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3827 /* Line In pin widget for input */
3828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3829 /* CD pin widget for input */
3830 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3831 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3834 /* change to EAPD mode */
3835 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3836 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3842 * LG m1 express dual
3845 * Rear Line-In/Out (blue): 0x14
3846 * Build-in Mic-In: 0x15
3848 * HP-Out (green): 0x1b
3849 * Mic-In/Out (red): 0x19
3853 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3854 static const hda_nid_t alc880_lg_dac_nids[3] = {
3858 /* seems analog CD is not working */
3859 static const struct hda_input_mux alc880_lg_capture_source = {
3864 { "Internal Mic", 0x6 },
3868 /* 2,4,6 channel modes */
3869 static const struct hda_verb alc880_lg_ch2_init[] = {
3870 /* set line-in and mic-in to input */
3871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3872 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3876 static const struct hda_verb alc880_lg_ch4_init[] = {
3877 /* set line-in to out and mic-in to input */
3878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3879 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3883 static const struct hda_verb alc880_lg_ch6_init[] = {
3884 /* set line-in and mic-in to output */
3885 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3886 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3890 static const struct hda_channel_mode alc880_lg_ch_modes[3] = {
3891 { 2, alc880_lg_ch2_init },
3892 { 4, alc880_lg_ch4_init },
3893 { 6, alc880_lg_ch6_init },
3896 static const struct snd_kcontrol_new alc880_lg_mixer[] = {
3897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3898 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3899 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3900 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3901 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3902 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3903 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3904 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3907 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3908 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3909 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3910 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3912 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3913 .name = "Channel Mode",
3914 .info = alc_ch_mode_info,
3915 .get = alc_ch_mode_get,
3916 .put = alc_ch_mode_put,
3921 static const struct hda_verb alc880_lg_init_verbs[] = {
3922 /* set capture source to mic-in */
3923 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3924 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3925 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3926 /* mute all amp mixer inputs */
3927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3930 /* line-in to input */
3931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3932 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3934 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3937 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3938 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3939 /* mic-in to input */
3940 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3941 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3942 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3944 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3945 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3946 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3948 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3952 /* toggle speaker-output according to the hp-jack state */
3953 static void alc880_lg_setup(struct hda_codec *codec)
3955 struct alc_spec *spec = codec->spec;
3957 spec->autocfg.hp_pins[0] = 0x1b;
3958 spec->autocfg.speaker_pins[0] = 0x17;
3960 spec->automute_mode = ALC_AUTOMUTE_AMP;
3969 * Built-in Mic-In: 0x19
3975 static const struct hda_input_mux alc880_lg_lw_capture_source = {
3979 { "Internal Mic", 0x1 },
3984 #define alc880_lg_lw_modes alc880_threestack_modes
3986 static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3987 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3988 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3989 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3990 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3991 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3992 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3993 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3994 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3998 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3999 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
4000 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
4002 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4003 .name = "Channel Mode",
4004 .info = alc_ch_mode_info,
4005 .get = alc_ch_mode_get,
4006 .put = alc_ch_mode_put,
4011 static const struct hda_verb alc880_lg_lw_init_verbs[] = {
4012 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4013 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
4014 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
4016 /* set capture source to mic-in */
4017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4019 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
4022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4027 /* mic-in to input */
4028 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4029 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4032 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4034 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4038 /* toggle speaker-output according to the hp-jack state */
4039 static void alc880_lg_lw_setup(struct hda_codec *codec)
4041 struct alc_spec *spec = codec->spec;
4043 spec->autocfg.hp_pins[0] = 0x1b;
4044 spec->autocfg.speaker_pins[0] = 0x14;
4046 spec->automute_mode = ALC_AUTOMUTE_AMP;
4049 static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
4050 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4051 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
4052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4054 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4055 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
4059 static const struct hda_input_mux alc880_medion_rim_capture_source = {
4063 { "Internal Mic", 0x1 },
4067 static const struct hda_verb alc880_medion_rim_init_verbs[] = {
4068 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4070 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4071 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4073 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4076 /* Mic2 (as headphone out) for HP output */
4077 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4079 /* Internal Speaker */
4080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4081 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4083 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
4084 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
4086 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4090 /* toggle speaker-output according to the hp-jack state */
4091 static void alc880_medion_rim_automute(struct hda_codec *codec)
4093 struct alc_spec *spec = codec->spec;
4094 alc_hp_automute(codec);
4096 if (spec->jack_present)
4097 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
4099 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
4102 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
4105 /* Looks like the unsol event is incompatible with the standard
4106 * definition. 4bit tag is placed at 28 bit!
4108 if ((res >> 28) == ALC880_HP_EVENT)
4109 alc880_medion_rim_automute(codec);
4112 static void alc880_medion_rim_setup(struct hda_codec *codec)
4114 struct alc_spec *spec = codec->spec;
4116 spec->autocfg.hp_pins[0] = 0x14;
4117 spec->autocfg.speaker_pins[0] = 0x1b;
4119 spec->automute_mode = ALC_AUTOMUTE_AMP;
4122 #ifdef CONFIG_SND_HDA_POWER_SAVE
4123 static const struct hda_amp_list alc880_loopbacks[] = {
4124 { 0x0b, HDA_INPUT, 0 },
4125 { 0x0b, HDA_INPUT, 1 },
4126 { 0x0b, HDA_INPUT, 2 },
4127 { 0x0b, HDA_INPUT, 3 },
4128 { 0x0b, HDA_INPUT, 4 },
4132 static const struct hda_amp_list alc880_lg_loopbacks[] = {
4133 { 0x0b, HDA_INPUT, 1 },
4134 { 0x0b, HDA_INPUT, 6 },
4135 { 0x0b, HDA_INPUT, 7 },
4144 static void alc_init_special_input_src(struct hda_codec *codec);
4146 static int alc_init(struct hda_codec *codec)
4148 struct alc_spec *spec = codec->spec;
4152 alc_auto_init_amp(codec, spec->init_amp);
4154 for (i = 0; i < spec->num_init_verbs; i++)
4155 snd_hda_sequence_write(codec, spec->init_verbs[i]);
4156 alc_init_special_input_src(codec);
4158 if (spec->init_hook)
4159 spec->init_hook(codec);
4161 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
4163 hda_call_check_power_status(codec, 0x01);
4167 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
4169 struct alc_spec *spec = codec->spec;
4171 if (spec->unsol_event)
4172 spec->unsol_event(codec, res);
4175 #ifdef CONFIG_SND_HDA_POWER_SAVE
4176 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
4178 struct alc_spec *spec = codec->spec;
4179 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
4184 * Analog playback callbacks
4186 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
4187 struct hda_codec *codec,
4188 struct snd_pcm_substream *substream)
4190 struct alc_spec *spec = codec->spec;
4191 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
4195 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4196 struct hda_codec *codec,
4197 unsigned int stream_tag,
4198 unsigned int format,
4199 struct snd_pcm_substream *substream)
4201 struct alc_spec *spec = codec->spec;
4202 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
4203 stream_tag, format, substream);
4206 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4207 struct hda_codec *codec,
4208 struct snd_pcm_substream *substream)
4210 struct alc_spec *spec = codec->spec;
4211 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
4217 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
4218 struct hda_codec *codec,
4219 struct snd_pcm_substream *substream)
4221 struct alc_spec *spec = codec->spec;
4222 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
4225 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4226 struct hda_codec *codec,
4227 unsigned int stream_tag,
4228 unsigned int format,
4229 struct snd_pcm_substream *substream)
4231 struct alc_spec *spec = codec->spec;
4232 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4233 stream_tag, format, substream);
4236 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4237 struct hda_codec *codec,
4238 struct snd_pcm_substream *substream)
4240 struct alc_spec *spec = codec->spec;
4241 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4244 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4245 struct hda_codec *codec,
4246 struct snd_pcm_substream *substream)
4248 struct alc_spec *spec = codec->spec;
4249 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4255 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4256 struct hda_codec *codec,
4257 unsigned int stream_tag,
4258 unsigned int format,
4259 struct snd_pcm_substream *substream)
4261 struct alc_spec *spec = codec->spec;
4263 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4264 stream_tag, 0, format);
4268 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4269 struct hda_codec *codec,
4270 struct snd_pcm_substream *substream)
4272 struct alc_spec *spec = codec->spec;
4274 snd_hda_codec_cleanup_stream(codec,
4275 spec->adc_nids[substream->number + 1]);
4279 /* analog capture with dynamic dual-adc changes */
4280 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4281 struct hda_codec *codec,
4282 unsigned int stream_tag,
4283 unsigned int format,
4284 struct snd_pcm_substream *substream)
4286 struct alc_spec *spec = codec->spec;
4287 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4288 spec->cur_adc_stream_tag = stream_tag;
4289 spec->cur_adc_format = format;
4290 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4294 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4295 struct hda_codec *codec,
4296 struct snd_pcm_substream *substream)
4298 struct alc_spec *spec = codec->spec;
4299 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4304 static const struct hda_pcm_stream dualmic_pcm_analog_capture = {
4308 .nid = 0, /* fill later */
4310 .prepare = dualmic_capture_pcm_prepare,
4311 .cleanup = dualmic_capture_pcm_cleanup
4317 static const struct hda_pcm_stream alc880_pcm_analog_playback = {
4321 /* NID is set in alc_build_pcms */
4323 .open = alc880_playback_pcm_open,
4324 .prepare = alc880_playback_pcm_prepare,
4325 .cleanup = alc880_playback_pcm_cleanup
4329 static const struct hda_pcm_stream alc880_pcm_analog_capture = {
4333 /* NID is set in alc_build_pcms */
4336 static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4340 /* NID is set in alc_build_pcms */
4343 static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4344 .substreams = 2, /* can be overridden */
4347 /* NID is set in alc_build_pcms */
4349 .prepare = alc880_alt_capture_pcm_prepare,
4350 .cleanup = alc880_alt_capture_pcm_cleanup
4354 static const struct hda_pcm_stream alc880_pcm_digital_playback = {
4358 /* NID is set in alc_build_pcms */
4360 .open = alc880_dig_playback_pcm_open,
4361 .close = alc880_dig_playback_pcm_close,
4362 .prepare = alc880_dig_playback_pcm_prepare,
4363 .cleanup = alc880_dig_playback_pcm_cleanup
4367 static const struct hda_pcm_stream alc880_pcm_digital_capture = {
4371 /* NID is set in alc_build_pcms */
4374 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4375 static const struct hda_pcm_stream alc_pcm_null_stream = {
4381 static int alc_build_pcms(struct hda_codec *codec)
4383 struct alc_spec *spec = codec->spec;
4384 struct hda_pcm *info = spec->pcm_rec;
4387 codec->num_pcms = 1;
4388 codec->pcm_info = info;
4390 if (spec->no_analog)
4393 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4394 "%s Analog", codec->chip_name);
4395 info->name = spec->stream_name_analog;
4397 if (spec->stream_analog_playback) {
4398 if (snd_BUG_ON(!spec->multiout.dac_nids))
4400 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4401 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4403 if (spec->stream_analog_capture) {
4404 if (snd_BUG_ON(!spec->adc_nids))
4406 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4407 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4410 if (spec->channel_mode) {
4411 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4412 for (i = 0; i < spec->num_channel_mode; i++) {
4413 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4414 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4420 /* SPDIF for stream index #1 */
4421 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4422 snprintf(spec->stream_name_digital,
4423 sizeof(spec->stream_name_digital),
4424 "%s Digital", codec->chip_name);
4425 codec->num_pcms = 2;
4426 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4427 info = spec->pcm_rec + 1;
4428 info->name = spec->stream_name_digital;
4429 if (spec->dig_out_type)
4430 info->pcm_type = spec->dig_out_type;
4432 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4433 if (spec->multiout.dig_out_nid &&
4434 spec->stream_digital_playback) {
4435 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4436 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4438 if (spec->dig_in_nid &&
4439 spec->stream_digital_capture) {
4440 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4441 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4443 /* FIXME: do we need this for all Realtek codec models? */
4444 codec->spdif_status_reset = 1;
4447 if (spec->no_analog)
4450 /* If the use of more than one ADC is requested for the current
4451 * model, configure a second analog capture-only PCM.
4453 /* Additional Analaog capture for index #2 */
4454 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4455 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4456 codec->num_pcms = 3;
4457 info = spec->pcm_rec + 2;
4458 info->name = spec->stream_name_analog;
4459 if (spec->alt_dac_nid) {
4460 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4461 *spec->stream_analog_alt_playback;
4462 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4465 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4466 alc_pcm_null_stream;
4467 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4469 if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) {
4470 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4471 *spec->stream_analog_alt_capture;
4472 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4474 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4475 spec->num_adc_nids - 1;
4477 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4478 alc_pcm_null_stream;
4479 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4486 static inline void alc_shutup(struct hda_codec *codec)
4488 struct alc_spec *spec = codec->spec;
4490 if (spec && spec->shutup)
4491 spec->shutup(codec);
4492 snd_hda_shutup_pins(codec);
4495 static void alc_free_kctls(struct hda_codec *codec)
4497 struct alc_spec *spec = codec->spec;
4499 if (spec->kctls.list) {
4500 struct snd_kcontrol_new *kctl = spec->kctls.list;
4502 for (i = 0; i < spec->kctls.used; i++)
4503 kfree(kctl[i].name);
4505 snd_array_free(&spec->kctls);
4508 static void alc_free(struct hda_codec *codec)
4510 struct alc_spec *spec = codec->spec;
4516 snd_hda_input_jack_free(codec);
4517 alc_free_kctls(codec);
4519 snd_hda_detach_beep_device(codec);
4522 #ifdef CONFIG_SND_HDA_POWER_SAVE
4523 static void alc_power_eapd(struct hda_codec *codec)
4525 alc_auto_setup_eapd(codec, false);
4528 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4530 struct alc_spec *spec = codec->spec;
4532 if (spec && spec->power_hook)
4533 spec->power_hook(codec);
4538 #ifdef SND_HDA_NEEDS_RESUME
4539 static int alc_resume(struct hda_codec *codec)
4541 msleep(150); /* to avoid pop noise */
4542 codec->patch_ops.init(codec);
4543 snd_hda_codec_resume_amp(codec);
4544 snd_hda_codec_resume_cache(codec);
4545 hda_call_check_power_status(codec, 0x01);
4552 static const struct hda_codec_ops alc_patch_ops = {
4553 .build_controls = alc_build_controls,
4554 .build_pcms = alc_build_pcms,
4557 .unsol_event = alc_unsol_event,
4558 #ifdef SND_HDA_NEEDS_RESUME
4559 .resume = alc_resume,
4561 #ifdef CONFIG_SND_HDA_POWER_SAVE
4562 .suspend = alc_suspend,
4563 .check_power_status = alc_check_power_status,
4565 .reboot_notify = alc_shutup,
4568 /* replace the codec chip_name with the given string */
4569 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4571 kfree(codec->chip_name);
4572 codec->chip_name = kstrdup(name, GFP_KERNEL);
4573 if (!codec->chip_name) {
4581 * Test configuration for debugging
4583 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4586 #ifdef CONFIG_SND_DEBUG
4587 static const hda_nid_t alc880_test_dac_nids[4] = {
4588 0x02, 0x03, 0x04, 0x05
4591 static const struct hda_input_mux alc880_test_capture_source = {
4600 { "Surround", 0x6 },
4604 static const struct hda_channel_mode alc880_test_modes[4] = {
4611 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4612 struct snd_ctl_elem_info *uinfo)
4614 static const char * const texts[] = {
4615 "N/A", "Line Out", "HP Out",
4616 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4618 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4620 uinfo->value.enumerated.items = 8;
4621 if (uinfo->value.enumerated.item >= 8)
4622 uinfo->value.enumerated.item = 7;
4623 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4627 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4628 struct snd_ctl_elem_value *ucontrol)
4630 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4631 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4632 unsigned int pin_ctl, item = 0;
4634 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4635 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4636 if (pin_ctl & AC_PINCTL_OUT_EN) {
4637 if (pin_ctl & AC_PINCTL_HP_EN)
4641 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4642 switch (pin_ctl & AC_PINCTL_VREFEN) {
4643 case AC_PINCTL_VREF_HIZ: item = 3; break;
4644 case AC_PINCTL_VREF_50: item = 4; break;
4645 case AC_PINCTL_VREF_GRD: item = 5; break;
4646 case AC_PINCTL_VREF_80: item = 6; break;
4647 case AC_PINCTL_VREF_100: item = 7; break;
4650 ucontrol->value.enumerated.item[0] = item;
4654 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4655 struct snd_ctl_elem_value *ucontrol)
4657 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4658 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4659 static const unsigned int ctls[] = {
4660 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4661 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4662 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4663 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4664 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4665 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4667 unsigned int old_ctl, new_ctl;
4669 old_ctl = snd_hda_codec_read(codec, nid, 0,
4670 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4671 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4672 if (old_ctl != new_ctl) {
4674 snd_hda_codec_write_cache(codec, nid, 0,
4675 AC_VERB_SET_PIN_WIDGET_CONTROL,
4677 val = ucontrol->value.enumerated.item[0] >= 3 ?
4679 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4686 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4687 struct snd_ctl_elem_info *uinfo)
4689 static const char * const texts[] = {
4690 "Front", "Surround", "CLFE", "Side"
4692 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4694 uinfo->value.enumerated.items = 4;
4695 if (uinfo->value.enumerated.item >= 4)
4696 uinfo->value.enumerated.item = 3;
4697 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4701 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4702 struct snd_ctl_elem_value *ucontrol)
4704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4705 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4708 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4709 ucontrol->value.enumerated.item[0] = sel & 3;
4713 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4714 struct snd_ctl_elem_value *ucontrol)
4716 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4717 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4720 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4721 if (ucontrol->value.enumerated.item[0] != sel) {
4722 sel = ucontrol->value.enumerated.item[0] & 3;
4723 snd_hda_codec_write_cache(codec, nid, 0,
4724 AC_VERB_SET_CONNECT_SEL, sel);
4730 #define PIN_CTL_TEST(xname,nid) { \
4731 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4733 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4734 .info = alc_test_pin_ctl_info, \
4735 .get = alc_test_pin_ctl_get, \
4736 .put = alc_test_pin_ctl_put, \
4737 .private_value = nid \
4740 #define PIN_SRC_TEST(xname,nid) { \
4741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4744 .info = alc_test_pin_src_info, \
4745 .get = alc_test_pin_src_get, \
4746 .put = alc_test_pin_src_put, \
4747 .private_value = nid \
4750 static const struct snd_kcontrol_new alc880_test_mixer[] = {
4751 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4752 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4753 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4754 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4755 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4756 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4757 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4758 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4759 PIN_CTL_TEST("Front Pin Mode", 0x14),
4760 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4761 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4762 PIN_CTL_TEST("Side Pin Mode", 0x17),
4763 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4764 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4765 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4766 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4767 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4768 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4769 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4770 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4771 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4772 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4773 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4774 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4775 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4776 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4777 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4778 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4783 .name = "Channel Mode",
4784 .info = alc_ch_mode_info,
4785 .get = alc_ch_mode_get,
4786 .put = alc_ch_mode_put,
4791 static const struct hda_verb alc880_test_init_verbs[] = {
4792 /* Unmute inputs of 0x0c - 0x0f */
4793 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4795 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4796 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4797 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4798 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4799 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4801 /* Vol output for 0x0c-0x0f */
4802 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4805 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4806 /* Set output pins 0x14-0x17 */
4807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4808 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4809 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4810 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4811 /* Unmute output pins 0x14-0x17 */
4812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4815 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4816 /* Set input pins 0x18-0x1c */
4817 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4819 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4820 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4821 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4822 /* Mute input pins 0x18-0x1b */
4823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4824 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4829 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4830 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4831 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4832 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4833 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4834 /* Analog input/passthru */
4835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4847 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4848 [ALC880_3ST] = "3stack",
4849 [ALC880_TCL_S700] = "tcl",
4850 [ALC880_3ST_DIG] = "3stack-digout",
4851 [ALC880_CLEVO] = "clevo",
4852 [ALC880_5ST] = "5stack",
4853 [ALC880_5ST_DIG] = "5stack-digout",
4854 [ALC880_W810] = "w810",
4855 [ALC880_Z71V] = "z71v",
4856 [ALC880_6ST] = "6stack",
4857 [ALC880_6ST_DIG] = "6stack-digout",
4858 [ALC880_ASUS] = "asus",
4859 [ALC880_ASUS_W1V] = "asus-w1v",
4860 [ALC880_ASUS_DIG] = "asus-dig",
4861 [ALC880_ASUS_DIG2] = "asus-dig2",
4862 [ALC880_UNIWILL_DIG] = "uniwill",
4863 [ALC880_UNIWILL_P53] = "uniwill-p53",
4864 [ALC880_FUJITSU] = "fujitsu",
4865 [ALC880_F1734] = "F1734",
4867 [ALC880_LG_LW] = "lg-lw",
4868 [ALC880_MEDION_RIM] = "medion",
4869 #ifdef CONFIG_SND_DEBUG
4870 [ALC880_TEST] = "test",
4872 [ALC880_AUTO] = "auto",
4875 static const struct snd_pci_quirk alc880_cfg_tbl[] = {
4876 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4877 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4878 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4879 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4880 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4881 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4882 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4883 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4884 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4885 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4886 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4887 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4888 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4889 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4890 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4891 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4892 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4893 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4894 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4895 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4896 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4897 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4898 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4899 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4900 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4901 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4902 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4903 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4904 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4905 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4906 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4907 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4908 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4909 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4910 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4911 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4912 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4913 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4914 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4915 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4916 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734),
4917 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4918 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4919 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4920 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4921 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4922 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4923 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4924 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4925 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4926 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4927 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4928 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4929 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4930 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4931 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4932 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4933 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4934 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4935 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4936 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4937 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4938 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4939 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4940 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4941 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4942 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4943 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4944 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4946 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4947 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4948 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4953 * ALC880 codec presets
4955 static const struct alc_config_preset alc880_presets[] = {
4957 .mixers = { alc880_three_stack_mixer },
4958 .init_verbs = { alc880_volume_init_verbs,
4959 alc880_pin_3stack_init_verbs },
4960 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4961 .dac_nids = alc880_dac_nids,
4962 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4963 .channel_mode = alc880_threestack_modes,
4965 .input_mux = &alc880_capture_source,
4967 [ALC880_3ST_DIG] = {
4968 .mixers = { alc880_three_stack_mixer },
4969 .init_verbs = { alc880_volume_init_verbs,
4970 alc880_pin_3stack_init_verbs },
4971 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4972 .dac_nids = alc880_dac_nids,
4973 .dig_out_nid = ALC880_DIGOUT_NID,
4974 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4975 .channel_mode = alc880_threestack_modes,
4977 .input_mux = &alc880_capture_source,
4979 [ALC880_TCL_S700] = {
4980 .mixers = { alc880_tcl_s700_mixer },
4981 .init_verbs = { alc880_volume_init_verbs,
4982 alc880_pin_tcl_S700_init_verbs,
4983 alc880_gpio2_init_verbs },
4984 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4985 .dac_nids = alc880_dac_nids,
4986 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4987 .num_adc_nids = 1, /* single ADC */
4989 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4990 .channel_mode = alc880_2_jack_modes,
4991 .input_mux = &alc880_capture_source,
4994 .mixers = { alc880_three_stack_mixer,
4995 alc880_five_stack_mixer},
4996 .init_verbs = { alc880_volume_init_verbs,
4997 alc880_pin_5stack_init_verbs },
4998 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4999 .dac_nids = alc880_dac_nids,
5000 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
5001 .channel_mode = alc880_fivestack_modes,
5002 .input_mux = &alc880_capture_source,
5004 [ALC880_5ST_DIG] = {
5005 .mixers = { alc880_three_stack_mixer,
5006 alc880_five_stack_mixer },
5007 .init_verbs = { alc880_volume_init_verbs,
5008 alc880_pin_5stack_init_verbs },
5009 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5010 .dac_nids = alc880_dac_nids,
5011 .dig_out_nid = ALC880_DIGOUT_NID,
5012 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
5013 .channel_mode = alc880_fivestack_modes,
5014 .input_mux = &alc880_capture_source,
5017 .mixers = { alc880_six_stack_mixer },
5018 .init_verbs = { alc880_volume_init_verbs,
5019 alc880_pin_6stack_init_verbs },
5020 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
5021 .dac_nids = alc880_6st_dac_nids,
5022 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
5023 .channel_mode = alc880_sixstack_modes,
5024 .input_mux = &alc880_6stack_capture_source,
5026 [ALC880_6ST_DIG] = {
5027 .mixers = { alc880_six_stack_mixer },
5028 .init_verbs = { alc880_volume_init_verbs,
5029 alc880_pin_6stack_init_verbs },
5030 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
5031 .dac_nids = alc880_6st_dac_nids,
5032 .dig_out_nid = ALC880_DIGOUT_NID,
5033 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
5034 .channel_mode = alc880_sixstack_modes,
5035 .input_mux = &alc880_6stack_capture_source,
5038 .mixers = { alc880_w810_base_mixer },
5039 .init_verbs = { alc880_volume_init_verbs,
5040 alc880_pin_w810_init_verbs,
5041 alc880_gpio2_init_verbs },
5042 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
5043 .dac_nids = alc880_w810_dac_nids,
5044 .dig_out_nid = ALC880_DIGOUT_NID,
5045 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
5046 .channel_mode = alc880_w810_modes,
5047 .input_mux = &alc880_capture_source,
5050 .mixers = { alc880_z71v_mixer },
5051 .init_verbs = { alc880_volume_init_verbs,
5052 alc880_pin_z71v_init_verbs },
5053 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
5054 .dac_nids = alc880_z71v_dac_nids,
5055 .dig_out_nid = ALC880_DIGOUT_NID,
5057 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5058 .channel_mode = alc880_2_jack_modes,
5059 .input_mux = &alc880_capture_source,
5062 .mixers = { alc880_f1734_mixer },
5063 .init_verbs = { alc880_volume_init_verbs,
5064 alc880_pin_f1734_init_verbs },
5065 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
5066 .dac_nids = alc880_f1734_dac_nids,
5068 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5069 .channel_mode = alc880_2_jack_modes,
5070 .input_mux = &alc880_f1734_capture_source,
5071 .unsol_event = alc880_uniwill_p53_unsol_event,
5072 .setup = alc880_uniwill_p53_setup,
5073 .init_hook = alc_hp_automute,
5076 .mixers = { alc880_asus_mixer },
5077 .init_verbs = { alc880_volume_init_verbs,
5078 alc880_pin_asus_init_verbs,
5079 alc880_gpio1_init_verbs },
5080 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5081 .dac_nids = alc880_asus_dac_nids,
5082 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5083 .channel_mode = alc880_asus_modes,
5085 .input_mux = &alc880_capture_source,
5087 [ALC880_ASUS_DIG] = {
5088 .mixers = { alc880_asus_mixer },
5089 .init_verbs = { alc880_volume_init_verbs,
5090 alc880_pin_asus_init_verbs,
5091 alc880_gpio1_init_verbs },
5092 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5093 .dac_nids = alc880_asus_dac_nids,
5094 .dig_out_nid = ALC880_DIGOUT_NID,
5095 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5096 .channel_mode = alc880_asus_modes,
5098 .input_mux = &alc880_capture_source,
5100 [ALC880_ASUS_DIG2] = {
5101 .mixers = { alc880_asus_mixer },
5102 .init_verbs = { alc880_volume_init_verbs,
5103 alc880_pin_asus_init_verbs,
5104 alc880_gpio2_init_verbs }, /* use GPIO2 */
5105 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5106 .dac_nids = alc880_asus_dac_nids,
5107 .dig_out_nid = ALC880_DIGOUT_NID,
5108 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5109 .channel_mode = alc880_asus_modes,
5111 .input_mux = &alc880_capture_source,
5113 [ALC880_ASUS_W1V] = {
5114 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
5115 .init_verbs = { alc880_volume_init_verbs,
5116 alc880_pin_asus_init_verbs,
5117 alc880_gpio1_init_verbs },
5118 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5119 .dac_nids = alc880_asus_dac_nids,
5120 .dig_out_nid = ALC880_DIGOUT_NID,
5121 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5122 .channel_mode = alc880_asus_modes,
5124 .input_mux = &alc880_capture_source,
5126 [ALC880_UNIWILL_DIG] = {
5127 .mixers = { alc880_asus_mixer },
5128 .init_verbs = { alc880_volume_init_verbs,
5129 alc880_pin_asus_init_verbs },
5130 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5131 .dac_nids = alc880_asus_dac_nids,
5132 .dig_out_nid = ALC880_DIGOUT_NID,
5133 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5134 .channel_mode = alc880_asus_modes,
5136 .input_mux = &alc880_capture_source,
5138 [ALC880_UNIWILL] = {
5139 .mixers = { alc880_uniwill_mixer },
5140 .init_verbs = { alc880_volume_init_verbs,
5141 alc880_uniwill_init_verbs },
5142 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5143 .dac_nids = alc880_asus_dac_nids,
5144 .dig_out_nid = ALC880_DIGOUT_NID,
5145 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5146 .channel_mode = alc880_threestack_modes,
5148 .input_mux = &alc880_capture_source,
5149 .unsol_event = alc880_uniwill_unsol_event,
5150 .setup = alc880_uniwill_setup,
5151 .init_hook = alc880_uniwill_init_hook,
5153 [ALC880_UNIWILL_P53] = {
5154 .mixers = { alc880_uniwill_p53_mixer },
5155 .init_verbs = { alc880_volume_init_verbs,
5156 alc880_uniwill_p53_init_verbs },
5157 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5158 .dac_nids = alc880_asus_dac_nids,
5159 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
5160 .channel_mode = alc880_threestack_modes,
5161 .input_mux = &alc880_capture_source,
5162 .unsol_event = alc880_uniwill_p53_unsol_event,
5163 .setup = alc880_uniwill_p53_setup,
5164 .init_hook = alc_hp_automute,
5166 [ALC880_FUJITSU] = {
5167 .mixers = { alc880_fujitsu_mixer },
5168 .init_verbs = { alc880_volume_init_verbs,
5169 alc880_uniwill_p53_init_verbs,
5170 alc880_beep_init_verbs },
5171 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5172 .dac_nids = alc880_dac_nids,
5173 .dig_out_nid = ALC880_DIGOUT_NID,
5174 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5175 .channel_mode = alc880_2_jack_modes,
5176 .input_mux = &alc880_capture_source,
5177 .unsol_event = alc880_uniwill_p53_unsol_event,
5178 .setup = alc880_uniwill_p53_setup,
5179 .init_hook = alc_hp_automute,
5182 .mixers = { alc880_three_stack_mixer },
5183 .init_verbs = { alc880_volume_init_verbs,
5184 alc880_pin_clevo_init_verbs },
5185 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5186 .dac_nids = alc880_dac_nids,
5188 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5189 .channel_mode = alc880_threestack_modes,
5191 .input_mux = &alc880_capture_source,
5194 .mixers = { alc880_lg_mixer },
5195 .init_verbs = { alc880_volume_init_verbs,
5196 alc880_lg_init_verbs },
5197 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
5198 .dac_nids = alc880_lg_dac_nids,
5199 .dig_out_nid = ALC880_DIGOUT_NID,
5200 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
5201 .channel_mode = alc880_lg_ch_modes,
5203 .input_mux = &alc880_lg_capture_source,
5204 .unsol_event = alc_sku_unsol_event,
5205 .setup = alc880_lg_setup,
5206 .init_hook = alc_hp_automute,
5207 #ifdef CONFIG_SND_HDA_POWER_SAVE
5208 .loopbacks = alc880_lg_loopbacks,
5212 .mixers = { alc880_lg_lw_mixer },
5213 .init_verbs = { alc880_volume_init_verbs,
5214 alc880_lg_lw_init_verbs },
5215 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5216 .dac_nids = alc880_dac_nids,
5217 .dig_out_nid = ALC880_DIGOUT_NID,
5218 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5219 .channel_mode = alc880_lg_lw_modes,
5220 .input_mux = &alc880_lg_lw_capture_source,
5221 .unsol_event = alc_sku_unsol_event,
5222 .setup = alc880_lg_lw_setup,
5223 .init_hook = alc_hp_automute,
5225 [ALC880_MEDION_RIM] = {
5226 .mixers = { alc880_medion_rim_mixer },
5227 .init_verbs = { alc880_volume_init_verbs,
5228 alc880_medion_rim_init_verbs,
5229 alc_gpio2_init_verbs },
5230 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5231 .dac_nids = alc880_dac_nids,
5232 .dig_out_nid = ALC880_DIGOUT_NID,
5233 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5234 .channel_mode = alc880_2_jack_modes,
5235 .input_mux = &alc880_medion_rim_capture_source,
5236 .unsol_event = alc880_medion_rim_unsol_event,
5237 .setup = alc880_medion_rim_setup,
5238 .init_hook = alc880_medion_rim_automute,
5240 #ifdef CONFIG_SND_DEBUG
5242 .mixers = { alc880_test_mixer },
5243 .init_verbs = { alc880_test_init_verbs },
5244 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5245 .dac_nids = alc880_test_dac_nids,
5246 .dig_out_nid = ALC880_DIGOUT_NID,
5247 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5248 .channel_mode = alc880_test_modes,
5249 .input_mux = &alc880_test_capture_source,
5255 * Automatic parse of I/O pins from the BIOS configuration
5260 ALC_CTL_WIDGET_MUTE,
5263 static const struct snd_kcontrol_new alc880_control_templates[] = {
5264 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5265 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5266 HDA_BIND_MUTE(NULL, 0, 0, 0),
5269 static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec)
5271 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
5272 return snd_array_new(&spec->kctls);
5275 /* add dynamic controls */
5276 static int add_control(struct alc_spec *spec, int type, const char *name,
5277 int cidx, unsigned long val)
5279 struct snd_kcontrol_new *knew;
5281 knew = alc_kcontrol_new(spec);
5284 *knew = alc880_control_templates[type];
5285 knew->name = kstrdup(name, GFP_KERNEL);
5289 if (get_amp_nid_(val))
5290 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5291 knew->private_value = val;
5295 static int add_control_with_pfx(struct alc_spec *spec, int type,
5296 const char *pfx, const char *dir,
5297 const char *sfx, int cidx, unsigned long val)
5300 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5301 return add_control(spec, type, name, cidx, val);
5304 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5305 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5306 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5307 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5308 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5309 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5310 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5311 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5313 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5314 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5315 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5316 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5317 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5318 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5319 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5320 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5321 #define ALC880_PIN_CD_NID 0x1c
5323 /* fill in the dac_nids table from the parsed pin configuration */
5324 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5325 const struct auto_pin_cfg *cfg)
5331 memset(assigned, 0, sizeof(assigned));
5332 spec->multiout.dac_nids = spec->private_dac_nids;
5334 /* check the pins hardwired to audio widget */
5335 for (i = 0; i < cfg->line_outs; i++) {
5336 nid = cfg->line_out_pins[i];
5337 if (alc880_is_fixed_pin(nid)) {
5338 int idx = alc880_fixed_pin_idx(nid);
5339 spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
5343 /* left pins can be connect to any audio widget */
5344 for (i = 0; i < cfg->line_outs; i++) {
5345 nid = cfg->line_out_pins[i];
5346 if (alc880_is_fixed_pin(nid))
5348 /* search for an empty channel */
5349 for (j = 0; j < cfg->line_outs; j++) {
5351 spec->private_dac_nids[i] =
5352 alc880_idx_to_dac(j);
5358 spec->multiout.num_dacs = cfg->line_outs;
5362 static const char *alc_get_line_out_pfx(struct alc_spec *spec,
5365 struct auto_pin_cfg *cfg = &spec->autocfg;
5367 if (cfg->line_outs == 1 && !spec->multi_ios &&
5368 !cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5371 switch (cfg->line_out_type) {
5372 case AUTO_PIN_SPEAKER_OUT:
5373 if (cfg->line_outs == 1)
5376 case AUTO_PIN_HP_OUT:
5379 if (cfg->line_outs == 1 && !spec->multi_ios)
5386 /* add playback controls from the parsed DAC table */
5387 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5388 const struct auto_pin_cfg *cfg)
5390 static const char * const chname[4] = {
5391 "Front", "Surround", NULL /*CLFE*/, "Side"
5393 const char *pfx = alc_get_line_out_pfx(spec, false);
5395 int i, err, noutputs;
5397 noutputs = cfg->line_outs;
5398 if (spec->multi_ios > 0)
5399 noutputs += spec->multi_ios;
5401 for (i = 0; i < noutputs; i++) {
5402 if (!spec->multiout.dac_nids[i])
5404 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5405 if (!pfx && i == 2) {
5407 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5409 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5413 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5415 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5419 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5421 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5425 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5427 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5432 const char *name = pfx;
5438 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5440 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5444 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5446 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5455 /* add playback controls for speaker and HP outputs */
5456 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5465 if (alc880_is_fixed_pin(pin)) {
5466 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5467 /* specify the DAC as the extra output */
5468 if (!spec->multiout.hp_nid)
5469 spec->multiout.hp_nid = nid;
5471 spec->multiout.extra_out_nid[0] = nid;
5472 /* control HP volume/switch on the output mixer amp */
5473 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5474 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5475 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5478 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5479 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5482 } else if (alc880_is_multi_pin(pin)) {
5483 /* set manual connection */
5484 /* we have only a switch on HP-out PIN */
5485 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5486 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5493 /* create input playback/capture controls for the given pin */
5494 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5495 const char *ctlname, int ctlidx,
5496 int idx, hda_nid_t mix_nid)
5500 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5501 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5504 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5505 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5511 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5513 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5514 return (pincap & AC_PINCAP_IN) != 0;
5517 /* create playback/capture controls for input pins */
5518 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5519 const struct auto_pin_cfg *cfg,
5521 hda_nid_t cap1, hda_nid_t cap2)
5523 struct alc_spec *spec = codec->spec;
5524 struct hda_input_mux *imux = &spec->private_imux[0];
5525 int i, err, idx, type_idx = 0;
5526 const char *prev_label = NULL;
5528 for (i = 0; i < cfg->num_inputs; i++) {
5532 pin = cfg->inputs[i].pin;
5533 if (!alc_is_input_pin(codec, pin))
5536 label = hda_get_autocfg_input_label(codec, cfg, i);
5537 if (prev_label && !strcmp(label, prev_label))
5544 idx = get_connection_index(codec, mixer, pin);
5546 err = new_analog_input(spec, pin,
5556 idx = get_connection_index(codec, cap1, pin);
5557 if (idx < 0 && cap2)
5558 idx = get_connection_index(codec, cap2, pin);
5560 snd_hda_add_imux_item(imux, label, idx, NULL);
5565 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5566 const struct auto_pin_cfg *cfg)
5568 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5571 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5572 unsigned int pin_type)
5574 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5577 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5581 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5582 hda_nid_t nid, int pin_type,
5585 alc_set_pin_output(codec, nid, pin_type);
5586 /* need the manual connection? */
5587 if (alc880_is_multi_pin(nid)) {
5588 struct alc_spec *spec = codec->spec;
5589 int idx = alc880_multi_pin_idx(nid);
5590 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5591 AC_VERB_SET_CONNECT_SEL,
5592 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5596 static int get_pin_type(int line_out_type)
5598 if (line_out_type == AUTO_PIN_HP_OUT)
5604 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5606 struct alc_spec *spec = codec->spec;
5609 for (i = 0; i < spec->autocfg.line_outs; i++) {
5610 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5611 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5612 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5616 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5618 struct alc_spec *spec = codec->spec;
5621 pin = spec->autocfg.speaker_pins[0];
5622 if (pin) /* connect to front */
5623 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5624 pin = spec->autocfg.hp_pins[0];
5625 if (pin) /* connect to front */
5626 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5629 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5631 struct alc_spec *spec = codec->spec;
5632 struct auto_pin_cfg *cfg = &spec->autocfg;
5635 for (i = 0; i < cfg->num_inputs; i++) {
5636 hda_nid_t nid = cfg->inputs[i].pin;
5637 if (alc_is_input_pin(codec, nid)) {
5638 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5639 if (nid != ALC880_PIN_CD_NID &&
5640 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5641 snd_hda_codec_write(codec, nid, 0,
5642 AC_VERB_SET_AMP_GAIN_MUTE,
5648 static void alc880_auto_init_input_src(struct hda_codec *codec)
5650 struct alc_spec *spec = codec->spec;
5653 for (c = 0; c < spec->num_adc_nids; c++) {
5654 unsigned int mux_idx;
5655 const struct hda_input_mux *imux;
5656 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5657 imux = &spec->input_mux[mux_idx];
5658 if (!imux->num_items && mux_idx > 0)
5659 imux = &spec->input_mux[0];
5661 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5662 AC_VERB_SET_CONNECT_SEL,
5663 imux->items[0].index);
5667 static int alc_auto_add_multi_channel_mode(struct hda_codec *codec);
5669 /* parse the BIOS configuration and set up the alc_spec */
5670 /* return 1 if successful, 0 if the proper config is not found,
5671 * or a negative error code
5673 static int alc880_parse_auto_config(struct hda_codec *codec)
5675 struct alc_spec *spec = codec->spec;
5677 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5679 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5683 if (!spec->autocfg.line_outs)
5684 return 0; /* can't find valid BIOS pin config */
5686 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5689 err = alc_auto_add_multi_channel_mode(codec);
5692 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5695 err = alc880_auto_create_extra_out(spec,
5696 spec->autocfg.speaker_pins[0],
5700 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5704 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5708 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5710 alc_auto_parse_digital(codec);
5712 if (spec->kctls.list)
5713 add_mixer(spec, spec->kctls.list);
5715 add_verb(spec, alc880_volume_init_verbs);
5717 spec->num_mux_defs = 1;
5718 spec->input_mux = &spec->private_imux[0];
5720 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5725 /* additional initialization for auto-configuration model */
5726 static void alc880_auto_init(struct hda_codec *codec)
5728 struct alc_spec *spec = codec->spec;
5729 alc880_auto_init_multi_out(codec);
5730 alc880_auto_init_extra_out(codec);
5731 alc880_auto_init_analog_input(codec);
5732 alc880_auto_init_input_src(codec);
5733 alc_auto_init_digital(codec);
5734 if (spec->unsol_event)
5735 alc_inithook(codec);
5738 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5739 * one of two digital mic pins, e.g. on ALC272
5741 static void fixup_automic_adc(struct hda_codec *codec)
5743 struct alc_spec *spec = codec->spec;
5746 for (i = 0; i < spec->num_adc_nids; i++) {
5747 hda_nid_t cap = spec->capsrc_nids ?
5748 spec->capsrc_nids[i] : spec->adc_nids[i];
5751 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5754 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5757 spec->int_mic.mux_idx = iidx;
5758 spec->ext_mic.mux_idx = eidx;
5759 if (spec->capsrc_nids)
5760 spec->capsrc_nids += i;
5761 spec->adc_nids += i;
5762 spec->num_adc_nids = 1;
5763 /* optional dock-mic */
5764 eidx = get_connection_index(codec, cap, spec->dock_mic.pin);
5766 spec->dock_mic.pin = 0;
5768 spec->dock_mic.mux_idx = eidx;
5771 snd_printd(KERN_INFO "hda_codec: %s: "
5772 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5773 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5774 spec->auto_mic = 0; /* disable auto-mic to be sure */
5777 /* select or unmute the given capsrc route */
5778 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5781 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5782 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5785 snd_hda_codec_write_cache(codec, cap, 0,
5786 AC_VERB_SET_CONNECT_SEL, idx);
5790 /* set the default connection to that pin */
5791 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5793 struct alc_spec *spec = codec->spec;
5798 for (i = 0; i < spec->num_adc_nids; i++) {
5799 hda_nid_t cap = spec->capsrc_nids ?
5800 spec->capsrc_nids[i] : spec->adc_nids[i];
5803 idx = get_connection_index(codec, cap, pin);
5806 select_or_unmute_capsrc(codec, cap, idx);
5807 return i; /* return the found index */
5809 return -1; /* not found */
5812 /* choose the ADC/MUX containing the input pin and initialize the setup */
5813 static void fixup_single_adc(struct hda_codec *codec)
5815 struct alc_spec *spec = codec->spec;
5816 struct auto_pin_cfg *cfg = &spec->autocfg;
5819 /* search for the input pin; there must be only one */
5820 if (cfg->num_inputs != 1)
5822 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5824 /* use only this ADC */
5825 if (spec->capsrc_nids)
5826 spec->capsrc_nids += i;
5827 spec->adc_nids += i;
5828 spec->num_adc_nids = 1;
5829 spec->single_input_src = 1;
5833 /* initialize dual adcs */
5834 static void fixup_dual_adc_switch(struct hda_codec *codec)
5836 struct alc_spec *spec = codec->spec;
5837 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5838 init_capsrc_for_pin(codec, spec->dock_mic.pin);
5839 init_capsrc_for_pin(codec, spec->int_mic.pin);
5842 /* initialize some special cases for input sources */
5843 static void alc_init_special_input_src(struct hda_codec *codec)
5845 struct alc_spec *spec = codec->spec;
5846 if (spec->dual_adc_switch)
5847 fixup_dual_adc_switch(codec);
5848 else if (spec->single_input_src)
5849 init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
5852 static void set_capture_mixer(struct hda_codec *codec)
5854 struct alc_spec *spec = codec->spec;
5855 static const struct snd_kcontrol_new *caps[2][3] = {
5856 { alc_capture_mixer_nosrc1,
5857 alc_capture_mixer_nosrc2,
5858 alc_capture_mixer_nosrc3 },
5859 { alc_capture_mixer1,
5861 alc_capture_mixer3 },
5863 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5865 int num_adcs = spec->num_adc_nids;
5866 if (spec->dual_adc_switch)
5868 else if (spec->auto_mic)
5869 fixup_automic_adc(codec);
5870 else if (spec->input_mux) {
5871 if (spec->input_mux->num_items > 1)
5873 else if (spec->input_mux->num_items == 1)
5874 fixup_single_adc(codec);
5876 spec->cap_mixer = caps[mux][num_adcs - 1];
5880 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5881 static void fillup_priv_adc_nids(struct hda_codec *codec, const hda_nid_t *nids,
5884 struct alc_spec *spec = codec->spec;
5885 struct auto_pin_cfg *cfg = &spec->autocfg;
5887 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5889 for (n = 0; n < num_nids; n++) {
5891 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5895 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5898 nconns = snd_hda_get_connections(codec, cap, conn,
5902 nconns = snd_hda_get_connections(codec, cap, conn,
5907 if (!fallback_adc) {
5911 for (i = 0; i < cfg->num_inputs; i++) {
5912 hda_nid_t nid = cfg->inputs[i].pin;
5913 for (j = 0; j < nconns; j++) {
5920 if (i >= cfg->num_inputs) {
5921 int num_adcs = spec->num_adc_nids;
5922 spec->private_adc_nids[num_adcs] = adc;
5923 spec->private_capsrc_nids[num_adcs] = cap;
5924 spec->num_adc_nids++;
5925 spec->adc_nids = spec->private_adc_nids;
5927 spec->capsrc_nids = spec->private_capsrc_nids;
5930 if (!spec->num_adc_nids) {
5931 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5932 " using fallback 0x%x\n",
5933 codec->chip_name, fallback_adc);
5934 spec->private_adc_nids[0] = fallback_adc;
5935 spec->adc_nids = spec->private_adc_nids;
5936 if (fallback_adc != fallback_cap) {
5937 spec->private_capsrc_nids[0] = fallback_cap;
5938 spec->capsrc_nids = spec->private_adc_nids;
5943 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5944 #define set_beep_amp(spec, nid, idx, dir) \
5945 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5947 static const struct snd_pci_quirk beep_white_list[] = {
5948 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5949 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5950 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5951 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
5952 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5956 static inline int has_cdefine_beep(struct hda_codec *codec)
5958 struct alc_spec *spec = codec->spec;
5959 const struct snd_pci_quirk *q;
5960 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5963 return spec->cdefine.enable_pcbeep;
5966 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5967 #define has_cdefine_beep(codec) 0
5971 * OK, here we have finally the patch for ALC880
5974 static int patch_alc880(struct hda_codec *codec)
5976 struct alc_spec *spec;
5980 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5986 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5989 if (board_config < 0) {
5990 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5992 board_config = ALC880_AUTO;
5995 if (board_config == ALC880_AUTO) {
5996 /* automatic parse from the BIOS config */
5997 err = alc880_parse_auto_config(codec);
6003 "hda_codec: Cannot set up configuration "
6004 "from BIOS. Using 3-stack mode...\n");
6005 board_config = ALC880_3ST;
6009 err = snd_hda_attach_beep_device(codec, 0x1);
6015 if (board_config != ALC880_AUTO)
6016 setup_preset(codec, &alc880_presets[board_config]);
6018 spec->stream_analog_playback = &alc880_pcm_analog_playback;
6019 spec->stream_analog_capture = &alc880_pcm_analog_capture;
6020 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6022 spec->stream_digital_playback = &alc880_pcm_digital_playback;
6023 spec->stream_digital_capture = &alc880_pcm_digital_capture;
6025 if (!spec->adc_nids && spec->input_mux) {
6026 /* check whether NID 0x07 is valid */
6027 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
6029 wcap = get_wcaps_type(wcap);
6030 if (wcap != AC_WID_AUD_IN) {
6031 spec->adc_nids = alc880_adc_nids_alt;
6032 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
6034 spec->adc_nids = alc880_adc_nids;
6035 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
6038 set_capture_mixer(codec);
6039 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6041 spec->vmaster_nid = 0x0c;
6043 codec->patch_ops = alc_patch_ops;
6044 if (board_config == ALC880_AUTO)
6045 spec->init_hook = alc880_auto_init;
6046 #ifdef CONFIG_SND_HDA_POWER_SAVE
6047 if (!spec->loopback.amplist)
6048 spec->loopback.amplist = alc880_loopbacks;
6059 static const hda_nid_t alc260_dac_nids[1] = {
6064 static const hda_nid_t alc260_adc_nids[1] = {
6069 static const hda_nid_t alc260_adc_nids_alt[1] = {
6074 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
6075 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
6077 static const hda_nid_t alc260_dual_adc_nids[2] = {
6082 #define ALC260_DIGOUT_NID 0x03
6083 #define ALC260_DIGIN_NID 0x06
6085 static const struct hda_input_mux alc260_capture_source = {
6089 { "Front Mic", 0x1 },
6095 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
6096 * headphone jack and the internal CD lines since these are the only pins at
6097 * which audio can appear. For flexibility, also allow the option of
6098 * recording the mixer output on the second ADC (ADC0 doesn't have a
6099 * connection to the mixer output).
6101 static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
6105 { "Mic/Line", 0x0 },
6107 { "Headphone", 0x2 },
6113 { "Mic/Line", 0x0 },
6115 { "Headphone", 0x2 },
6122 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6123 * the Fujitsu S702x, but jacks are marked differently.
6125 static const struct hda_input_mux alc260_acer_capture_sources[2] = {
6132 { "Headphone", 0x5 },
6141 { "Headphone", 0x6 },
6147 /* Maxdata Favorit 100XS */
6148 static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
6152 { "Line/Mic", 0x0 },
6159 { "Line/Mic", 0x0 },
6167 * This is just place-holder, so there's something for alc_build_pcms to look
6168 * at when it calculates the maximum number of channels. ALC260 has no mixer
6169 * element which allows changing the channel mode, so the verb list is
6172 static const struct hda_channel_mode alc260_modes[1] = {
6177 /* Mixer combinations
6179 * basic: base_output + input + pc_beep + capture
6180 * HP: base_output + input + capture_alt
6181 * HP_3013: hp_3013 + input + capture
6182 * fujitsu: fujitsu + capture
6183 * acer: acer + capture
6186 static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
6187 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6188 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6189 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6190 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6191 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6192 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6196 static const struct snd_kcontrol_new alc260_input_mixer[] = {
6197 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6198 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6199 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6200 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6202 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
6204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
6208 /* update HP, line and mono out pins according to the master switch */
6209 static void alc260_hp_master_update(struct hda_codec *codec)
6211 update_speakers(codec);
6214 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
6215 struct snd_ctl_elem_value *ucontrol)
6217 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6218 struct alc_spec *spec = codec->spec;
6219 *ucontrol->value.integer.value = !spec->master_mute;
6223 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
6224 struct snd_ctl_elem_value *ucontrol)
6226 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6227 struct alc_spec *spec = codec->spec;
6228 int val = !*ucontrol->value.integer.value;
6230 if (val == spec->master_mute)
6232 spec->master_mute = val;
6233 alc260_hp_master_update(codec);
6237 static const struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6240 .name = "Master Playback Switch",
6241 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6242 .info = snd_ctl_boolean_mono_info,
6243 .get = alc260_hp_master_sw_get,
6244 .put = alc260_hp_master_sw_put,
6246 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6247 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6248 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6249 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6250 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6252 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6256 static const struct hda_verb alc260_hp_unsol_verbs[] = {
6257 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6261 static void alc260_hp_setup(struct hda_codec *codec)
6263 struct alc_spec *spec = codec->spec;
6265 spec->autocfg.hp_pins[0] = 0x0f;
6266 spec->autocfg.speaker_pins[0] = 0x10;
6267 spec->autocfg.speaker_pins[1] = 0x11;
6269 spec->automute_mode = ALC_AUTOMUTE_PIN;
6272 static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6275 .name = "Master Playback Switch",
6276 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6277 .info = snd_ctl_boolean_mono_info,
6278 .get = alc260_hp_master_sw_get,
6279 .put = alc260_hp_master_sw_put,
6281 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6282 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6283 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6284 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6285 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6286 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6287 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6288 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6292 static void alc260_hp_3013_setup(struct hda_codec *codec)
6294 struct alc_spec *spec = codec->spec;
6296 spec->autocfg.hp_pins[0] = 0x15;
6297 spec->autocfg.speaker_pins[0] = 0x10;
6298 spec->autocfg.speaker_pins[1] = 0x11;
6300 spec->automute_mode = ALC_AUTOMUTE_PIN;
6303 static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6304 .ops = &snd_hda_bind_vol,
6306 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6307 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6308 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6313 static const struct hda_bind_ctls alc260_dc7600_bind_switch = {
6314 .ops = &snd_hda_bind_sw,
6316 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6317 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6322 static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6323 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6324 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6325 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6330 static const struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6331 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6335 static void alc260_hp_3012_setup(struct hda_codec *codec)
6337 struct alc_spec *spec = codec->spec;
6339 spec->autocfg.hp_pins[0] = 0x10;
6340 spec->autocfg.speaker_pins[0] = 0x0f;
6341 spec->autocfg.speaker_pins[1] = 0x11;
6342 spec->autocfg.speaker_pins[2] = 0x15;
6344 spec->automute_mode = ALC_AUTOMUTE_PIN;
6347 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6348 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6350 static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6351 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6352 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6353 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6354 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6355 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6356 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6357 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6358 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6359 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6360 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6364 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6365 * versions of the ALC260 don't act on requests to enable mic bias from NID
6366 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6367 * datasheet doesn't mention this restriction. At this stage it's not clear
6368 * whether this behaviour is intentional or is a hardware bug in chip
6369 * revisions available in early 2006. Therefore for now allow the
6370 * "Headphone Jack Mode" control to span all choices, but if it turns out
6371 * that the lack of mic bias for this NID is intentional we could change the
6372 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6374 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6375 * don't appear to make the mic bias available from the "line" jack, even
6376 * though the NID used for this jack (0x14) can supply it. The theory is
6377 * that perhaps Acer have included blocking capacitors between the ALC260
6378 * and the output jack. If this turns out to be the case for all such
6379 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6380 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6382 * The C20x Tablet series have a mono internal speaker which is controlled
6383 * via the chip's Mono sum widget and pin complex, so include the necessary
6384 * controls for such models. On models without a "mono speaker" the control
6385 * won't do anything.
6387 static const struct snd_kcontrol_new alc260_acer_mixer[] = {
6388 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6389 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6390 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6391 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6393 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6395 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6396 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6398 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6399 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6400 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6401 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6402 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6406 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6408 static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6409 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6410 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6411 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6412 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6413 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6414 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6418 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6419 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6421 static const struct snd_kcontrol_new alc260_will_mixer[] = {
6422 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6423 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6425 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6426 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6427 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6428 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6429 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6430 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6431 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6435 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6436 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6438 static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6439 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6440 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6441 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6442 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6443 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6444 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6445 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6446 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6447 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6448 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6453 * initialization verbs
6455 static const struct hda_verb alc260_init_verbs[] = {
6456 /* Line In pin widget for input */
6457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6458 /* CD pin widget for input */
6459 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6460 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6461 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6462 /* Mic2 (front panel) pin widget for input and vref at 80% */
6463 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6464 /* LINE-2 is used for line-out in rear */
6465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6466 /* select line-out */
6467 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6469 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6471 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6473 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6474 /* mute capture amp left and right */
6475 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6476 /* set connection select to line in (default select for this ADC) */
6477 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6478 /* mute capture amp left and right */
6479 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6480 /* set connection select to line in (default select for this ADC) */
6481 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6482 /* set vol=0 Line-Out mixer amp left and right */
6483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6484 /* unmute pin widget amp left and right (no gain on this amp) */
6485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6486 /* set vol=0 HP mixer amp left and right */
6487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6488 /* unmute pin widget amp left and right (no gain on this amp) */
6489 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6490 /* set vol=0 Mono mixer amp left and right */
6491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6492 /* unmute pin widget amp left and right (no gain on this amp) */
6493 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6494 /* unmute LINE-2 out pin */
6495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6496 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6499 /* mute analog inputs */
6500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6503 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6504 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6505 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6506 /* mute Front out path */
6507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6509 /* mute Headphone out path */
6510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6512 /* mute Mono out path */
6513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6518 #if 0 /* should be identical with alc260_init_verbs? */
6519 static const struct hda_verb alc260_hp_init_verbs[] = {
6520 /* Headphone and output */
6521 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6523 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6524 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6525 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6526 /* Mic2 (front panel) pin widget for input and vref at 80% */
6527 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6528 /* Line In pin widget for input */
6529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6530 /* Line-2 pin widget for output */
6531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6532 /* CD pin widget for input */
6533 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6534 /* unmute amp left and right */
6535 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6536 /* set connection select to line in (default select for this ADC) */
6537 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6538 /* unmute Line-Out mixer amp left and right (volume = 0) */
6539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6540 /* mute pin widget amp left and right (no gain on this amp) */
6541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6542 /* unmute HP mixer amp left and right (volume = 0) */
6543 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6544 /* mute pin widget amp left and right (no gain on this amp) */
6545 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6546 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6549 /* mute analog inputs */
6550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6555 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6556 /* Unmute Front out path */
6557 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6558 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6559 /* Unmute Headphone out path */
6560 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6561 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6562 /* Unmute Mono out path */
6563 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6564 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6569 static const struct hda_verb alc260_hp_3013_init_verbs[] = {
6570 /* Line out and output */
6571 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6573 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6574 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6575 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6576 /* Mic2 (front panel) pin widget for input and vref at 80% */
6577 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6578 /* Line In pin widget for input */
6579 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6580 /* Headphone pin widget for output */
6581 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6582 /* CD pin widget for input */
6583 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6584 /* unmute amp left and right */
6585 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6586 /* set connection select to line in (default select for this ADC) */
6587 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6588 /* unmute Line-Out mixer amp left and right (volume = 0) */
6589 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6590 /* mute pin widget amp left and right (no gain on this amp) */
6591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6592 /* unmute HP mixer amp left and right (volume = 0) */
6593 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6594 /* mute pin widget amp left and right (no gain on this amp) */
6595 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6596 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6599 /* mute analog inputs */
6600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6601 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6602 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6604 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6605 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6606 /* Unmute Front out path */
6607 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6608 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6609 /* Unmute Headphone out path */
6610 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6611 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6612 /* Unmute Mono out path */
6613 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6614 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6618 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6619 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6620 * audio = 0x16, internal speaker = 0x10.
6622 static const struct hda_verb alc260_fujitsu_init_verbs[] = {
6623 /* Disable all GPIOs */
6624 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6625 /* Internal speaker is connected to headphone pin */
6626 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6627 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6628 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6629 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6630 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6631 /* Ensure all other unused pins are disabled and muted. */
6632 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6634 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6635 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6636 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6637 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6641 /* Disable digital (SPDIF) pins */
6642 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6643 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6645 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6646 * when acting as an output.
6648 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6650 /* Start with output sum widgets muted and their output gains at min */
6651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6653 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6656 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6658 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6659 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6661 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6662 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6663 /* Unmute Line1 pin widget output buffer since it starts as an output.
6664 * If the pin mode is changed by the user the pin mode control will
6665 * take care of enabling the pin's input/output buffers as needed.
6666 * Therefore there's no need to enable the input buffer at this
6669 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6670 /* Unmute input buffer of pin widget used for Line-in (no equiv
6673 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6675 /* Mute capture amp left and right */
6676 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6677 /* Set ADC connection select to match default mixer setting - line
6680 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6682 /* Do the same for the second ADC: mute capture input amp and
6683 * set ADC connection to line in (on mic1 pin)
6685 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6686 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6688 /* Mute all inputs to mixer widget (even unconnected ones) */
6689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6693 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6694 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6701 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6702 * similar laptops (adapted from Fujitsu init verbs).
6704 static const struct hda_verb alc260_acer_init_verbs[] = {
6705 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6706 * the headphone jack. Turn this on and rely on the standard mute
6707 * methods whenever the user wants to turn these outputs off.
6709 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6710 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6711 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6712 /* Internal speaker/Headphone jack is connected to Line-out pin */
6713 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6714 /* Internal microphone/Mic jack is connected to Mic1 pin */
6715 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6716 /* Line In jack is connected to Line1 pin */
6717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6718 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6719 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6720 /* Ensure all other unused pins are disabled and muted. */
6721 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6722 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6723 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6724 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6725 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6727 /* Disable digital (SPDIF) pins */
6728 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6729 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6731 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6732 * bus when acting as outputs.
6734 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6735 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6737 /* Start with output sum widgets muted and their output gains at min */
6738 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6739 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6740 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6741 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6742 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6743 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6744 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6745 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6746 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6748 /* Unmute Line-out pin widget amp left and right
6749 * (no equiv mixer ctrl)
6751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6752 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6753 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6754 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6755 * inputs. If the pin mode is changed by the user the pin mode control
6756 * will take care of enabling the pin's input/output buffers as needed.
6757 * Therefore there's no need to enable the input buffer at this
6760 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6763 /* Mute capture amp left and right */
6764 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6765 /* Set ADC connection select to match default mixer setting - mic
6768 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6770 /* Do similar with the second ADC: mute capture input amp and
6771 * set ADC connection to mic to match ALSA's default state.
6773 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6774 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6776 /* Mute all inputs to mixer widget (even unconnected ones) */
6777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6784 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6789 /* Initialisation sequence for Maxdata Favorit 100XS
6790 * (adapted from Acer init verbs).
6792 static const struct hda_verb alc260_favorit100_init_verbs[] = {
6793 /* GPIO 0 enables the output jack.
6794 * Turn this on and rely on the standard mute
6795 * methods whenever the user wants to turn these outputs off.
6797 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6798 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6799 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6800 /* Line/Mic input jack is connected to Mic1 pin */
6801 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6802 /* Ensure all other unused pins are disabled and muted. */
6803 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6804 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6805 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6806 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6807 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6808 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6809 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6810 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6813 /* Disable digital (SPDIF) pins */
6814 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6815 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6817 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6818 * bus when acting as outputs.
6820 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6821 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6823 /* Start with output sum widgets muted and their output gains at min */
6824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6825 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6829 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6831 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6832 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6834 /* Unmute Line-out pin widget amp left and right
6835 * (no equiv mixer ctrl)
6837 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6838 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6839 * inputs. If the pin mode is changed by the user the pin mode control
6840 * will take care of enabling the pin's input/output buffers as needed.
6841 * Therefore there's no need to enable the input buffer at this
6844 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6846 /* Mute capture amp left and right */
6847 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6848 /* Set ADC connection select to match default mixer setting - mic
6851 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6853 /* Do similar with the second ADC: mute capture input amp and
6854 * set ADC connection to mic to match ALSA's default state.
6856 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6857 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6859 /* Mute all inputs to mixer widget (even unconnected ones) */
6860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6872 static const struct hda_verb alc260_will_verbs[] = {
6873 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6874 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6875 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6876 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6877 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6878 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6882 static const struct hda_verb alc260_replacer_672v_verbs[] = {
6883 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6884 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6885 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6887 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6888 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6889 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6891 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6895 /* toggle speaker-output according to the hp-jack state */
6896 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6898 unsigned int present;
6900 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6901 present = snd_hda_jack_detect(codec, 0x0f);
6903 snd_hda_codec_write_cache(codec, 0x01, 0,
6904 AC_VERB_SET_GPIO_DATA, 1);
6905 snd_hda_codec_write_cache(codec, 0x0f, 0,
6906 AC_VERB_SET_PIN_WIDGET_CONTROL,
6909 snd_hda_codec_write_cache(codec, 0x01, 0,
6910 AC_VERB_SET_GPIO_DATA, 0);
6911 snd_hda_codec_write_cache(codec, 0x0f, 0,
6912 AC_VERB_SET_PIN_WIDGET_CONTROL,
6917 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6920 if ((res >> 26) == ALC880_HP_EVENT)
6921 alc260_replacer_672v_automute(codec);
6924 static const struct hda_verb alc260_hp_dc7600_verbs[] = {
6925 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6926 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6927 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6928 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6929 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6931 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6932 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6933 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6934 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6938 /* Test configuration for debugging, modelled after the ALC880 test
6941 #ifdef CONFIG_SND_DEBUG
6942 static const hda_nid_t alc260_test_dac_nids[1] = {
6945 static const hda_nid_t alc260_test_adc_nids[2] = {
6948 /* For testing the ALC260, each input MUX needs its own definition since
6949 * the signal assignments are different. This assumes that the first ADC
6952 static const struct hda_input_mux alc260_test_capture_sources[2] = {
6956 { "MIC1 pin", 0x0 },
6957 { "MIC2 pin", 0x1 },
6958 { "LINE1 pin", 0x2 },
6959 { "LINE2 pin", 0x3 },
6961 { "LINE-OUT pin", 0x5 },
6962 { "HP-OUT pin", 0x6 },
6968 { "MIC1 pin", 0x0 },
6969 { "MIC2 pin", 0x1 },
6970 { "LINE1 pin", 0x2 },
6971 { "LINE2 pin", 0x3 },
6974 { "LINE-OUT pin", 0x6 },
6975 { "HP-OUT pin", 0x7 },
6979 static const struct snd_kcontrol_new alc260_test_mixer[] = {
6980 /* Output driver widgets */
6981 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6982 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6983 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6984 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6985 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6986 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6988 /* Modes for retasking pin widgets
6989 * Note: the ALC260 doesn't seem to act on requests to enable mic
6990 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6991 * mention this restriction. At this stage it's not clear whether
6992 * this behaviour is intentional or is a hardware bug in chip
6993 * revisions available at least up until early 2006. Therefore for
6994 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6995 * choices, but if it turns out that the lack of mic bias for these
6996 * NIDs is intentional we could change their modes from
6997 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6999 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
7000 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
7001 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
7002 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
7003 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
7004 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
7006 /* Loopback mixer controls */
7007 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
7008 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
7009 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
7010 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
7011 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
7012 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
7013 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
7014 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
7015 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
7016 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
7017 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
7018 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
7019 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
7020 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
7022 /* Controls for GPIO pins, assuming they are configured as outputs */
7023 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
7024 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
7025 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
7026 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
7028 /* Switches to allow the digital IO pins to be enabled. The datasheet
7029 * is ambigious as to which NID is which; testing on laptops which
7030 * make this output available should provide clarification.
7032 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
7033 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
7035 /* A switch allowing EAPD to be enabled. Some laptops seem to use
7036 * this output to turn on an external amplifier.
7038 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
7039 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
7043 static const struct hda_verb alc260_test_init_verbs[] = {
7044 /* Enable all GPIOs as outputs with an initial value of 0 */
7045 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
7046 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
7047 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
7049 /* Enable retasking pins as output, initially without power amp */
7050 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7051 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7052 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7053 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7054 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7055 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7057 /* Disable digital (SPDIF) pins initially, but users can enable
7058 * them via a mixer switch. In the case of SPDIF-out, this initverb
7059 * payload also sets the generation to 0, output to be in "consumer"
7060 * PCM format, copyright asserted, no pre-emphasis and no validity
7063 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
7064 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
7066 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
7067 * OUT1 sum bus when acting as an output.
7069 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
7070 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
7071 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
7072 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
7074 /* Start with output sum widgets muted and their output gains at min */
7075 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7076 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7080 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7081 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7082 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7083 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7085 /* Unmute retasking pin widget output buffers since the default
7086 * state appears to be output. As the pin mode is changed by the
7087 * user the pin mode control will take care of enabling the pin's
7088 * input/output buffers as needed.
7090 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7094 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7095 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7096 /* Also unmute the mono-out pin widget */
7097 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7099 /* Mute capture amp left and right */
7100 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7101 /* Set ADC connection select to match default mixer setting (mic1
7104 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7106 /* Do the same for the second ADC: mute capture input amp and
7107 * set ADC connection to mic1 pin
7109 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7110 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7112 /* Mute all inputs to mixer widget (even unconnected ones) */
7113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
7114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
7115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
7116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
7117 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
7118 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
7119 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
7120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
7126 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7127 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
7129 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
7130 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
7133 * for BIOS auto-configuration
7136 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
7137 const char *pfx, int *vol_bits)
7140 unsigned long vol_val, sw_val;
7143 if (nid >= 0x0f && nid < 0x11) {
7144 nid_vol = nid - 0x7;
7145 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
7146 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
7147 } else if (nid == 0x11) {
7148 nid_vol = nid - 0x7;
7149 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
7150 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
7151 } else if (nid >= 0x12 && nid <= 0x15) {
7153 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
7154 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
7158 if (!(*vol_bits & (1 << nid_vol))) {
7159 /* first control for the volume widget */
7160 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
7163 *vol_bits |= (1 << nid_vol);
7165 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
7171 /* add playback controls from the parsed DAC table */
7172 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
7173 const struct auto_pin_cfg *cfg)
7179 spec->multiout.num_dacs = 1;
7180 spec->multiout.dac_nids = spec->private_dac_nids;
7181 spec->private_dac_nids[0] = 0x02;
7183 nid = cfg->line_out_pins[0];
7186 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
7188 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
7192 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
7197 nid = cfg->speaker_pins[0];
7199 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
7204 nid = cfg->hp_pins[0];
7206 err = alc260_add_playback_controls(spec, nid, "Headphone",
7214 /* create playback/capture controls for input pins */
7215 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
7216 const struct auto_pin_cfg *cfg)
7218 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
7221 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7222 hda_nid_t nid, int pin_type,
7225 alc_set_pin_output(codec, nid, pin_type);
7226 /* need the manual connection? */
7228 int idx = nid - 0x12;
7229 snd_hda_codec_write(codec, idx + 0x0b, 0,
7230 AC_VERB_SET_CONNECT_SEL, sel_idx);
7234 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7236 struct alc_spec *spec = codec->spec;
7239 nid = spec->autocfg.line_out_pins[0];
7241 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7242 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7245 nid = spec->autocfg.speaker_pins[0];
7247 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7249 nid = spec->autocfg.hp_pins[0];
7251 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7254 #define ALC260_PIN_CD_NID 0x16
7255 static void alc260_auto_init_analog_input(struct hda_codec *codec)
7257 struct alc_spec *spec = codec->spec;
7258 struct auto_pin_cfg *cfg = &spec->autocfg;
7261 for (i = 0; i < cfg->num_inputs; i++) {
7262 hda_nid_t nid = cfg->inputs[i].pin;
7264 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
7265 if (nid != ALC260_PIN_CD_NID &&
7266 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
7267 snd_hda_codec_write(codec, nid, 0,
7268 AC_VERB_SET_AMP_GAIN_MUTE,
7274 #define alc260_auto_init_input_src alc880_auto_init_input_src
7277 * generic initialization of ADC, input mixers and output mixers
7279 static const struct hda_verb alc260_volume_init_verbs[] = {
7281 * Unmute ADC0-1 and set the default input to mic-in
7283 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7284 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7285 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7286 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7288 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7290 * Note: PASD motherboards uses the Line In 2 as the input for
7291 * front panel mic (mic 2)
7293 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7294 /* mute analog inputs */
7295 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7299 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7302 * Set up output mixers (0x08 - 0x0a)
7304 /* set vol=0 to output mixers */
7305 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7307 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7308 /* set up input amps for analog loopback */
7309 /* Amp Indices: DAC = 0, mixer = 1 */
7310 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7311 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7313 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7314 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7315 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7320 static int alc260_parse_auto_config(struct hda_codec *codec)
7322 struct alc_spec *spec = codec->spec;
7324 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
7326 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7330 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7333 if (!spec->kctls.list)
7334 return 0; /* can't find valid BIOS pin config */
7335 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7339 spec->multiout.max_channels = 2;
7341 if (spec->autocfg.dig_outs)
7342 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7343 if (spec->kctls.list)
7344 add_mixer(spec, spec->kctls.list);
7346 add_verb(spec, alc260_volume_init_verbs);
7348 spec->num_mux_defs = 1;
7349 spec->input_mux = &spec->private_imux[0];
7351 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7356 /* additional initialization for auto-configuration model */
7357 static void alc260_auto_init(struct hda_codec *codec)
7359 struct alc_spec *spec = codec->spec;
7360 alc260_auto_init_multi_out(codec);
7361 alc260_auto_init_analog_input(codec);
7362 alc260_auto_init_input_src(codec);
7363 alc_auto_init_digital(codec);
7364 if (spec->unsol_event)
7365 alc_inithook(codec);
7368 #ifdef CONFIG_SND_HDA_POWER_SAVE
7369 static const struct hda_amp_list alc260_loopbacks[] = {
7370 { 0x07, HDA_INPUT, 0 },
7371 { 0x07, HDA_INPUT, 1 },
7372 { 0x07, HDA_INPUT, 2 },
7373 { 0x07, HDA_INPUT, 3 },
7374 { 0x07, HDA_INPUT, 4 },
7386 static const struct alc_fixup alc260_fixups[] = {
7387 [PINFIX_HP_DC5750] = {
7388 .type = ALC_FIXUP_PINS,
7389 .v.pins = (const struct alc_pincfg[]) {
7390 { 0x11, 0x90130110 }, /* speaker */
7396 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
7397 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7402 * ALC260 configurations
7404 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7405 [ALC260_BASIC] = "basic",
7407 [ALC260_HP_3013] = "hp-3013",
7408 [ALC260_HP_DC7600] = "hp-dc7600",
7409 [ALC260_FUJITSU_S702X] = "fujitsu",
7410 [ALC260_ACER] = "acer",
7411 [ALC260_WILL] = "will",
7412 [ALC260_REPLACER_672V] = "replacer",
7413 [ALC260_FAVORIT100] = "favorit100",
7414 #ifdef CONFIG_SND_DEBUG
7415 [ALC260_TEST] = "test",
7417 [ALC260_AUTO] = "auto",
7420 static const struct snd_pci_quirk alc260_cfg_tbl[] = {
7421 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7422 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7423 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7424 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7425 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7426 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7427 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7428 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7429 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7430 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7431 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7432 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7433 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7434 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7435 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7436 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7437 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7438 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7439 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7440 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7444 static const struct alc_config_preset alc260_presets[] = {
7446 .mixers = { alc260_base_output_mixer,
7447 alc260_input_mixer },
7448 .init_verbs = { alc260_init_verbs },
7449 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7450 .dac_nids = alc260_dac_nids,
7451 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7452 .adc_nids = alc260_dual_adc_nids,
7453 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7454 .channel_mode = alc260_modes,
7455 .input_mux = &alc260_capture_source,
7458 .mixers = { alc260_hp_output_mixer,
7459 alc260_input_mixer },
7460 .init_verbs = { alc260_init_verbs,
7461 alc260_hp_unsol_verbs },
7462 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7463 .dac_nids = alc260_dac_nids,
7464 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7465 .adc_nids = alc260_adc_nids_alt,
7466 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7467 .channel_mode = alc260_modes,
7468 .input_mux = &alc260_capture_source,
7469 .unsol_event = alc_sku_unsol_event,
7470 .setup = alc260_hp_setup,
7471 .init_hook = alc_inithook,
7473 [ALC260_HP_DC7600] = {
7474 .mixers = { alc260_hp_dc7600_mixer,
7475 alc260_input_mixer },
7476 .init_verbs = { alc260_init_verbs,
7477 alc260_hp_dc7600_verbs },
7478 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7479 .dac_nids = alc260_dac_nids,
7480 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7481 .adc_nids = alc260_adc_nids_alt,
7482 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7483 .channel_mode = alc260_modes,
7484 .input_mux = &alc260_capture_source,
7485 .unsol_event = alc_sku_unsol_event,
7486 .setup = alc260_hp_3012_setup,
7487 .init_hook = alc_inithook,
7489 [ALC260_HP_3013] = {
7490 .mixers = { alc260_hp_3013_mixer,
7491 alc260_input_mixer },
7492 .init_verbs = { alc260_hp_3013_init_verbs,
7493 alc260_hp_3013_unsol_verbs },
7494 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7495 .dac_nids = alc260_dac_nids,
7496 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7497 .adc_nids = alc260_adc_nids_alt,
7498 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7499 .channel_mode = alc260_modes,
7500 .input_mux = &alc260_capture_source,
7501 .unsol_event = alc_sku_unsol_event,
7502 .setup = alc260_hp_3013_setup,
7503 .init_hook = alc_inithook,
7505 [ALC260_FUJITSU_S702X] = {
7506 .mixers = { alc260_fujitsu_mixer },
7507 .init_verbs = { alc260_fujitsu_init_verbs },
7508 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7509 .dac_nids = alc260_dac_nids,
7510 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7511 .adc_nids = alc260_dual_adc_nids,
7512 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7513 .channel_mode = alc260_modes,
7514 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7515 .input_mux = alc260_fujitsu_capture_sources,
7518 .mixers = { alc260_acer_mixer },
7519 .init_verbs = { alc260_acer_init_verbs },
7520 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7521 .dac_nids = alc260_dac_nids,
7522 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7523 .adc_nids = alc260_dual_adc_nids,
7524 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7525 .channel_mode = alc260_modes,
7526 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7527 .input_mux = alc260_acer_capture_sources,
7529 [ALC260_FAVORIT100] = {
7530 .mixers = { alc260_favorit100_mixer },
7531 .init_verbs = { alc260_favorit100_init_verbs },
7532 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7533 .dac_nids = alc260_dac_nids,
7534 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7535 .adc_nids = alc260_dual_adc_nids,
7536 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7537 .channel_mode = alc260_modes,
7538 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7539 .input_mux = alc260_favorit100_capture_sources,
7542 .mixers = { alc260_will_mixer },
7543 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7544 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7545 .dac_nids = alc260_dac_nids,
7546 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7547 .adc_nids = alc260_adc_nids,
7548 .dig_out_nid = ALC260_DIGOUT_NID,
7549 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7550 .channel_mode = alc260_modes,
7551 .input_mux = &alc260_capture_source,
7553 [ALC260_REPLACER_672V] = {
7554 .mixers = { alc260_replacer_672v_mixer },
7555 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7556 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7557 .dac_nids = alc260_dac_nids,
7558 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7559 .adc_nids = alc260_adc_nids,
7560 .dig_out_nid = ALC260_DIGOUT_NID,
7561 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7562 .channel_mode = alc260_modes,
7563 .input_mux = &alc260_capture_source,
7564 .unsol_event = alc260_replacer_672v_unsol_event,
7565 .init_hook = alc260_replacer_672v_automute,
7567 #ifdef CONFIG_SND_DEBUG
7569 .mixers = { alc260_test_mixer },
7570 .init_verbs = { alc260_test_init_verbs },
7571 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7572 .dac_nids = alc260_test_dac_nids,
7573 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7574 .adc_nids = alc260_test_adc_nids,
7575 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7576 .channel_mode = alc260_modes,
7577 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7578 .input_mux = alc260_test_capture_sources,
7583 static int patch_alc260(struct hda_codec *codec)
7585 struct alc_spec *spec;
7586 int err, board_config;
7588 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7594 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7597 if (board_config < 0) {
7598 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7600 board_config = ALC260_AUTO;
7603 if (board_config == ALC260_AUTO) {
7604 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7605 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7608 if (board_config == ALC260_AUTO) {
7609 /* automatic parse from the BIOS config */
7610 err = alc260_parse_auto_config(codec);
7616 "hda_codec: Cannot set up configuration "
7617 "from BIOS. Using base mode...\n");
7618 board_config = ALC260_BASIC;
7622 err = snd_hda_attach_beep_device(codec, 0x1);
7628 if (board_config != ALC260_AUTO)
7629 setup_preset(codec, &alc260_presets[board_config]);
7631 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7632 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7633 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7635 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7636 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7638 if (!spec->adc_nids && spec->input_mux) {
7639 /* check whether NID 0x04 is valid */
7640 unsigned int wcap = get_wcaps(codec, 0x04);
7641 wcap = get_wcaps_type(wcap);
7643 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7644 spec->adc_nids = alc260_adc_nids_alt;
7645 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7647 spec->adc_nids = alc260_adc_nids;
7648 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7651 set_capture_mixer(codec);
7652 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7654 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7656 spec->vmaster_nid = 0x08;
7658 codec->patch_ops = alc_patch_ops;
7659 if (board_config == ALC260_AUTO)
7660 spec->init_hook = alc260_auto_init;
7661 spec->shutup = alc_eapd_shutup;
7662 #ifdef CONFIG_SND_HDA_POWER_SAVE
7663 if (!spec->loopback.amplist)
7664 spec->loopback.amplist = alc260_loopbacks;
7672 * ALC882/883/885/888/889 support
7674 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7675 * configuration. Each pin widget can choose any input DACs and a mixer.
7676 * Each ADC is connected from a mixer of all inputs. This makes possible
7677 * 6-channel independent captures.
7679 * In addition, an independent DAC for the multi-playback (not used in this
7682 #define ALC882_DIGOUT_NID 0x06
7683 #define ALC882_DIGIN_NID 0x0a
7684 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7685 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7686 #define ALC1200_DIGOUT_NID 0x10
7689 static const struct hda_channel_mode alc882_ch_modes[1] = {
7694 static const hda_nid_t alc882_dac_nids[4] = {
7695 /* front, rear, clfe, rear_surr */
7696 0x02, 0x03, 0x04, 0x05
7698 #define alc883_dac_nids alc882_dac_nids
7701 #define alc882_adc_nids alc880_adc_nids
7702 #define alc882_adc_nids_alt alc880_adc_nids_alt
7703 #define alc883_adc_nids alc882_adc_nids_alt
7704 static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7705 static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7706 #define alc889_adc_nids alc880_adc_nids
7708 static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7709 static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7710 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7711 static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7712 #define alc889_capsrc_nids alc882_capsrc_nids
7715 /* FIXME: should be a matrix-type input source selection */
7717 static const struct hda_input_mux alc882_capture_source = {
7721 { "Front Mic", 0x1 },
7727 #define alc883_capture_source alc882_capture_source
7729 static const struct hda_input_mux alc889_capture_source = {
7732 { "Front Mic", 0x0 },
7738 static const struct hda_input_mux mb5_capture_source = {
7747 static const struct hda_input_mux macmini3_capture_source = {
7755 static const struct hda_input_mux alc883_3stack_6ch_intel = {
7759 { "Front Mic", 0x0 },
7765 static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
7773 static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7777 { "Internal Mic", 0x1 },
7783 static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7787 { "Internal Mic", 0x1 },
7791 static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
7795 { "Front Mic", 0x1 },
7800 static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
7808 static const struct hda_input_mux alc889A_mb31_capture_source = {
7812 /* Front Mic (0x01) unused */
7814 /* Line 2 (0x03) unused */
7815 /* CD (0x04) unused? */
7819 static const struct hda_input_mux alc889A_imac91_capture_source = {
7823 { "Line", 0x2 }, /* Not sure! */
7830 static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7837 static const struct hda_verb alc882_3ST_ch2_init[] = {
7838 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7839 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7848 static const struct hda_verb alc882_3ST_ch4_init[] = {
7849 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7851 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7852 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7853 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7860 static const struct hda_verb alc882_3ST_ch6_init[] = {
7861 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7862 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7863 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7864 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7865 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7866 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7870 static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7871 { 2, alc882_3ST_ch2_init },
7872 { 4, alc882_3ST_ch4_init },
7873 { 6, alc882_3ST_ch6_init },
7876 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7881 static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7882 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7883 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7884 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7885 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7886 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7893 static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7894 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7895 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7896 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7897 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7898 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7899 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7906 static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7907 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7908 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7909 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7910 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7913 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7917 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7918 { 2, alc883_3ST_ch2_clevo_init },
7919 { 4, alc883_3ST_ch4_clevo_init },
7920 { 6, alc883_3ST_ch6_clevo_init },
7927 static const struct hda_verb alc882_sixstack_ch6_init[] = {
7928 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7929 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7930 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7931 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7938 static const struct hda_verb alc882_sixstack_ch8_init[] = {
7939 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7940 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7941 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7942 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7946 static const struct hda_channel_mode alc882_sixstack_modes[2] = {
7947 { 6, alc882_sixstack_ch6_init },
7948 { 8, alc882_sixstack_ch8_init },
7952 /* Macbook Air 2,1 */
7954 static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7959 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7965 static const struct hda_verb alc885_mbp_ch2_init[] = {
7966 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7967 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7968 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7975 static const struct hda_verb alc885_mbp_ch4_init[] = {
7976 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7977 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7978 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7979 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7980 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7984 static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7985 { 2, alc885_mbp_ch2_init },
7986 { 4, alc885_mbp_ch4_init },
7991 * Speakers/Woofer/HP = Front
7994 static const struct hda_verb alc885_mb5_ch2_init[] = {
7995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7996 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8002 * Speakers/HP = Front
8006 static const struct hda_verb alc885_mb5_ch6_init[] = {
8007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8009 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8013 static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
8014 { 2, alc885_mb5_ch2_init },
8015 { 6, alc885_mb5_ch6_init },
8018 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
8023 static const struct hda_verb alc883_4ST_ch2_init[] = {
8024 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8025 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8026 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8027 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8028 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8029 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8036 static const struct hda_verb alc883_4ST_ch4_init[] = {
8037 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8038 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8039 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8040 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8041 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8042 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8043 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8050 static const struct hda_verb alc883_4ST_ch6_init[] = {
8051 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8052 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8053 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8054 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8055 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8056 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8057 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8058 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8065 static const struct hda_verb alc883_4ST_ch8_init[] = {
8066 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8067 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8068 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8069 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8070 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8071 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8072 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8073 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8074 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8078 static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
8079 { 2, alc883_4ST_ch2_init },
8080 { 4, alc883_4ST_ch4_init },
8081 { 6, alc883_4ST_ch6_init },
8082 { 8, alc883_4ST_ch8_init },
8089 static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
8090 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8091 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8092 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8093 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8100 static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
8101 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8102 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8103 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8104 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8105 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8112 static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
8113 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8114 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8115 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
8116 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8117 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8118 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8122 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
8123 { 2, alc883_3ST_ch2_intel_init },
8124 { 4, alc883_3ST_ch4_intel_init },
8125 { 6, alc883_3ST_ch6_intel_init },
8131 static const struct hda_verb alc889_ch2_intel_init[] = {
8132 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8133 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
8134 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
8135 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
8136 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8137 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8144 static const struct hda_verb alc889_ch6_intel_init[] = {
8145 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8146 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8147 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
8148 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8149 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8150 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8157 static const struct hda_verb alc889_ch8_intel_init[] = {
8158 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8159 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8160 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
8161 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8162 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
8163 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8164 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8168 static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
8169 { 2, alc889_ch2_intel_init },
8170 { 6, alc889_ch6_intel_init },
8171 { 8, alc889_ch8_intel_init },
8177 static const struct hda_verb alc883_sixstack_ch6_init[] = {
8178 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8179 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8180 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8181 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8188 static const struct hda_verb alc883_sixstack_ch8_init[] = {
8189 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8190 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8191 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8192 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8196 static const struct hda_channel_mode alc883_sixstack_modes[2] = {
8197 { 6, alc883_sixstack_ch6_init },
8198 { 8, alc883_sixstack_ch8_init },
8202 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8203 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8205 static const struct snd_kcontrol_new alc882_base_mixer[] = {
8206 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8207 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8208 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8210 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8215 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8217 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8218 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8225 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8226 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8230 /* Macbook Air 2,1 same control for HP and internal Speaker */
8232 static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
8233 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8234 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8239 static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8240 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8241 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8243 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8245 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8246 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8248 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8254 static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
8255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8256 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8257 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8258 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8259 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8260 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8261 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8262 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8264 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8266 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8268 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8272 static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8274 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8275 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8276 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8277 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8278 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8280 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8282 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8287 static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
8288 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8289 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8294 static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8295 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8296 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8297 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8298 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8299 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8300 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8302 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8303 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8307 static const struct snd_kcontrol_new alc882_targa_mixer[] = {
8308 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8309 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8310 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8311 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8312 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8313 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8314 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8317 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8318 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8319 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8320 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8324 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8325 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8327 static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8328 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8329 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8330 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8331 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8332 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8333 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8334 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8335 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8337 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8344 static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8345 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8346 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8353 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8358 static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
8360 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8361 .name = "Channel Mode",
8362 .info = alc_ch_mode_info,
8363 .get = alc_ch_mode_get,
8364 .put = alc_ch_mode_put,
8369 static const struct hda_verb alc882_base_init_verbs[] = {
8370 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8374 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8375 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8377 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8378 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8380 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8381 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8383 /* Front Pin: output 0 (0x0c) */
8384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8385 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8386 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 /* Rear Pin: output 1 (0x0d) */
8388 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8389 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8390 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8391 /* CLFE Pin: output 2 (0x0e) */
8392 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8393 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8394 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8395 /* Side Pin: output 3 (0x0f) */
8396 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8397 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8398 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8399 /* Mic (rear) pin: input vref at 80% */
8400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8402 /* Front Mic pin: input vref at 80% */
8403 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8404 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8405 /* Line In pin: input */
8406 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8407 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8408 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8409 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8410 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8411 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8412 /* CD pin widget for input */
8413 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8415 /* FIXME: use matrix-type input source selection */
8416 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8421 /* ADC2: mute amp left and right */
8422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8423 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8424 /* ADC3: mute amp left and right */
8425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8426 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8431 static const struct hda_verb alc882_adc1_init_verbs[] = {
8432 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8437 /* ADC1: mute amp left and right */
8438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8439 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8443 static const struct hda_verb alc882_eapd_verbs[] = {
8444 /* change to EAPD mode */
8445 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8446 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8450 static const struct hda_verb alc889_eapd_verbs[] = {
8451 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8452 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8456 static const struct hda_verb alc_hp15_unsol_verbs[] = {
8457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8458 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8462 static const struct hda_verb alc885_init_verbs[] = {
8463 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8473 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8476 /* Front HP Pin: output 0 (0x0c) */
8477 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8479 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8480 /* Front Pin: output 0 (0x0c) */
8481 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8482 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8483 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 /* Rear Pin: output 1 (0x0d) */
8485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8487 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8488 /* CLFE Pin: output 2 (0x0e) */
8489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8490 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8491 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8492 /* Side Pin: output 3 (0x0f) */
8493 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8494 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8495 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8496 /* Mic (rear) pin: input vref at 80% */
8497 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8498 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8499 /* Front Mic pin: input vref at 80% */
8500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8502 /* Line In pin: input */
8503 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8504 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8506 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8513 /* ADC2: mute amp left and right */
8514 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8515 /* ADC3: mute amp left and right */
8516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8521 static const struct hda_verb alc885_init_input_verbs[] = {
8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8529 /* Unmute Selector 24h and set the default input to front mic */
8530 static const struct hda_verb alc889_init_input_verbs[] = {
8531 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8537 #define alc883_init_verbs alc882_base_init_verbs
8540 static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
8541 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8542 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8544 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8545 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8546 /* FIXME: this looks suspicious...
8547 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8548 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8553 static const struct hda_verb alc882_macpro_init_verbs[] = {
8554 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8558 /* Front Pin: output 0 (0x0c) */
8559 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8561 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8562 /* Front Mic pin: input vref at 80% */
8563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8564 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8565 /* Speaker: output */
8566 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8567 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8568 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8569 /* Headphone output (output 0 - 0x0c) */
8570 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8571 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8572 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8574 /* FIXME: use matrix-type input source selection */
8575 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8576 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8580 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8582 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8583 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8584 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8585 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8591 /* ADC1: mute amp left and right */
8592 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8593 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8594 /* ADC2: mute amp left and right */
8595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8596 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8597 /* ADC3: mute amp left and right */
8598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8599 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8605 static const struct hda_verb alc885_mb5_init_verbs[] = {
8607 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8608 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8609 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8610 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8615 /* Surround mixer */
8616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8624 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8625 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8626 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8627 /* Front Pin (0x0c) */
8628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8629 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8630 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8631 /* LFE Pin (0x0e) */
8632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8633 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8634 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8637 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8638 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8639 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8640 /* Front Mic pin: input vref at 80% */
8641 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8642 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8654 static const struct hda_verb alc885_macmini3_init_verbs[] = {
8656 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8657 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8658 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8659 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8664 /* Surround mixer */
8665 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8666 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8667 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8669 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8670 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8671 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8676 /* Front Pin (0x0c) */
8677 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8678 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8679 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8680 /* LFE Pin (0x0e) */
8681 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8682 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8683 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8685 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8686 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8687 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8688 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8701 static const struct hda_verb alc885_mba21_init_verbs[] = {
8702 /*Internal and HP Speaker Mixer*/
8703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8706 /*Internal Speaker Pin (0x0c)*/
8707 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8708 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8709 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8710 /* HP Pin: output 0 (0x0e) */
8711 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8712 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8713 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8714 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8715 /* Line in (is hp when jack connected)*/
8716 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8717 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8723 /* Macbook Pro rev3 */
8724 static const struct hda_verb alc885_mbp3_init_verbs[] = {
8725 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8726 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8727 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8728 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8730 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8731 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8736 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8737 /* Front Pin: output 0 (0x0c) */
8738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8740 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8741 /* HP Pin: output 0 (0x0e) */
8742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8744 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8745 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8746 /* Mic (rear) pin: input vref at 80% */
8747 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8748 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8749 /* Front Mic pin: input vref at 80% */
8750 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8751 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8752 /* Line In pin: use output 1 when in LineOut mode */
8753 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8754 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8755 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8757 /* FIXME: use matrix-type input source selection */
8758 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8759 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8761 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8762 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8763 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8768 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8774 /* ADC1: mute amp left and right */
8775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8776 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8777 /* ADC2: mute amp left and right */
8778 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8779 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8780 /* ADC3: mute amp left and right */
8781 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8782 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8788 static const struct hda_verb alc885_imac91_init_verbs[] = {
8789 /* Internal Speaker Pin (0x0c) */
8790 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8792 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8794 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8795 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8798 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8799 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8800 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8804 /* Front Mic pin: input vref at 80% */
8805 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8806 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8811 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8815 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8816 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8819 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8820 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8821 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8824 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8825 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8830 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8832 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8833 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8834 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8835 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8836 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8837 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8838 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8842 /* iMac 24 mixer. */
8843 static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
8844 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8845 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8849 /* iMac 24 init verbs. */
8850 static const struct hda_verb alc885_imac24_init_verbs[] = {
8851 /* Internal speakers: output 0 (0x0c) */
8852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8854 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8855 /* Internal speakers: output 0 (0x0c) */
8856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8858 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8859 /* Headphone: output 0 (0x0c) */
8860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8862 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8863 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8864 /* Front Mic: input vref at 80% */
8865 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8866 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8870 /* Toggle speaker-output according to the hp-jack state */
8871 static void alc885_imac24_setup(struct hda_codec *codec)
8873 struct alc_spec *spec = codec->spec;
8875 spec->autocfg.hp_pins[0] = 0x14;
8876 spec->autocfg.speaker_pins[0] = 0x18;
8877 spec->autocfg.speaker_pins[1] = 0x1a;
8879 spec->automute_mode = ALC_AUTOMUTE_AMP;
8882 #define alc885_mb5_setup alc885_imac24_setup
8883 #define alc885_macmini3_setup alc885_imac24_setup
8885 /* Macbook Air 2,1 */
8886 static void alc885_mba21_setup(struct hda_codec *codec)
8888 struct alc_spec *spec = codec->spec;
8890 spec->autocfg.hp_pins[0] = 0x14;
8891 spec->autocfg.speaker_pins[0] = 0x18;
8893 spec->automute_mode = ALC_AUTOMUTE_AMP;
8898 static void alc885_mbp3_setup(struct hda_codec *codec)
8900 struct alc_spec *spec = codec->spec;
8902 spec->autocfg.hp_pins[0] = 0x15;
8903 spec->autocfg.speaker_pins[0] = 0x14;
8905 spec->automute_mode = ALC_AUTOMUTE_AMP;
8908 static void alc885_imac91_setup(struct hda_codec *codec)
8910 struct alc_spec *spec = codec->spec;
8912 spec->autocfg.hp_pins[0] = 0x14;
8913 spec->autocfg.speaker_pins[0] = 0x18;
8914 spec->autocfg.speaker_pins[1] = 0x1a;
8916 spec->automute_mode = ALC_AUTOMUTE_AMP;
8919 static const struct hda_verb alc882_targa_verbs[] = {
8920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8921 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8924 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8926 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8927 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8928 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8930 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8934 /* toggle speaker-output according to the hp-jack state */
8935 static void alc882_targa_automute(struct hda_codec *codec)
8937 struct alc_spec *spec = codec->spec;
8938 alc_hp_automute(codec);
8939 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8940 spec->jack_present ? 1 : 3);
8943 static void alc882_targa_setup(struct hda_codec *codec)
8945 struct alc_spec *spec = codec->spec;
8947 spec->autocfg.hp_pins[0] = 0x14;
8948 spec->autocfg.speaker_pins[0] = 0x1b;
8950 spec->automute_mode = ALC_AUTOMUTE_AMP;
8953 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8955 if ((res >> 26) == ALC880_HP_EVENT)
8956 alc882_targa_automute(codec);
8959 static const struct hda_verb alc882_asus_a7j_verbs[] = {
8960 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8965 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8967 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8968 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8969 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8971 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8972 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8973 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8977 static const struct hda_verb alc882_asus_a7m_verbs[] = {
8978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8985 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8986 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8987 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8989 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8990 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8991 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8995 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8997 unsigned int gpiostate, gpiomask, gpiodir;
8999 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
9000 AC_VERB_GET_GPIO_DATA, 0);
9003 gpiostate |= (1 << pin);
9005 gpiostate &= ~(1 << pin);
9007 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
9008 AC_VERB_GET_GPIO_MASK, 0);
9009 gpiomask |= (1 << pin);
9011 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
9012 AC_VERB_GET_GPIO_DIRECTION, 0);
9013 gpiodir |= (1 << pin);
9016 snd_hda_codec_write(codec, codec->afg, 0,
9017 AC_VERB_SET_GPIO_MASK, gpiomask);
9018 snd_hda_codec_write(codec, codec->afg, 0,
9019 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
9023 snd_hda_codec_write(codec, codec->afg, 0,
9024 AC_VERB_SET_GPIO_DATA, gpiostate);
9027 /* set up GPIO at initialization */
9028 static void alc885_macpro_init_hook(struct hda_codec *codec)
9030 alc882_gpio_mute(codec, 0, 0);
9031 alc882_gpio_mute(codec, 1, 0);
9034 /* set up GPIO and update auto-muting at initialization */
9035 static void alc885_imac24_init_hook(struct hda_codec *codec)
9037 alc885_macpro_init_hook(codec);
9038 alc_hp_automute(codec);
9042 * generic initialization of ADC, input mixers and output mixers
9044 static const struct hda_verb alc883_auto_init_verbs[] = {
9046 * Unmute ADC0-2 and set the default input to mic-in
9048 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9050 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9051 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9054 * Set up output mixers (0x0c - 0x0f)
9056 /* set vol=0 to output mixers */
9057 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9059 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9060 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9061 /* set up input amps for analog loopback */
9062 /* Amp Indices: DAC = 0, mixer = 1 */
9063 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9064 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9065 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9066 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9067 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9068 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9069 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9070 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9071 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9072 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9074 /* FIXME: use matrix-type input source selection */
9075 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9083 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
9084 static const struct hda_verb alc889A_mb31_ch2_init[] = {
9085 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9086 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9087 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
9088 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
9092 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
9093 static const struct hda_verb alc889A_mb31_ch4_init[] = {
9094 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9095 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9096 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
9097 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
9101 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
9102 static const struct hda_verb alc889A_mb31_ch5_init[] = {
9103 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
9104 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9105 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
9106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
9110 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
9111 static const struct hda_verb alc889A_mb31_ch6_init[] = {
9112 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
9113 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
9114 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
9115 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
9119 static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
9120 { 2, alc889A_mb31_ch2_init },
9121 { 4, alc889A_mb31_ch4_init },
9122 { 5, alc889A_mb31_ch5_init },
9123 { 6, alc889A_mb31_ch6_init },
9126 static const struct hda_verb alc883_medion_eapd_verbs[] = {
9127 /* eanable EAPD on medion laptop */
9128 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9129 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9133 #define alc883_base_mixer alc882_base_mixer
9135 static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
9136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9144 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9147 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9152 static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
9153 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9154 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9155 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9156 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9157 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9158 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9160 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9161 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9162 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9166 static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
9167 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9168 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9169 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9170 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9172 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9174 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9175 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9176 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9180 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
9181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9182 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9184 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9185 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9189 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9191 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9192 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9197 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
9198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9199 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9201 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9202 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9203 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9204 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9205 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9207 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9208 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9209 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9210 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9212 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9214 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9215 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9216 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9220 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
9221 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9222 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9223 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9224 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9225 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9235 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9236 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9237 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9238 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9239 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9240 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9244 static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9246 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9247 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9248 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9249 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9251 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9252 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9253 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9254 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9255 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9256 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9257 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9258 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9260 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9261 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9262 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9263 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9264 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9268 static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9269 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9271 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9272 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9273 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9274 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9275 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9276 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9277 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9278 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9279 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9280 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9281 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9283 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9285 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9286 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9287 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9291 static const struct snd_kcontrol_new alc883_targa_mixer[] = {
9292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9293 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9295 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9296 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9297 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9298 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9299 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9300 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9301 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9304 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9305 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9307 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9312 static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9314 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9316 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9317 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9318 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9320 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9322 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9323 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9324 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9328 static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9329 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9330 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9331 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9332 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9333 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9337 static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9338 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9339 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9340 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9341 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9343 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9344 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9349 static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9350 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9351 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9353 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9354 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9357 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9358 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9362 static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9363 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9364 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9365 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9366 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9367 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9368 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9372 static const struct hda_verb alc883_medion_wim2160_verbs[] = {
9373 /* Unmute front mixer */
9374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9377 /* Set speaker pin to front mixer */
9378 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9380 /* Init headphone pin */
9381 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9382 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9383 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9384 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9389 /* toggle speaker-output according to the hp-jack state */
9390 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9392 struct alc_spec *spec = codec->spec;
9394 spec->autocfg.hp_pins[0] = 0x1a;
9395 spec->autocfg.speaker_pins[0] = 0x15;
9397 spec->automute_mode = ALC_AUTOMUTE_AMP;
9400 static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9401 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9402 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9407 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9408 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9412 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9413 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9414 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9415 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9416 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9420 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9425 static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9426 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9427 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9428 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9429 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9430 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9431 0x0d, 1, 0x0, HDA_OUTPUT),
9432 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9433 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9434 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9435 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9436 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9437 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9438 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9439 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9440 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9441 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9442 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9443 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9444 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9445 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9446 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9450 static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9453 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9454 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9455 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9456 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9458 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9459 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9460 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9461 /* Output switches */
9462 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9463 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9464 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9466 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9467 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9469 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9470 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9471 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9472 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9476 static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9478 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9479 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9480 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9481 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9482 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9486 static const struct hda_bind_ctls alc883_bind_cap_vol = {
9487 .ops = &snd_hda_bind_vol,
9489 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9490 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9495 static const struct hda_bind_ctls alc883_bind_cap_switch = {
9496 .ops = &snd_hda_bind_sw,
9498 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9499 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9504 static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9505 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9506 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9510 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9511 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9512 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9516 static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9517 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9518 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9521 /* .name = "Capture Source", */
9522 .name = "Input Source",
9524 .info = alc_mux_enum_info,
9525 .get = alc_mux_enum_get,
9526 .put = alc_mux_enum_put,
9531 static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
9533 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9534 .name = "Channel Mode",
9535 .info = alc_ch_mode_info,
9536 .get = alc_ch_mode_get,
9537 .put = alc_ch_mode_put,
9542 /* toggle speaker-output according to the hp-jack state */
9543 static void alc883_mitac_setup(struct hda_codec *codec)
9545 struct alc_spec *spec = codec->spec;
9547 spec->autocfg.hp_pins[0] = 0x15;
9548 spec->autocfg.speaker_pins[0] = 0x14;
9549 spec->autocfg.speaker_pins[1] = 0x17;
9551 spec->automute_mode = ALC_AUTOMUTE_AMP;
9554 static const struct hda_verb alc883_mitac_verbs[] = {
9556 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9559 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9560 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9562 /* enable unsolicited event */
9563 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9564 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9569 static const struct hda_verb alc883_clevo_m540r_verbs[] = {
9571 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9574 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9576 /* enable unsolicited event */
9578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9579 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9585 static const struct hda_verb alc883_clevo_m720_verbs[] = {
9587 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9588 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9590 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9591 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9593 /* enable unsolicited event */
9594 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9600 static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9602 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9608 /* enable unsolicited event */
9609 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9614 static const struct hda_verb alc883_targa_verbs[] = {
9615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9618 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9619 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9621 /* Connect Line-Out side jack (SPDIF) to Side */
9622 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9623 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9624 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9625 /* Connect Mic jack to CLFE */
9626 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9627 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9628 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9629 /* Connect Line-in jack to Surround */
9630 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9632 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9633 /* Connect HP out jack to Front */
9634 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9635 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9636 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9638 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9643 static const struct hda_verb alc883_lenovo_101e_verbs[] = {
9644 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9645 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9646 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9650 static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9653 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9658 static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9661 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9662 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9663 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9667 static const struct hda_verb alc883_haier_w66_verbs[] = {
9668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9671 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9673 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9674 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9675 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9680 static const struct hda_verb alc888_lenovo_sky_verbs[] = {
9681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9682 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9683 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9684 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9685 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9687 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9688 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9692 static const struct hda_verb alc888_6st_dell_verbs[] = {
9693 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9697 static const struct hda_verb alc883_vaiott_verbs[] = {
9699 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9702 /* enable unsolicited event */
9703 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9708 static void alc888_3st_hp_setup(struct hda_codec *codec)
9710 struct alc_spec *spec = codec->spec;
9712 spec->autocfg.hp_pins[0] = 0x1b;
9713 spec->autocfg.speaker_pins[0] = 0x14;
9714 spec->autocfg.speaker_pins[1] = 0x16;
9715 spec->autocfg.speaker_pins[2] = 0x18;
9717 spec->automute_mode = ALC_AUTOMUTE_AMP;
9720 static const struct hda_verb alc888_3st_hp_verbs[] = {
9721 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9722 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9723 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9724 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9731 static const struct hda_verb alc888_3st_hp_2ch_init[] = {
9732 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9733 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9734 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9735 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9742 static const struct hda_verb alc888_3st_hp_4ch_init[] = {
9743 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9744 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9745 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9746 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9747 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9754 static const struct hda_verb alc888_3st_hp_6ch_init[] = {
9755 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9756 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9757 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9758 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9759 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9760 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9764 static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
9765 { 2, alc888_3st_hp_2ch_init },
9766 { 4, alc888_3st_hp_4ch_init },
9767 { 6, alc888_3st_hp_6ch_init },
9770 static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
9772 struct alc_spec *spec = codec->spec;
9774 spec->autocfg.hp_pins[0] = 0x1b;
9775 spec->autocfg.line_out_pins[0] = 0x14;
9776 spec->autocfg.speaker_pins[0] = 0x15;
9778 spec->automute_mode = ALC_AUTOMUTE_AMP;
9781 /* toggle speaker-output according to the hp-jack state */
9782 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9784 struct alc_spec *spec = codec->spec;
9786 spec->autocfg.hp_pins[0] = 0x14;
9787 spec->autocfg.speaker_pins[0] = 0x15;
9789 spec->automute_mode = ALC_AUTOMUTE_AMP;
9792 /* toggle speaker-output according to the hp-jack state */
9793 #define alc883_targa_init_hook alc882_targa_init_hook
9794 #define alc883_targa_unsol_event alc882_targa_unsol_event
9796 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9798 struct alc_spec *spec = codec->spec;
9800 spec->autocfg.hp_pins[0] = 0x15;
9801 spec->autocfg.speaker_pins[0] = 0x14;
9803 spec->automute_mode = ALC_AUTOMUTE_AMP;
9806 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9808 alc_hp_automute(codec);
9809 alc88x_simple_mic_automute(codec);
9812 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9815 switch (res >> 26) {
9816 case ALC880_MIC_EVENT:
9817 alc88x_simple_mic_automute(codec);
9820 alc_sku_unsol_event(codec, res);
9825 /* toggle speaker-output according to the hp-jack state */
9826 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9828 struct alc_spec *spec = codec->spec;
9830 spec->autocfg.hp_pins[0] = 0x14;
9831 spec->autocfg.speaker_pins[0] = 0x15;
9833 spec->automute_mode = ALC_AUTOMUTE_AMP;
9836 static void alc883_haier_w66_setup(struct hda_codec *codec)
9838 struct alc_spec *spec = codec->spec;
9840 spec->autocfg.hp_pins[0] = 0x1b;
9841 spec->autocfg.speaker_pins[0] = 0x14;
9843 spec->automute_mode = ALC_AUTOMUTE_AMP;
9846 static void alc883_lenovo_101e_setup(struct hda_codec *codec)
9848 struct alc_spec *spec = codec->spec;
9850 spec->autocfg.hp_pins[0] = 0x1b;
9851 spec->autocfg.line_out_pins[0] = 0x14;
9852 spec->autocfg.speaker_pins[0] = 0x15;
9854 spec->detect_line = 1;
9855 spec->automute_lines = 1;
9856 spec->automute_mode = ALC_AUTOMUTE_AMP;
9859 /* toggle speaker-output according to the hp-jack state */
9860 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9862 struct alc_spec *spec = codec->spec;
9864 spec->autocfg.hp_pins[0] = 0x14;
9865 spec->autocfg.speaker_pins[0] = 0x15;
9866 spec->autocfg.speaker_pins[1] = 0x16;
9868 spec->automute_mode = ALC_AUTOMUTE_AMP;
9871 static const struct hda_verb alc883_acer_eapd_verbs[] = {
9872 /* HP Pin: output 0 (0x0c) */
9873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9875 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9876 /* Front Pin: output 0 (0x0c) */
9877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9878 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9880 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9881 /* eanable EAPD on medion laptop */
9882 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9883 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9884 /* enable unsolicited event */
9885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9889 static void alc888_6st_dell_setup(struct hda_codec *codec)
9891 struct alc_spec *spec = codec->spec;
9893 spec->autocfg.hp_pins[0] = 0x1b;
9894 spec->autocfg.speaker_pins[0] = 0x14;
9895 spec->autocfg.speaker_pins[1] = 0x15;
9896 spec->autocfg.speaker_pins[2] = 0x16;
9897 spec->autocfg.speaker_pins[3] = 0x17;
9899 spec->automute_mode = ALC_AUTOMUTE_AMP;
9902 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9904 struct alc_spec *spec = codec->spec;
9906 spec->autocfg.hp_pins[0] = 0x1b;
9907 spec->autocfg.speaker_pins[0] = 0x14;
9908 spec->autocfg.speaker_pins[1] = 0x15;
9909 spec->autocfg.speaker_pins[2] = 0x16;
9910 spec->autocfg.speaker_pins[3] = 0x17;
9911 spec->autocfg.speaker_pins[4] = 0x1a;
9913 spec->automute_mode = ALC_AUTOMUTE_AMP;
9916 static void alc883_vaiott_setup(struct hda_codec *codec)
9918 struct alc_spec *spec = codec->spec;
9920 spec->autocfg.hp_pins[0] = 0x15;
9921 spec->autocfg.speaker_pins[0] = 0x14;
9922 spec->autocfg.speaker_pins[1] = 0x17;
9924 spec->automute_mode = ALC_AUTOMUTE_AMP;
9927 static const struct hda_verb alc888_asus_m90v_verbs[] = {
9928 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9929 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9930 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9931 /* enable unsolicited event */
9932 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9933 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9937 static void alc883_mode2_setup(struct hda_codec *codec)
9939 struct alc_spec *spec = codec->spec;
9941 spec->autocfg.hp_pins[0] = 0x1b;
9942 spec->autocfg.speaker_pins[0] = 0x14;
9943 spec->autocfg.speaker_pins[1] = 0x15;
9944 spec->autocfg.speaker_pins[2] = 0x16;
9945 spec->ext_mic.pin = 0x18;
9946 spec->int_mic.pin = 0x19;
9947 spec->ext_mic.mux_idx = 0;
9948 spec->int_mic.mux_idx = 1;
9951 spec->automute_mode = ALC_AUTOMUTE_AMP;
9954 static const struct hda_verb alc888_asus_eee1601_verbs[] = {
9955 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9956 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9957 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9959 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9960 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9961 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9962 /* enable unsolicited event */
9963 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9967 static void alc883_eee1601_inithook(struct hda_codec *codec)
9969 struct alc_spec *spec = codec->spec;
9971 spec->autocfg.hp_pins[0] = 0x14;
9972 spec->autocfg.speaker_pins[0] = 0x1b;
9973 alc_hp_automute(codec);
9976 static const struct hda_verb alc889A_mb31_verbs[] = {
9977 /* Init rear pin (used as headphone output) */
9978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9979 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9980 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9981 /* Init line pin (used as output in 4ch and 6ch mode) */
9982 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9983 /* Init line 2 pin (used as headphone out by default) */
9984 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9985 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9989 /* Mute speakers according to the headphone jack state */
9990 static void alc889A_mb31_automute(struct hda_codec *codec)
9992 unsigned int present;
9994 /* Mute only in 2ch or 4ch mode */
9995 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9997 present = snd_hda_jack_detect(codec, 0x15);
9998 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9999 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10000 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10001 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10005 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
10007 if ((res >> 26) == ALC880_HP_EVENT)
10008 alc889A_mb31_automute(codec);
10012 #ifdef CONFIG_SND_HDA_POWER_SAVE
10013 #define alc882_loopbacks alc880_loopbacks
10016 /* pcm configuration: identical with ALC880 */
10017 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
10018 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
10019 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
10020 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
10022 static const hda_nid_t alc883_slave_dig_outs[] = {
10023 ALC1200_DIGOUT_NID, 0,
10026 static const hda_nid_t alc1200_slave_dig_outs[] = {
10027 ALC883_DIGOUT_NID, 0,
10031 * configuration and preset
10033 static const char * const alc882_models[ALC882_MODEL_LAST] = {
10034 [ALC882_3ST_DIG] = "3stack-dig",
10035 [ALC882_6ST_DIG] = "6stack-dig",
10036 [ALC882_ARIMA] = "arima",
10037 [ALC882_W2JC] = "w2jc",
10038 [ALC882_TARGA] = "targa",
10039 [ALC882_ASUS_A7J] = "asus-a7j",
10040 [ALC882_ASUS_A7M] = "asus-a7m",
10041 [ALC885_MACPRO] = "macpro",
10042 [ALC885_MB5] = "mb5",
10043 [ALC885_MACMINI3] = "macmini3",
10044 [ALC885_MBA21] = "mba21",
10045 [ALC885_MBP3] = "mbp3",
10046 [ALC885_IMAC24] = "imac24",
10047 [ALC885_IMAC91] = "imac91",
10048 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
10049 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
10050 [ALC883_3ST_6ch] = "3stack-6ch",
10051 [ALC883_6ST_DIG] = "alc883-6stack-dig",
10052 [ALC883_TARGA_DIG] = "targa-dig",
10053 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
10054 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
10055 [ALC883_ACER] = "acer",
10056 [ALC883_ACER_ASPIRE] = "acer-aspire",
10057 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
10058 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
10059 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
10060 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
10061 [ALC883_MEDION] = "medion",
10062 [ALC883_MEDION_WIM2160] = "medion-wim2160",
10063 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
10064 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
10065 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
10066 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
10067 [ALC888_LENOVO_SKY] = "lenovo-sky",
10068 [ALC883_HAIER_W66] = "haier-w66",
10069 [ALC888_3ST_HP] = "3stack-hp",
10070 [ALC888_6ST_DELL] = "6stack-dell",
10071 [ALC883_MITAC] = "mitac",
10072 [ALC883_CLEVO_M540R] = "clevo-m540r",
10073 [ALC883_CLEVO_M720] = "clevo-m720",
10074 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
10075 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
10076 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
10077 [ALC889A_INTEL] = "intel-alc889a",
10078 [ALC889_INTEL] = "intel-x58",
10079 [ALC1200_ASUS_P5Q] = "asus-p5q",
10080 [ALC889A_MB31] = "mb31",
10081 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
10082 [ALC882_AUTO] = "auto",
10085 static const struct snd_pci_quirk alc882_cfg_tbl[] = {
10086 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
10088 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
10089 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
10090 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
10091 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
10092 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
10093 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
10094 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
10095 ALC888_ACER_ASPIRE_4930G),
10096 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
10097 ALC888_ACER_ASPIRE_4930G),
10098 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
10099 ALC888_ACER_ASPIRE_8930G),
10100 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
10101 ALC888_ACER_ASPIRE_8930G),
10102 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
10103 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
10104 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
10105 ALC888_ACER_ASPIRE_6530G),
10106 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
10107 ALC888_ACER_ASPIRE_6530G),
10108 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
10109 ALC888_ACER_ASPIRE_7730G),
10110 /* default Acer -- disabled as it causes more problems.
10111 * model=auto should work fine now
10113 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
10115 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
10117 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
10118 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
10119 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
10120 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
10121 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
10122 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
10124 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
10125 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
10126 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
10127 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
10128 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
10129 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
10130 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
10131 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
10132 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
10133 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
10134 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
10136 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
10137 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
10138 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
10139 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
10140 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
10141 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
10142 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
10143 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
10144 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
10146 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
10147 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
10148 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
10149 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
10150 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
10151 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
10152 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
10153 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
10154 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
10155 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
10156 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
10157 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
10158 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
10159 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
10160 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
10161 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
10162 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
10163 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
10164 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
10165 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
10166 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
10167 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
10168 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
10169 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
10170 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
10171 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
10172 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
10173 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
10174 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
10175 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
10176 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
10178 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
10179 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
10180 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
10181 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
10182 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
10183 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
10184 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
10185 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
10186 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
10187 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
10188 ALC883_FUJITSU_PI2515),
10189 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
10190 ALC888_FUJITSU_XA3530),
10191 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
10192 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10193 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10194 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10195 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
10196 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
10197 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
10198 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
10200 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
10201 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
10202 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
10203 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
10204 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
10205 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
10206 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
10211 /* codec SSID table for Intel Mac */
10212 static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
10213 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
10214 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
10215 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
10216 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
10217 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
10218 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
10219 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
10220 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
10221 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
10222 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
10223 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
10224 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10225 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10226 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10227 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10228 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10229 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10230 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10231 * so apparently no perfect solution yet
10233 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10234 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10235 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10236 {} /* terminator */
10239 static const struct alc_config_preset alc882_presets[] = {
10240 [ALC882_3ST_DIG] = {
10241 .mixers = { alc882_base_mixer },
10242 .init_verbs = { alc882_base_init_verbs,
10243 alc882_adc1_init_verbs },
10244 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10245 .dac_nids = alc882_dac_nids,
10246 .dig_out_nid = ALC882_DIGOUT_NID,
10247 .dig_in_nid = ALC882_DIGIN_NID,
10248 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10249 .channel_mode = alc882_ch_modes,
10251 .input_mux = &alc882_capture_source,
10253 [ALC882_6ST_DIG] = {
10254 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10255 .init_verbs = { alc882_base_init_verbs,
10256 alc882_adc1_init_verbs },
10257 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10258 .dac_nids = alc882_dac_nids,
10259 .dig_out_nid = ALC882_DIGOUT_NID,
10260 .dig_in_nid = ALC882_DIGIN_NID,
10261 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10262 .channel_mode = alc882_sixstack_modes,
10263 .input_mux = &alc882_capture_source,
10266 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10267 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10268 alc882_eapd_verbs },
10269 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10270 .dac_nids = alc882_dac_nids,
10271 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10272 .channel_mode = alc882_sixstack_modes,
10273 .input_mux = &alc882_capture_source,
10276 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10277 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10278 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10279 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10280 .dac_nids = alc882_dac_nids,
10281 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10282 .channel_mode = alc880_threestack_modes,
10284 .input_mux = &alc882_capture_source,
10285 .dig_out_nid = ALC882_DIGOUT_NID,
10288 .mixers = { alc885_mba21_mixer },
10289 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10291 .dac_nids = alc882_dac_nids,
10292 .channel_mode = alc885_mba21_ch_modes,
10293 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10294 .input_mux = &alc882_capture_source,
10295 .unsol_event = alc_sku_unsol_event,
10296 .setup = alc885_mba21_setup,
10297 .init_hook = alc_hp_automute,
10300 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10301 .init_verbs = { alc885_mbp3_init_verbs,
10302 alc880_gpio1_init_verbs },
10304 .dac_nids = alc882_dac_nids,
10306 .channel_mode = alc885_mbp_4ch_modes,
10307 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10308 .input_mux = &alc882_capture_source,
10309 .dig_out_nid = ALC882_DIGOUT_NID,
10310 .dig_in_nid = ALC882_DIGIN_NID,
10311 .unsol_event = alc_sku_unsol_event,
10312 .setup = alc885_mbp3_setup,
10313 .init_hook = alc_hp_automute,
10316 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10317 .init_verbs = { alc885_mb5_init_verbs,
10318 alc880_gpio1_init_verbs },
10319 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10320 .dac_nids = alc882_dac_nids,
10321 .channel_mode = alc885_mb5_6ch_modes,
10322 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10323 .input_mux = &mb5_capture_source,
10324 .dig_out_nid = ALC882_DIGOUT_NID,
10325 .dig_in_nid = ALC882_DIGIN_NID,
10326 .unsol_event = alc_sku_unsol_event,
10327 .setup = alc885_mb5_setup,
10328 .init_hook = alc_hp_automute,
10330 [ALC885_MACMINI3] = {
10331 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10332 .init_verbs = { alc885_macmini3_init_verbs,
10333 alc880_gpio1_init_verbs },
10334 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10335 .dac_nids = alc882_dac_nids,
10336 .channel_mode = alc885_macmini3_6ch_modes,
10337 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10338 .input_mux = &macmini3_capture_source,
10339 .dig_out_nid = ALC882_DIGOUT_NID,
10340 .dig_in_nid = ALC882_DIGIN_NID,
10341 .unsol_event = alc_sku_unsol_event,
10342 .setup = alc885_macmini3_setup,
10343 .init_hook = alc_hp_automute,
10345 [ALC885_MACPRO] = {
10346 .mixers = { alc882_macpro_mixer },
10347 .init_verbs = { alc882_macpro_init_verbs },
10348 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10349 .dac_nids = alc882_dac_nids,
10350 .dig_out_nid = ALC882_DIGOUT_NID,
10351 .dig_in_nid = ALC882_DIGIN_NID,
10352 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10353 .channel_mode = alc882_ch_modes,
10354 .input_mux = &alc882_capture_source,
10355 .init_hook = alc885_macpro_init_hook,
10357 [ALC885_IMAC24] = {
10358 .mixers = { alc885_imac24_mixer },
10359 .init_verbs = { alc885_imac24_init_verbs },
10360 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10361 .dac_nids = alc882_dac_nids,
10362 .dig_out_nid = ALC882_DIGOUT_NID,
10363 .dig_in_nid = ALC882_DIGIN_NID,
10364 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10365 .channel_mode = alc882_ch_modes,
10366 .input_mux = &alc882_capture_source,
10367 .unsol_event = alc_sku_unsol_event,
10368 .setup = alc885_imac24_setup,
10369 .init_hook = alc885_imac24_init_hook,
10371 [ALC885_IMAC91] = {
10372 .mixers = {alc885_imac91_mixer},
10373 .init_verbs = { alc885_imac91_init_verbs,
10374 alc880_gpio1_init_verbs },
10375 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10376 .dac_nids = alc882_dac_nids,
10377 .channel_mode = alc885_mba21_ch_modes,
10378 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10379 .input_mux = &alc889A_imac91_capture_source,
10380 .dig_out_nid = ALC882_DIGOUT_NID,
10381 .dig_in_nid = ALC882_DIGIN_NID,
10382 .unsol_event = alc_sku_unsol_event,
10383 .setup = alc885_imac91_setup,
10384 .init_hook = alc_hp_automute,
10387 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10388 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10389 alc880_gpio3_init_verbs, alc882_targa_verbs},
10390 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10391 .dac_nids = alc882_dac_nids,
10392 .dig_out_nid = ALC882_DIGOUT_NID,
10393 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10394 .adc_nids = alc882_adc_nids,
10395 .capsrc_nids = alc882_capsrc_nids,
10396 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10397 .channel_mode = alc882_3ST_6ch_modes,
10399 .input_mux = &alc882_capture_source,
10400 .unsol_event = alc_sku_unsol_event,
10401 .setup = alc882_targa_setup,
10402 .init_hook = alc882_targa_automute,
10404 [ALC882_ASUS_A7J] = {
10405 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10406 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10407 alc882_asus_a7j_verbs},
10408 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10409 .dac_nids = alc882_dac_nids,
10410 .dig_out_nid = ALC882_DIGOUT_NID,
10411 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10412 .adc_nids = alc882_adc_nids,
10413 .capsrc_nids = alc882_capsrc_nids,
10414 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10415 .channel_mode = alc882_3ST_6ch_modes,
10417 .input_mux = &alc882_capture_source,
10419 [ALC882_ASUS_A7M] = {
10420 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10421 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10422 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10423 alc882_asus_a7m_verbs },
10424 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10425 .dac_nids = alc882_dac_nids,
10426 .dig_out_nid = ALC882_DIGOUT_NID,
10427 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10428 .channel_mode = alc880_threestack_modes,
10430 .input_mux = &alc882_capture_source,
10432 [ALC883_3ST_2ch_DIG] = {
10433 .mixers = { alc883_3ST_2ch_mixer },
10434 .init_verbs = { alc883_init_verbs },
10435 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10436 .dac_nids = alc883_dac_nids,
10437 .dig_out_nid = ALC883_DIGOUT_NID,
10438 .dig_in_nid = ALC883_DIGIN_NID,
10439 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10440 .channel_mode = alc883_3ST_2ch_modes,
10441 .input_mux = &alc883_capture_source,
10443 [ALC883_3ST_6ch_DIG] = {
10444 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10445 .init_verbs = { alc883_init_verbs },
10446 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10447 .dac_nids = alc883_dac_nids,
10448 .dig_out_nid = ALC883_DIGOUT_NID,
10449 .dig_in_nid = ALC883_DIGIN_NID,
10450 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10451 .channel_mode = alc883_3ST_6ch_modes,
10453 .input_mux = &alc883_capture_source,
10455 [ALC883_3ST_6ch] = {
10456 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10457 .init_verbs = { alc883_init_verbs },
10458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10459 .dac_nids = alc883_dac_nids,
10460 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10461 .channel_mode = alc883_3ST_6ch_modes,
10463 .input_mux = &alc883_capture_source,
10465 [ALC883_3ST_6ch_INTEL] = {
10466 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10467 .init_verbs = { alc883_init_verbs },
10468 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10469 .dac_nids = alc883_dac_nids,
10470 .dig_out_nid = ALC883_DIGOUT_NID,
10471 .dig_in_nid = ALC883_DIGIN_NID,
10472 .slave_dig_outs = alc883_slave_dig_outs,
10473 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10474 .channel_mode = alc883_3ST_6ch_intel_modes,
10476 .input_mux = &alc883_3stack_6ch_intel,
10478 [ALC889A_INTEL] = {
10479 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10480 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10481 alc_hp15_unsol_verbs },
10482 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10483 .dac_nids = alc883_dac_nids,
10484 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10485 .adc_nids = alc889_adc_nids,
10486 .dig_out_nid = ALC883_DIGOUT_NID,
10487 .dig_in_nid = ALC883_DIGIN_NID,
10488 .slave_dig_outs = alc883_slave_dig_outs,
10489 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10490 .channel_mode = alc889_8ch_intel_modes,
10491 .capsrc_nids = alc889_capsrc_nids,
10492 .input_mux = &alc889_capture_source,
10493 .setup = alc889_automute_setup,
10494 .init_hook = alc_hp_automute,
10495 .unsol_event = alc_sku_unsol_event,
10499 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10500 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10501 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10502 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10503 .dac_nids = alc883_dac_nids,
10504 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10505 .adc_nids = alc889_adc_nids,
10506 .dig_out_nid = ALC883_DIGOUT_NID,
10507 .dig_in_nid = ALC883_DIGIN_NID,
10508 .slave_dig_outs = alc883_slave_dig_outs,
10509 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10510 .channel_mode = alc889_8ch_intel_modes,
10511 .capsrc_nids = alc889_capsrc_nids,
10512 .input_mux = &alc889_capture_source,
10513 .setup = alc889_automute_setup,
10514 .init_hook = alc889_intel_init_hook,
10515 .unsol_event = alc_sku_unsol_event,
10518 [ALC883_6ST_DIG] = {
10519 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10520 .init_verbs = { alc883_init_verbs },
10521 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10522 .dac_nids = alc883_dac_nids,
10523 .dig_out_nid = ALC883_DIGOUT_NID,
10524 .dig_in_nid = ALC883_DIGIN_NID,
10525 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10526 .channel_mode = alc883_sixstack_modes,
10527 .input_mux = &alc883_capture_source,
10529 [ALC883_TARGA_DIG] = {
10530 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10531 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10532 alc883_targa_verbs},
10533 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10534 .dac_nids = alc883_dac_nids,
10535 .dig_out_nid = ALC883_DIGOUT_NID,
10536 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10537 .channel_mode = alc883_3ST_6ch_modes,
10539 .input_mux = &alc883_capture_source,
10540 .unsol_event = alc883_targa_unsol_event,
10541 .setup = alc882_targa_setup,
10542 .init_hook = alc882_targa_automute,
10544 [ALC883_TARGA_2ch_DIG] = {
10545 .mixers = { alc883_targa_2ch_mixer},
10546 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10547 alc883_targa_verbs},
10548 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10549 .dac_nids = alc883_dac_nids,
10550 .adc_nids = alc883_adc_nids_alt,
10551 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10552 .capsrc_nids = alc883_capsrc_nids,
10553 .dig_out_nid = ALC883_DIGOUT_NID,
10554 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10555 .channel_mode = alc883_3ST_2ch_modes,
10556 .input_mux = &alc883_capture_source,
10557 .unsol_event = alc883_targa_unsol_event,
10558 .setup = alc882_targa_setup,
10559 .init_hook = alc882_targa_automute,
10561 [ALC883_TARGA_8ch_DIG] = {
10562 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10563 alc883_chmode_mixer },
10564 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10565 alc883_targa_verbs },
10566 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10567 .dac_nids = alc883_dac_nids,
10568 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10569 .adc_nids = alc883_adc_nids_rev,
10570 .capsrc_nids = alc883_capsrc_nids_rev,
10571 .dig_out_nid = ALC883_DIGOUT_NID,
10572 .dig_in_nid = ALC883_DIGIN_NID,
10573 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10574 .channel_mode = alc883_4ST_8ch_modes,
10576 .input_mux = &alc883_capture_source,
10577 .unsol_event = alc883_targa_unsol_event,
10578 .setup = alc882_targa_setup,
10579 .init_hook = alc882_targa_automute,
10582 .mixers = { alc883_base_mixer },
10583 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10584 * and the headphone jack. Turn this on and rely on the
10585 * standard mute methods whenever the user wants to turn
10586 * these outputs off.
10588 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10589 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10590 .dac_nids = alc883_dac_nids,
10591 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10592 .channel_mode = alc883_3ST_2ch_modes,
10593 .input_mux = &alc883_capture_source,
10595 [ALC883_ACER_ASPIRE] = {
10596 .mixers = { alc883_acer_aspire_mixer },
10597 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10598 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10599 .dac_nids = alc883_dac_nids,
10600 .dig_out_nid = ALC883_DIGOUT_NID,
10601 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10602 .channel_mode = alc883_3ST_2ch_modes,
10603 .input_mux = &alc883_capture_source,
10604 .unsol_event = alc_sku_unsol_event,
10605 .setup = alc883_acer_aspire_setup,
10606 .init_hook = alc_hp_automute,
10608 [ALC888_ACER_ASPIRE_4930G] = {
10609 .mixers = { alc888_acer_aspire_4930g_mixer,
10610 alc883_chmode_mixer },
10611 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10612 alc888_acer_aspire_4930g_verbs },
10613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10614 .dac_nids = alc883_dac_nids,
10615 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10616 .adc_nids = alc883_adc_nids_rev,
10617 .capsrc_nids = alc883_capsrc_nids_rev,
10618 .dig_out_nid = ALC883_DIGOUT_NID,
10619 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10620 .channel_mode = alc883_3ST_6ch_modes,
10622 .const_channel_count = 6,
10624 ARRAY_SIZE(alc888_2_capture_sources),
10625 .input_mux = alc888_2_capture_sources,
10626 .unsol_event = alc_sku_unsol_event,
10627 .setup = alc888_acer_aspire_4930g_setup,
10628 .init_hook = alc_hp_automute,
10630 [ALC888_ACER_ASPIRE_6530G] = {
10631 .mixers = { alc888_acer_aspire_6530_mixer },
10632 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10633 alc888_acer_aspire_6530g_verbs },
10634 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10635 .dac_nids = alc883_dac_nids,
10636 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10637 .adc_nids = alc883_adc_nids_rev,
10638 .capsrc_nids = alc883_capsrc_nids_rev,
10639 .dig_out_nid = ALC883_DIGOUT_NID,
10640 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10641 .channel_mode = alc883_3ST_2ch_modes,
10643 ARRAY_SIZE(alc888_2_capture_sources),
10644 .input_mux = alc888_acer_aspire_6530_sources,
10645 .unsol_event = alc_sku_unsol_event,
10646 .setup = alc888_acer_aspire_6530g_setup,
10647 .init_hook = alc_hp_automute,
10649 [ALC888_ACER_ASPIRE_8930G] = {
10650 .mixers = { alc889_acer_aspire_8930g_mixer,
10651 alc883_chmode_mixer },
10652 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10653 alc889_acer_aspire_8930g_verbs,
10654 alc889_eapd_verbs},
10655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10656 .dac_nids = alc883_dac_nids,
10657 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10658 .adc_nids = alc889_adc_nids,
10659 .capsrc_nids = alc889_capsrc_nids,
10660 .dig_out_nid = ALC883_DIGOUT_NID,
10661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10662 .channel_mode = alc883_3ST_6ch_modes,
10664 .const_channel_count = 6,
10666 ARRAY_SIZE(alc889_capture_sources),
10667 .input_mux = alc889_capture_sources,
10668 .unsol_event = alc_sku_unsol_event,
10669 .setup = alc889_acer_aspire_8930g_setup,
10670 .init_hook = alc_hp_automute,
10671 #ifdef CONFIG_SND_HDA_POWER_SAVE
10672 .power_hook = alc_power_eapd,
10675 [ALC888_ACER_ASPIRE_7730G] = {
10676 .mixers = { alc883_3ST_6ch_mixer,
10677 alc883_chmode_mixer },
10678 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10679 alc888_acer_aspire_7730G_verbs },
10680 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10681 .dac_nids = alc883_dac_nids,
10682 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10683 .adc_nids = alc883_adc_nids_rev,
10684 .capsrc_nids = alc883_capsrc_nids_rev,
10685 .dig_out_nid = ALC883_DIGOUT_NID,
10686 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10687 .channel_mode = alc883_3ST_6ch_modes,
10689 .const_channel_count = 6,
10690 .input_mux = &alc883_capture_source,
10691 .unsol_event = alc_sku_unsol_event,
10692 .setup = alc888_acer_aspire_7730g_setup,
10693 .init_hook = alc_hp_automute,
10695 [ALC883_MEDION] = {
10696 .mixers = { alc883_fivestack_mixer,
10697 alc883_chmode_mixer },
10698 .init_verbs = { alc883_init_verbs,
10699 alc883_medion_eapd_verbs },
10700 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10701 .dac_nids = alc883_dac_nids,
10702 .adc_nids = alc883_adc_nids_alt,
10703 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10704 .capsrc_nids = alc883_capsrc_nids,
10705 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10706 .channel_mode = alc883_sixstack_modes,
10707 .input_mux = &alc883_capture_source,
10709 [ALC883_MEDION_WIM2160] = {
10710 .mixers = { alc883_medion_wim2160_mixer },
10711 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10712 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10713 .dac_nids = alc883_dac_nids,
10714 .dig_out_nid = ALC883_DIGOUT_NID,
10715 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10716 .adc_nids = alc883_adc_nids,
10717 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10718 .channel_mode = alc883_3ST_2ch_modes,
10719 .input_mux = &alc883_capture_source,
10720 .unsol_event = alc_sku_unsol_event,
10721 .setup = alc883_medion_wim2160_setup,
10722 .init_hook = alc_hp_automute,
10724 [ALC883_LAPTOP_EAPD] = {
10725 .mixers = { alc883_base_mixer },
10726 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10727 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10728 .dac_nids = alc883_dac_nids,
10729 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10730 .channel_mode = alc883_3ST_2ch_modes,
10731 .input_mux = &alc883_capture_source,
10733 [ALC883_CLEVO_M540R] = {
10734 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10735 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10736 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10737 .dac_nids = alc883_dac_nids,
10738 .dig_out_nid = ALC883_DIGOUT_NID,
10739 .dig_in_nid = ALC883_DIGIN_NID,
10740 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10741 .channel_mode = alc883_3ST_6ch_clevo_modes,
10743 .input_mux = &alc883_capture_source,
10744 /* This machine has the hardware HP auto-muting, thus
10745 * we need no software mute via unsol event
10748 [ALC883_CLEVO_M720] = {
10749 .mixers = { alc883_clevo_m720_mixer },
10750 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10751 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10752 .dac_nids = alc883_dac_nids,
10753 .dig_out_nid = ALC883_DIGOUT_NID,
10754 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10755 .channel_mode = alc883_3ST_2ch_modes,
10756 .input_mux = &alc883_capture_source,
10757 .unsol_event = alc883_clevo_m720_unsol_event,
10758 .setup = alc883_clevo_m720_setup,
10759 .init_hook = alc883_clevo_m720_init_hook,
10761 [ALC883_LENOVO_101E_2ch] = {
10762 .mixers = { alc883_lenovo_101e_2ch_mixer},
10763 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10764 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10765 .dac_nids = alc883_dac_nids,
10766 .adc_nids = alc883_adc_nids_alt,
10767 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10768 .capsrc_nids = alc883_capsrc_nids,
10769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10770 .channel_mode = alc883_3ST_2ch_modes,
10771 .input_mux = &alc883_lenovo_101e_capture_source,
10772 .setup = alc883_lenovo_101e_setup,
10773 .unsol_event = alc_sku_unsol_event,
10774 .init_hook = alc_inithook,
10776 [ALC883_LENOVO_NB0763] = {
10777 .mixers = { alc883_lenovo_nb0763_mixer },
10778 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10780 .dac_nids = alc883_dac_nids,
10781 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10782 .channel_mode = alc883_3ST_2ch_modes,
10784 .input_mux = &alc883_lenovo_nb0763_capture_source,
10785 .unsol_event = alc_sku_unsol_event,
10786 .setup = alc883_lenovo_nb0763_setup,
10787 .init_hook = alc_hp_automute,
10789 [ALC888_LENOVO_MS7195_DIG] = {
10790 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10791 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10793 .dac_nids = alc883_dac_nids,
10794 .dig_out_nid = ALC883_DIGOUT_NID,
10795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10796 .channel_mode = alc883_3ST_6ch_modes,
10798 .input_mux = &alc883_capture_source,
10799 .unsol_event = alc_sku_unsol_event,
10800 .setup = alc888_lenovo_ms7195_setup,
10801 .init_hook = alc_inithook,
10803 [ALC883_HAIER_W66] = {
10804 .mixers = { alc883_targa_2ch_mixer},
10805 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10807 .dac_nids = alc883_dac_nids,
10808 .dig_out_nid = ALC883_DIGOUT_NID,
10809 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10810 .channel_mode = alc883_3ST_2ch_modes,
10811 .input_mux = &alc883_capture_source,
10812 .unsol_event = alc_sku_unsol_event,
10813 .setup = alc883_haier_w66_setup,
10814 .init_hook = alc_hp_automute,
10816 [ALC888_3ST_HP] = {
10817 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10818 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10819 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10820 .dac_nids = alc883_dac_nids,
10821 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10822 .channel_mode = alc888_3st_hp_modes,
10824 .input_mux = &alc883_capture_source,
10825 .unsol_event = alc_sku_unsol_event,
10826 .setup = alc888_3st_hp_setup,
10827 .init_hook = alc_hp_automute,
10829 [ALC888_6ST_DELL] = {
10830 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10831 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10832 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10833 .dac_nids = alc883_dac_nids,
10834 .dig_out_nid = ALC883_DIGOUT_NID,
10835 .dig_in_nid = ALC883_DIGIN_NID,
10836 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10837 .channel_mode = alc883_sixstack_modes,
10838 .input_mux = &alc883_capture_source,
10839 .unsol_event = alc_sku_unsol_event,
10840 .setup = alc888_6st_dell_setup,
10841 .init_hook = alc_hp_automute,
10844 .mixers = { alc883_mitac_mixer },
10845 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10846 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10847 .dac_nids = alc883_dac_nids,
10848 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10849 .channel_mode = alc883_3ST_2ch_modes,
10850 .input_mux = &alc883_capture_source,
10851 .unsol_event = alc_sku_unsol_event,
10852 .setup = alc883_mitac_setup,
10853 .init_hook = alc_hp_automute,
10855 [ALC883_FUJITSU_PI2515] = {
10856 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10857 .init_verbs = { alc883_init_verbs,
10858 alc883_2ch_fujitsu_pi2515_verbs},
10859 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10860 .dac_nids = alc883_dac_nids,
10861 .dig_out_nid = ALC883_DIGOUT_NID,
10862 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10863 .channel_mode = alc883_3ST_2ch_modes,
10864 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10865 .unsol_event = alc_sku_unsol_event,
10866 .setup = alc883_2ch_fujitsu_pi2515_setup,
10867 .init_hook = alc_hp_automute,
10869 [ALC888_FUJITSU_XA3530] = {
10870 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10871 .init_verbs = { alc883_init_verbs,
10872 alc888_fujitsu_xa3530_verbs },
10873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10874 .dac_nids = alc883_dac_nids,
10875 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10876 .adc_nids = alc883_adc_nids_rev,
10877 .capsrc_nids = alc883_capsrc_nids_rev,
10878 .dig_out_nid = ALC883_DIGOUT_NID,
10879 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10880 .channel_mode = alc888_4ST_8ch_intel_modes,
10882 ARRAY_SIZE(alc888_2_capture_sources),
10883 .input_mux = alc888_2_capture_sources,
10884 .unsol_event = alc_sku_unsol_event,
10885 .setup = alc888_fujitsu_xa3530_setup,
10886 .init_hook = alc_hp_automute,
10888 [ALC888_LENOVO_SKY] = {
10889 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10890 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10891 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10892 .dac_nids = alc883_dac_nids,
10893 .dig_out_nid = ALC883_DIGOUT_NID,
10894 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10895 .channel_mode = alc883_sixstack_modes,
10897 .input_mux = &alc883_lenovo_sky_capture_source,
10898 .unsol_event = alc_sku_unsol_event,
10899 .setup = alc888_lenovo_sky_setup,
10900 .init_hook = alc_hp_automute,
10902 [ALC888_ASUS_M90V] = {
10903 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10904 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10905 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10906 .dac_nids = alc883_dac_nids,
10907 .dig_out_nid = ALC883_DIGOUT_NID,
10908 .dig_in_nid = ALC883_DIGIN_NID,
10909 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10910 .channel_mode = alc883_3ST_6ch_modes,
10912 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10913 .unsol_event = alc_sku_unsol_event,
10914 .setup = alc883_mode2_setup,
10915 .init_hook = alc_inithook,
10917 [ALC888_ASUS_EEE1601] = {
10918 .mixers = { alc883_asus_eee1601_mixer },
10919 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10920 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10921 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10922 .dac_nids = alc883_dac_nids,
10923 .dig_out_nid = ALC883_DIGOUT_NID,
10924 .dig_in_nid = ALC883_DIGIN_NID,
10925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10926 .channel_mode = alc883_3ST_2ch_modes,
10928 .input_mux = &alc883_asus_eee1601_capture_source,
10929 .unsol_event = alc_sku_unsol_event,
10930 .init_hook = alc883_eee1601_inithook,
10932 [ALC1200_ASUS_P5Q] = {
10933 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10934 .init_verbs = { alc883_init_verbs },
10935 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10936 .dac_nids = alc883_dac_nids,
10937 .dig_out_nid = ALC1200_DIGOUT_NID,
10938 .dig_in_nid = ALC883_DIGIN_NID,
10939 .slave_dig_outs = alc1200_slave_dig_outs,
10940 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10941 .channel_mode = alc883_sixstack_modes,
10942 .input_mux = &alc883_capture_source,
10945 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10946 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10947 alc880_gpio1_init_verbs },
10948 .adc_nids = alc883_adc_nids,
10949 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10950 .capsrc_nids = alc883_capsrc_nids,
10951 .dac_nids = alc883_dac_nids,
10952 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10953 .channel_mode = alc889A_mb31_6ch_modes,
10954 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10955 .input_mux = &alc889A_mb31_capture_source,
10956 .dig_out_nid = ALC883_DIGOUT_NID,
10957 .unsol_event = alc889A_mb31_unsol_event,
10958 .init_hook = alc889A_mb31_automute,
10960 [ALC883_SONY_VAIO_TT] = {
10961 .mixers = { alc883_vaiott_mixer },
10962 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10963 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10964 .dac_nids = alc883_dac_nids,
10965 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10966 .channel_mode = alc883_3ST_2ch_modes,
10967 .input_mux = &alc883_capture_source,
10968 .unsol_event = alc_sku_unsol_event,
10969 .setup = alc883_vaiott_setup,
10970 .init_hook = alc_hp_automute,
10979 PINFIX_ABIT_AW9D_MAX,
10980 PINFIX_LENOVO_Y530,
10982 PINFIX_ACER_ASPIRE_7736,
10985 static const struct alc_fixup alc882_fixups[] = {
10986 [PINFIX_ABIT_AW9D_MAX] = {
10987 .type = ALC_FIXUP_PINS,
10988 .v.pins = (const struct alc_pincfg[]) {
10989 { 0x15, 0x01080104 }, /* side */
10990 { 0x16, 0x01011012 }, /* rear */
10991 { 0x17, 0x01016011 }, /* clfe */
10995 [PINFIX_LENOVO_Y530] = {
10996 .type = ALC_FIXUP_PINS,
10997 .v.pins = (const struct alc_pincfg[]) {
10998 { 0x15, 0x99130112 }, /* rear int speakers */
10999 { 0x16, 0x99130111 }, /* subwoofer */
11003 [PINFIX_PB_M5210] = {
11004 .type = ALC_FIXUP_VERBS,
11005 .v.verbs = (const struct hda_verb[]) {
11006 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
11010 [PINFIX_ACER_ASPIRE_7736] = {
11011 .type = ALC_FIXUP_SKU,
11012 .v.sku = ALC_FIXUP_SKU_IGNORE,
11016 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
11017 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
11018 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
11019 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
11020 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
11025 * BIOS auto configuration
11027 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
11028 const struct auto_pin_cfg *cfg)
11030 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
11033 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
11034 hda_nid_t nid, int pin_type,
11039 /* set as output */
11040 alc_set_pin_output(codec, nid, pin_type);
11044 else if (dac >= 0x02 && dac <= 0x05)
11048 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
11051 static void alc882_auto_init_multi_out(struct hda_codec *codec)
11053 struct alc_spec *spec = codec->spec;
11056 for (i = 0; i <= HDA_SIDE; i++) {
11057 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11058 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11060 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
11061 spec->multiout.dac_nids[i]);
11065 static void alc882_auto_init_hp_out(struct hda_codec *codec)
11067 struct alc_spec *spec = codec->spec;
11068 hda_nid_t pin, dac;
11071 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
11072 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
11073 pin = spec->autocfg.hp_pins[i];
11076 dac = spec->multiout.hp_nid;
11078 dac = spec->multiout.dac_nids[0]; /* to front */
11079 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
11083 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
11084 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
11085 pin = spec->autocfg.speaker_pins[i];
11088 dac = spec->multiout.extra_out_nid[0];
11090 dac = spec->multiout.dac_nids[0]; /* to front */
11091 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
11096 static void alc882_auto_init_analog_input(struct hda_codec *codec)
11098 struct alc_spec *spec = codec->spec;
11099 struct auto_pin_cfg *cfg = &spec->autocfg;
11102 for (i = 0; i < cfg->num_inputs; i++) {
11103 hda_nid_t nid = cfg->inputs[i].pin;
11104 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
11105 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
11106 snd_hda_codec_write(codec, nid, 0,
11107 AC_VERB_SET_AMP_GAIN_MUTE,
11112 static void alc882_auto_init_input_src(struct hda_codec *codec)
11114 struct alc_spec *spec = codec->spec;
11117 for (c = 0; c < spec->num_adc_nids; c++) {
11118 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
11119 hda_nid_t nid = spec->capsrc_nids[c];
11120 unsigned int mux_idx;
11121 const struct hda_input_mux *imux;
11122 int conns, mute, idx, item;
11125 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
11126 AC_VERB_SET_AMP_GAIN_MUTE,
11129 conns = snd_hda_get_connections(codec, nid, conn_list,
11130 ARRAY_SIZE(conn_list));
11133 mux_idx = c >= spec->num_mux_defs ? 0 : c;
11134 imux = &spec->input_mux[mux_idx];
11135 if (!imux->num_items && mux_idx > 0)
11136 imux = &spec->input_mux[0];
11137 for (idx = 0; idx < conns; idx++) {
11138 /* if the current connection is the selected one,
11139 * unmute it as default - otherwise mute it
11141 mute = AMP_IN_MUTE(idx);
11142 for (item = 0; item < imux->num_items; item++) {
11143 if (imux->items[item].index == idx) {
11144 if (spec->cur_mux[c] == item)
11145 mute = AMP_IN_UNMUTE(idx);
11149 /* check if we have a selector or mixer
11150 * we could check for the widget type instead, but
11151 * just check for Amp-In presence (in case of mixer
11152 * without amp-in there is something wrong, this
11153 * function shouldn't be used or capsrc nid is wrong)
11155 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
11156 snd_hda_codec_write(codec, nid, 0,
11157 AC_VERB_SET_AMP_GAIN_MUTE,
11159 else if (mute != AMP_IN_MUTE(idx))
11160 snd_hda_codec_write(codec, nid, 0,
11161 AC_VERB_SET_CONNECT_SEL,
11167 /* add mic boosts if needed */
11168 static int alc_auto_add_mic_boost(struct hda_codec *codec)
11170 struct alc_spec *spec = codec->spec;
11171 struct auto_pin_cfg *cfg = &spec->autocfg;
11175 const char *prev_label = NULL;
11177 for (i = 0; i < cfg->num_inputs; i++) {
11178 if (cfg->inputs[i].type > AUTO_PIN_MIC)
11180 nid = cfg->inputs[i].pin;
11181 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
11183 char boost_label[32];
11185 label = hda_get_autocfg_input_label(codec, cfg, i);
11186 if (prev_label && !strcmp(label, prev_label))
11190 prev_label = label;
11192 snprintf(boost_label, sizeof(boost_label),
11193 "%s Boost Volume", label);
11194 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11195 boost_label, type_idx,
11196 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11204 /* almost identical with ALC880 parser... */
11205 static int alc882_parse_auto_config(struct hda_codec *codec)
11207 struct alc_spec *spec = codec->spec;
11208 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
11211 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11215 if (!spec->autocfg.line_outs)
11216 return 0; /* can't find valid BIOS pin config */
11218 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
11221 err = alc_auto_add_multi_channel_mode(codec);
11224 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
11227 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11231 err = alc880_auto_create_extra_out(spec,
11232 spec->autocfg.speaker_pins[0],
11236 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11240 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11242 alc_auto_parse_digital(codec);
11244 if (spec->kctls.list)
11245 add_mixer(spec, spec->kctls.list);
11247 add_verb(spec, alc883_auto_init_verbs);
11248 /* if ADC 0x07 is available, initialize it, too */
11249 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11250 add_verb(spec, alc882_adc1_init_verbs);
11252 spec->num_mux_defs = 1;
11253 spec->input_mux = &spec->private_imux[0];
11255 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11257 err = alc_auto_add_mic_boost(codec);
11261 return 1; /* config found */
11264 /* additional initialization for auto-configuration model */
11265 static void alc882_auto_init(struct hda_codec *codec)
11267 struct alc_spec *spec = codec->spec;
11268 alc882_auto_init_multi_out(codec);
11269 alc882_auto_init_hp_out(codec);
11270 alc882_auto_init_analog_input(codec);
11271 alc882_auto_init_input_src(codec);
11272 alc_auto_init_digital(codec);
11273 if (spec->unsol_event)
11274 alc_inithook(codec);
11277 static int patch_alc882(struct hda_codec *codec)
11279 struct alc_spec *spec;
11280 int err, board_config;
11282 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11286 codec->spec = spec;
11288 switch (codec->vendor_id) {
11293 /* ALC883 and variants */
11294 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11298 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11302 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11303 board_config = snd_hda_check_board_codec_sid_config(codec,
11304 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11306 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11307 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11309 board_config = ALC882_AUTO;
11312 if (board_config == ALC882_AUTO) {
11313 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11314 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11317 alc_auto_parse_customize_define(codec);
11319 if (board_config == ALC882_AUTO) {
11320 /* automatic parse from the BIOS config */
11321 err = alc882_parse_auto_config(codec);
11327 "hda_codec: Cannot set up configuration "
11328 "from BIOS. Using base mode...\n");
11329 board_config = ALC882_3ST_DIG;
11333 if (has_cdefine_beep(codec)) {
11334 err = snd_hda_attach_beep_device(codec, 0x1);
11341 if (board_config != ALC882_AUTO)
11342 setup_preset(codec, &alc882_presets[board_config]);
11344 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11345 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11346 /* FIXME: setup DAC5 */
11347 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11348 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11350 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11351 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11353 if (!spec->adc_nids && spec->input_mux) {
11355 spec->num_adc_nids = 0;
11356 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11357 const struct hda_input_mux *imux = spec->input_mux;
11359 hda_nid_t items[16];
11360 hda_nid_t nid = alc882_adc_nids[i];
11361 unsigned int wcap = get_wcaps(codec, nid);
11363 wcap = get_wcaps_type(wcap);
11364 if (wcap != AC_WID_AUD_IN)
11366 spec->private_adc_nids[spec->num_adc_nids] = nid;
11367 err = snd_hda_get_connections(codec, nid, &cap, 1);
11370 err = snd_hda_get_connections(codec, cap, items,
11371 ARRAY_SIZE(items));
11374 for (j = 0; j < imux->num_items; j++)
11375 if (imux->items[j].index >= err)
11377 if (j < imux->num_items)
11379 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11380 spec->num_adc_nids++;
11382 spec->adc_nids = spec->private_adc_nids;
11383 spec->capsrc_nids = spec->private_capsrc_nids;
11386 set_capture_mixer(codec);
11388 if (has_cdefine_beep(codec))
11389 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11391 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11393 spec->vmaster_nid = 0x0c;
11395 codec->patch_ops = alc_patch_ops;
11396 if (board_config == ALC882_AUTO)
11397 spec->init_hook = alc882_auto_init;
11399 alc_init_jacks(codec);
11400 #ifdef CONFIG_SND_HDA_POWER_SAVE
11401 if (!spec->loopback.amplist)
11402 spec->loopback.amplist = alc882_loopbacks;
11413 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11414 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11416 #define alc262_dac_nids alc260_dac_nids
11417 #define alc262_adc_nids alc882_adc_nids
11418 #define alc262_adc_nids_alt alc882_adc_nids_alt
11419 #define alc262_capsrc_nids alc882_capsrc_nids
11420 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11422 #define alc262_modes alc260_modes
11423 #define alc262_capture_source alc882_capture_source
11425 static const hda_nid_t alc262_dmic_adc_nids[1] = {
11430 static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11432 static const struct snd_kcontrol_new alc262_base_mixer[] = {
11433 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11434 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11437 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11438 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11441 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11444 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11445 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11446 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11447 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11448 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11452 /* update HP, line and mono-out pins according to the master switch */
11453 #define alc262_hp_master_update alc260_hp_master_update
11455 static void alc262_hp_bpc_setup(struct hda_codec *codec)
11457 struct alc_spec *spec = codec->spec;
11459 spec->autocfg.hp_pins[0] = 0x1b;
11460 spec->autocfg.speaker_pins[0] = 0x16;
11461 spec->automute = 1;
11462 spec->automute_mode = ALC_AUTOMUTE_PIN;
11465 static void alc262_hp_wildwest_setup(struct hda_codec *codec)
11467 struct alc_spec *spec = codec->spec;
11469 spec->autocfg.hp_pins[0] = 0x15;
11470 spec->autocfg.speaker_pins[0] = 0x16;
11471 spec->automute = 1;
11472 spec->automute_mode = ALC_AUTOMUTE_PIN;
11475 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11476 #define alc262_hp_master_sw_put alc260_hp_master_sw_put
11478 #define ALC262_HP_MASTER_SWITCH \
11480 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11481 .name = "Master Playback Switch", \
11482 .info = snd_ctl_boolean_mono_info, \
11483 .get = alc262_hp_master_sw_get, \
11484 .put = alc262_hp_master_sw_put, \
11487 .iface = NID_MAPPING, \
11488 .name = "Master Playback Switch", \
11489 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11493 static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11494 ALC262_HP_MASTER_SWITCH,
11495 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11496 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11497 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11498 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11500 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11504 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11505 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11506 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11507 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11510 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11511 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11512 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11513 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11517 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11518 ALC262_HP_MASTER_SWITCH,
11519 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11520 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11521 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11523 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11525 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11527 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11528 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11529 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11530 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11531 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11532 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11533 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11537 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11538 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11539 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11540 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11544 /* mute/unmute internal speaker according to the hp jack and mute state */
11545 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11547 struct alc_spec *spec = codec->spec;
11549 spec->autocfg.hp_pins[0] = 0x15;
11550 spec->autocfg.speaker_pins[0] = 0x14;
11551 spec->automute = 1;
11552 spec->automute_mode = ALC_AUTOMUTE_PIN;
11555 static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11556 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11557 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11558 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11561 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11562 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11566 static const struct hda_verb alc262_hp_t5735_verbs[] = {
11567 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11568 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11570 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11574 static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11575 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11577 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11578 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11579 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11580 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11584 static const struct hda_verb alc262_hp_rp5700_verbs[] = {
11585 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11586 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11587 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11588 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11589 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11590 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11593 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11598 static const struct hda_input_mux alc262_hp_rp5700_capture_source = {
11605 /* bind hp and internal speaker mute (with plug check) as master switch */
11606 #define alc262_hippo_master_update alc262_hp_master_update
11607 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11608 #define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11610 #define ALC262_HIPPO_MASTER_SWITCH \
11612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11613 .name = "Master Playback Switch", \
11614 .info = snd_ctl_boolean_mono_info, \
11615 .get = alc262_hippo_master_sw_get, \
11616 .put = alc262_hippo_master_sw_put, \
11619 .iface = NID_MAPPING, \
11620 .name = "Master Playback Switch", \
11621 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11622 (SUBDEV_SPEAKER(0) << 16), \
11625 static const struct snd_kcontrol_new alc262_hippo_mixer[] = {
11626 ALC262_HIPPO_MASTER_SWITCH,
11627 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11628 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11629 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11630 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11631 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11632 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11633 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11634 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11635 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11636 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11637 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11638 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11642 static const struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11643 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11644 ALC262_HIPPO_MASTER_SWITCH,
11645 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11646 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11647 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11648 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11651 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11652 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11654 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11658 /* mute/unmute internal speaker according to the hp jack and mute state */
11659 static void alc262_hippo_setup(struct hda_codec *codec)
11661 struct alc_spec *spec = codec->spec;
11663 spec->autocfg.hp_pins[0] = 0x15;
11664 spec->autocfg.speaker_pins[0] = 0x14;
11665 spec->automute = 1;
11666 spec->automute_mode = ALC_AUTOMUTE_AMP;
11669 static void alc262_hippo1_setup(struct hda_codec *codec)
11671 struct alc_spec *spec = codec->spec;
11673 spec->autocfg.hp_pins[0] = 0x1b;
11674 spec->autocfg.speaker_pins[0] = 0x14;
11675 spec->automute = 1;
11676 spec->automute_mode = ALC_AUTOMUTE_AMP;
11680 static const struct snd_kcontrol_new alc262_sony_mixer[] = {
11681 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11682 ALC262_HIPPO_MASTER_SWITCH,
11683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11685 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11686 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11690 static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11691 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11692 ALC262_HIPPO_MASTER_SWITCH,
11693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11696 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11697 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11701 static const struct snd_kcontrol_new alc262_tyan_mixer[] = {
11702 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11703 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11704 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11705 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11706 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11707 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11710 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11711 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11712 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11713 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11717 static const struct hda_verb alc262_tyan_verbs[] = {
11718 /* Headphone automute */
11719 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11720 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11721 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11723 /* P11 AUX_IN, white 4-pin connector */
11724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11725 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11726 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11727 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11732 /* unsolicited event for HP jack sensing */
11733 static void alc262_tyan_setup(struct hda_codec *codec)
11735 struct alc_spec *spec = codec->spec;
11737 spec->autocfg.hp_pins[0] = 0x1b;
11738 spec->autocfg.speaker_pins[0] = 0x15;
11739 spec->automute = 1;
11740 spec->automute_mode = ALC_AUTOMUTE_AMP;
11744 #define alc262_capture_mixer alc882_capture_mixer
11745 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11748 * generic initialization of ADC, input mixers and output mixers
11750 static const struct hda_verb alc262_init_verbs[] = {
11752 * Unmute ADC0-2 and set the default input to mic-in
11754 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11756 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11757 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11758 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11759 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11761 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11763 * Note: PASD motherboards uses the Line In 2 as the input for
11764 * front panel mic (mic 2)
11766 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11767 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11768 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11769 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11770 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11771 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11774 * Set up output mixers (0x0c - 0x0e)
11776 /* set vol=0 to output mixers */
11777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11778 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11779 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11780 /* set up input amps for analog loopback */
11781 /* Amp Indices: DAC = 0, mixer = 1 */
11782 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11783 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11784 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11785 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11786 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11787 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11791 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11792 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11793 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11798 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11800 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11802 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11805 /* FIXME: use matrix-type input source selection */
11806 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11807 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11808 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11809 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11810 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11811 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11813 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11814 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11815 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11816 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11819 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11820 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11821 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11826 static const struct hda_verb alc262_eapd_verbs[] = {
11827 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11828 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11832 static const struct hda_verb alc262_hippo1_unsol_verbs[] = {
11833 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11834 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11835 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11837 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11838 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11842 static const struct hda_verb alc262_sony_unsol_verbs[] = {
11843 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11844 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11845 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11847 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11852 static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11853 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11854 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11857 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11861 static const struct hda_verb alc262_toshiba_s06_verbs[] = {
11862 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11863 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11865 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11866 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11867 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11869 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11873 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11875 struct alc_spec *spec = codec->spec;
11877 spec->autocfg.hp_pins[0] = 0x15;
11878 spec->autocfg.speaker_pins[0] = 0x14;
11879 spec->ext_mic.pin = 0x18;
11880 spec->ext_mic.mux_idx = 0;
11881 spec->int_mic.pin = 0x12;
11882 spec->int_mic.mux_idx = 9;
11883 spec->auto_mic = 1;
11884 spec->automute = 1;
11885 spec->automute_mode = ALC_AUTOMUTE_PIN;
11891 * 0x16 = internal speaker
11892 * 0x18 = external mic
11895 static const struct snd_kcontrol_new alc262_nec_mixer[] = {
11896 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11897 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11901 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11903 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11904 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11908 static const struct hda_verb alc262_nec_verbs[] = {
11909 /* Unmute Speaker */
11910 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11913 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11916 /* External mic to headphone */
11917 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11918 /* External mic to speaker */
11919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11925 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11926 * 0x1b = port replicator headphone out
11929 #define ALC_HP_EVENT ALC880_HP_EVENT
11931 static const struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11932 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11934 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11935 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11939 static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11940 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11941 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11945 static const struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11946 /* Front Mic pin: input vref at 50% */
11947 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11952 static const struct hda_input_mux alc262_fujitsu_capture_source = {
11956 { "Internal Mic", 0x1 },
11961 static const struct hda_input_mux alc262_HP_capture_source = {
11965 { "Front Mic", 0x1 },
11972 static const struct hda_input_mux alc262_HP_D7000_capture_source = {
11976 { "Front Mic", 0x2 },
11982 static void alc262_fujitsu_setup(struct hda_codec *codec)
11984 struct alc_spec *spec = codec->spec;
11986 spec->autocfg.hp_pins[0] = 0x14;
11987 spec->autocfg.hp_pins[1] = 0x1b;
11988 spec->autocfg.speaker_pins[0] = 0x15;
11989 spec->automute = 1;
11990 spec->automute_mode = ALC_AUTOMUTE_AMP;
11993 /* bind volumes of both NID 0x0c and 0x0d */
11994 static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11995 .ops = &snd_hda_bind_vol,
11997 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11998 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
12003 static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
12004 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12006 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12007 .name = "Master Playback Switch",
12008 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
12009 .info = snd_ctl_boolean_mono_info,
12010 .get = alc262_hp_master_sw_get,
12011 .put = alc262_hp_master_sw_put,
12014 .iface = NID_MAPPING,
12015 .name = "Master Playback Switch",
12016 .private_value = 0x1b,
12018 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12019 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12020 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12023 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
12024 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12025 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12029 static void alc262_lenovo_3000_setup(struct hda_codec *codec)
12031 struct alc_spec *spec = codec->spec;
12033 spec->autocfg.hp_pins[0] = 0x1b;
12034 spec->autocfg.speaker_pins[0] = 0x14;
12035 spec->autocfg.speaker_pins[1] = 0x16;
12036 spec->automute = 1;
12037 spec->automute_mode = ALC_AUTOMUTE_AMP;
12040 static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
12041 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12043 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12044 .name = "Master Playback Switch",
12045 .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
12046 .info = snd_ctl_boolean_mono_info,
12047 .get = alc262_hp_master_sw_get,
12048 .put = alc262_hp_master_sw_put,
12050 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12051 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12052 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12055 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
12056 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12057 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12061 static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12062 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12063 ALC262_HIPPO_MASTER_SWITCH,
12064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12065 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12066 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12067 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12068 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12069 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12073 /* additional init verbs for Benq laptops */
12074 static const struct hda_verb alc262_EAPD_verbs[] = {
12075 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12076 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12080 static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12082 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12084 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12085 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12089 /* Samsung Q1 Ultra Vista model setup */
12090 static const struct snd_kcontrol_new alc262_ultra_mixer[] = {
12091 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12092 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12094 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12095 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12096 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12100 static const struct hda_verb alc262_ultra_verbs[] = {
12102 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12103 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12104 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12109 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12111 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12114 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12115 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12117 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12118 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12119 /* ADC, choose mic */
12120 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12123 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12124 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12125 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12126 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12129 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12133 /* mute/unmute internal speaker according to the hp jack and mute state */
12134 static void alc262_ultra_automute(struct hda_codec *codec)
12136 struct alc_spec *spec = codec->spec;
12140 /* auto-mute only when HP is used as HP */
12141 if (!spec->cur_mux[0]) {
12142 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12143 if (spec->jack_present)
12144 mute = HDA_AMP_MUTE;
12146 /* mute/unmute internal speaker */
12147 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12148 HDA_AMP_MUTE, mute);
12149 /* mute/unmute HP */
12150 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12151 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12154 /* unsolicited event for HP jack sensing */
12155 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12158 if ((res >> 26) != ALC880_HP_EVENT)
12160 alc262_ultra_automute(codec);
12163 static const struct hda_input_mux alc262_ultra_capture_source = {
12167 { "Headphone", 0x7 },
12171 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12172 struct snd_ctl_elem_value *ucontrol)
12174 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12175 struct alc_spec *spec = codec->spec;
12178 ret = alc_mux_enum_put(kcontrol, ucontrol);
12181 /* reprogram the HP pin as mic or HP according to the input source */
12182 snd_hda_codec_write_cache(codec, 0x15, 0,
12183 AC_VERB_SET_PIN_WIDGET_CONTROL,
12184 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12185 alc262_ultra_automute(codec); /* mute/unmute HP */
12189 static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12190 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12191 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12194 .name = "Capture Source",
12195 .info = alc_mux_enum_info,
12196 .get = alc_mux_enum_get,
12197 .put = alc262_ultra_mux_enum_put,
12200 .iface = NID_MAPPING,
12201 .name = "Capture Source",
12202 .private_value = 0x15,
12207 /* We use two mixers depending on the output pin; 0x16 is a mono output
12208 * and thus it's bound with a different mixer.
12209 * This function returns which mixer amp should be used.
12211 static int alc262_check_volbit(hda_nid_t nid)
12215 else if (nid == 0x16)
12221 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12222 const char *pfx, int *vbits, int idx)
12227 vbit = alc262_check_volbit(nid);
12230 if (*vbits & vbit) /* a volume control for this mixer already there */
12234 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12236 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12237 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12240 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12241 const char *pfx, int idx)
12248 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12250 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12251 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12254 /* add playback controls from the parsed DAC table */
12255 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12256 const struct auto_pin_cfg *cfg)
12262 spec->multiout.num_dacs = 1; /* only use one dac */
12263 spec->multiout.dac_nids = spec->private_dac_nids;
12264 spec->private_dac_nids[0] = 2;
12266 pfx = alc_get_line_out_pfx(spec, true);
12269 for (i = 0; i < 2; i++) {
12270 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12273 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12274 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12279 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12280 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12287 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12288 alc262_check_volbit(cfg->speaker_pins[0]) |
12289 alc262_check_volbit(cfg->hp_pins[0]);
12290 if (vbits == 1 || vbits == 2)
12291 pfx = "Master"; /* only one mixer is used */
12293 for (i = 0; i < 2; i++) {
12294 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12298 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12299 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12300 "Speaker", &vbits, i);
12304 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12305 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12306 "Headphone", &vbits, i);
12314 #define alc262_auto_create_input_ctls \
12315 alc882_auto_create_input_ctls
12318 * generic initialization of ADC, input mixers and output mixers
12320 static const struct hda_verb alc262_volume_init_verbs[] = {
12322 * Unmute ADC0-2 and set the default input to mic-in
12324 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12326 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12328 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12329 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12331 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12333 * Note: PASD motherboards uses the Line In 2 as the input for
12334 * front panel mic (mic 2)
12336 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12344 * Set up output mixers (0x0c - 0x0f)
12346 /* set vol=0 to output mixers */
12347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12349 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12351 /* set up input amps for analog loopback */
12352 /* Amp Indices: DAC = 0, mixer = 1 */
12353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12358 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12360 /* FIXME: use matrix-type input source selection */
12361 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12362 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12381 static const struct hda_verb alc262_HP_BPC_init_verbs[] = {
12383 * Unmute ADC0-2 and set the default input to mic-in
12385 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12387 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12388 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12389 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12390 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12392 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12394 * Note: PASD motherboards uses the Line In 2 as the input for
12395 * front panel mic (mic 2)
12397 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12407 * Set up output mixers (0x0c - 0x0e)
12409 /* set vol=0 to output mixers */
12410 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12411 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12414 /* set up input amps for analog loopback */
12415 /* Amp Indices: DAC = 0, mixer = 1 */
12416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12419 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12423 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12427 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12430 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12435 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12437 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12439 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12440 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12441 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12442 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12443 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12444 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12447 /* FIXME: use matrix-type input source selection */
12448 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12449 /* Input mixer1: only unmute Mic */
12450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12468 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12480 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12485 static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12487 * Unmute ADC0-2 and set the default input to mic-in
12489 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12490 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12491 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12493 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12494 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12496 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12498 * Note: PASD motherboards uses the Line In 2 as the input for front
12499 * panel mic (mic 2)
12501 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12511 * Set up output mixers (0x0c - 0x0e)
12513 /* set vol=0 to output mixers */
12514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12515 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12518 /* set up input amps for analog loopback */
12519 /* Amp Indices: DAC = 0, mixer = 1 */
12520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12523 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12529 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12530 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12531 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12532 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12534 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12536 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12539 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12542 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12544 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12545 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12546 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12547 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12549 /* FIXME: use matrix-type input source selection */
12550 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12551 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12557 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12558 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12565 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12566 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12573 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12574 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12576 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12581 static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12583 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12584 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12585 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12587 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12588 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12590 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12594 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12605 static const struct alc_fixup alc262_fixups[] = {
12606 [PINFIX_FSC_H270] = {
12607 .type = ALC_FIXUP_PINS,
12608 .v.pins = (const struct alc_pincfg[]) {
12609 { 0x14, 0x99130110 }, /* speaker */
12610 { 0x15, 0x0221142f }, /* front HP */
12611 { 0x1b, 0x0121141f }, /* rear HP */
12617 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
12618 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12623 #ifdef CONFIG_SND_HDA_POWER_SAVE
12624 #define alc262_loopbacks alc880_loopbacks
12627 /* pcm configuration: identical with ALC880 */
12628 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12629 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12630 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12631 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12634 * BIOS auto configuration
12636 static int alc262_parse_auto_config(struct hda_codec *codec)
12638 struct alc_spec *spec = codec->spec;
12640 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12642 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12646 if (!spec->autocfg.line_outs) {
12647 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12648 spec->multiout.max_channels = 2;
12649 spec->no_analog = 1;
12652 return 0; /* can't find valid BIOS pin config */
12654 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12657 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12661 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12664 alc_auto_parse_digital(codec);
12666 if (spec->kctls.list)
12667 add_mixer(spec, spec->kctls.list);
12669 add_verb(spec, alc262_volume_init_verbs);
12670 spec->num_mux_defs = 1;
12671 spec->input_mux = &spec->private_imux[0];
12673 err = alc_auto_add_mic_boost(codec);
12677 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12682 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12683 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12684 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12685 #define alc262_auto_init_input_src alc882_auto_init_input_src
12688 /* init callback for auto-configuration model -- overriding the default init */
12689 static void alc262_auto_init(struct hda_codec *codec)
12691 struct alc_spec *spec = codec->spec;
12692 alc262_auto_init_multi_out(codec);
12693 alc262_auto_init_hp_out(codec);
12694 alc262_auto_init_analog_input(codec);
12695 alc262_auto_init_input_src(codec);
12696 alc_auto_init_digital(codec);
12697 if (spec->unsol_event)
12698 alc_inithook(codec);
12702 * configuration and preset
12704 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12705 [ALC262_BASIC] = "basic",
12706 [ALC262_HIPPO] = "hippo",
12707 [ALC262_HIPPO_1] = "hippo_1",
12708 [ALC262_FUJITSU] = "fujitsu",
12709 [ALC262_HP_BPC] = "hp-bpc",
12710 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12711 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12712 [ALC262_HP_RP5700] = "hp-rp5700",
12713 [ALC262_BENQ_ED8] = "benq",
12714 [ALC262_BENQ_T31] = "benq-t31",
12715 [ALC262_SONY_ASSAMD] = "sony-assamd",
12716 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12717 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12718 [ALC262_ULTRA] = "ultra",
12719 [ALC262_LENOVO_3000] = "lenovo-3000",
12720 [ALC262_NEC] = "nec",
12721 [ALC262_TYAN] = "tyan",
12722 [ALC262_AUTO] = "auto",
12725 static const struct snd_pci_quirk alc262_cfg_tbl[] = {
12726 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12727 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12728 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12730 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12732 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12734 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12736 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12737 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12738 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12739 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12740 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12741 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12742 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12743 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12744 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12745 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12746 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12747 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12748 ALC262_HP_TC_T5735),
12749 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12750 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12751 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12752 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12753 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12754 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12755 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12756 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12757 #if 0 /* disable the quirk since model=auto works better in recent versions */
12758 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12759 ALC262_SONY_ASSAMD),
12761 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12762 ALC262_TOSHIBA_RX1),
12763 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12764 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12765 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12766 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12767 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12769 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12770 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12771 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12772 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12773 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12777 static const struct alc_config_preset alc262_presets[] = {
12779 .mixers = { alc262_base_mixer },
12780 .init_verbs = { alc262_init_verbs },
12781 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12782 .dac_nids = alc262_dac_nids,
12784 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12785 .channel_mode = alc262_modes,
12786 .input_mux = &alc262_capture_source,
12789 .mixers = { alc262_hippo_mixer },
12790 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12792 .dac_nids = alc262_dac_nids,
12794 .dig_out_nid = ALC262_DIGOUT_NID,
12795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12796 .channel_mode = alc262_modes,
12797 .input_mux = &alc262_capture_source,
12798 .unsol_event = alc_sku_unsol_event,
12799 .setup = alc262_hippo_setup,
12800 .init_hook = alc_inithook,
12802 [ALC262_HIPPO_1] = {
12803 .mixers = { alc262_hippo1_mixer },
12804 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12805 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12806 .dac_nids = alc262_dac_nids,
12808 .dig_out_nid = ALC262_DIGOUT_NID,
12809 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12810 .channel_mode = alc262_modes,
12811 .input_mux = &alc262_capture_source,
12812 .unsol_event = alc_sku_unsol_event,
12813 .setup = alc262_hippo1_setup,
12814 .init_hook = alc_inithook,
12816 [ALC262_FUJITSU] = {
12817 .mixers = { alc262_fujitsu_mixer },
12818 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12819 alc262_fujitsu_unsol_verbs },
12820 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12821 .dac_nids = alc262_dac_nids,
12823 .dig_out_nid = ALC262_DIGOUT_NID,
12824 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12825 .channel_mode = alc262_modes,
12826 .input_mux = &alc262_fujitsu_capture_source,
12827 .unsol_event = alc_sku_unsol_event,
12828 .setup = alc262_fujitsu_setup,
12829 .init_hook = alc_inithook,
12831 [ALC262_HP_BPC] = {
12832 .mixers = { alc262_HP_BPC_mixer },
12833 .init_verbs = { alc262_HP_BPC_init_verbs },
12834 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12835 .dac_nids = alc262_dac_nids,
12837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12838 .channel_mode = alc262_modes,
12839 .input_mux = &alc262_HP_capture_source,
12840 .unsol_event = alc_sku_unsol_event,
12841 .setup = alc262_hp_bpc_setup,
12842 .init_hook = alc_inithook,
12844 [ALC262_HP_BPC_D7000_WF] = {
12845 .mixers = { alc262_HP_BPC_WildWest_mixer },
12846 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12848 .dac_nids = alc262_dac_nids,
12850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12851 .channel_mode = alc262_modes,
12852 .input_mux = &alc262_HP_D7000_capture_source,
12853 .unsol_event = alc_sku_unsol_event,
12854 .setup = alc262_hp_wildwest_setup,
12855 .init_hook = alc_inithook,
12857 [ALC262_HP_BPC_D7000_WL] = {
12858 .mixers = { alc262_HP_BPC_WildWest_mixer,
12859 alc262_HP_BPC_WildWest_option_mixer },
12860 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12861 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12862 .dac_nids = alc262_dac_nids,
12864 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12865 .channel_mode = alc262_modes,
12866 .input_mux = &alc262_HP_D7000_capture_source,
12867 .unsol_event = alc_sku_unsol_event,
12868 .setup = alc262_hp_wildwest_setup,
12869 .init_hook = alc_inithook,
12871 [ALC262_HP_TC_T5735] = {
12872 .mixers = { alc262_hp_t5735_mixer },
12873 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12874 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12875 .dac_nids = alc262_dac_nids,
12877 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12878 .channel_mode = alc262_modes,
12879 .input_mux = &alc262_capture_source,
12880 .unsol_event = alc_sku_unsol_event,
12881 .setup = alc262_hp_t5735_setup,
12882 .init_hook = alc_inithook,
12884 [ALC262_HP_RP5700] = {
12885 .mixers = { alc262_hp_rp5700_mixer },
12886 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12887 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12888 .dac_nids = alc262_dac_nids,
12889 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12890 .channel_mode = alc262_modes,
12891 .input_mux = &alc262_hp_rp5700_capture_source,
12893 [ALC262_BENQ_ED8] = {
12894 .mixers = { alc262_base_mixer },
12895 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12896 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12897 .dac_nids = alc262_dac_nids,
12899 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12900 .channel_mode = alc262_modes,
12901 .input_mux = &alc262_capture_source,
12903 [ALC262_SONY_ASSAMD] = {
12904 .mixers = { alc262_sony_mixer },
12905 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12906 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12907 .dac_nids = alc262_dac_nids,
12909 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12910 .channel_mode = alc262_modes,
12911 .input_mux = &alc262_capture_source,
12912 .unsol_event = alc_sku_unsol_event,
12913 .setup = alc262_hippo_setup,
12914 .init_hook = alc_inithook,
12916 [ALC262_BENQ_T31] = {
12917 .mixers = { alc262_benq_t31_mixer },
12918 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12919 alc_hp15_unsol_verbs },
12920 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12921 .dac_nids = alc262_dac_nids,
12923 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12924 .channel_mode = alc262_modes,
12925 .input_mux = &alc262_capture_source,
12926 .unsol_event = alc_sku_unsol_event,
12927 .setup = alc262_hippo_setup,
12928 .init_hook = alc_inithook,
12931 .mixers = { alc262_ultra_mixer },
12932 .cap_mixer = alc262_ultra_capture_mixer,
12933 .init_verbs = { alc262_ultra_verbs },
12934 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12935 .dac_nids = alc262_dac_nids,
12936 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12937 .channel_mode = alc262_modes,
12938 .input_mux = &alc262_ultra_capture_source,
12939 .adc_nids = alc262_adc_nids, /* ADC0 */
12940 .capsrc_nids = alc262_capsrc_nids,
12941 .num_adc_nids = 1, /* single ADC */
12942 .unsol_event = alc262_ultra_unsol_event,
12943 .init_hook = alc262_ultra_automute,
12945 [ALC262_LENOVO_3000] = {
12946 .mixers = { alc262_lenovo_3000_mixer },
12947 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12948 alc262_lenovo_3000_unsol_verbs,
12949 alc262_lenovo_3000_init_verbs },
12950 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12951 .dac_nids = alc262_dac_nids,
12953 .dig_out_nid = ALC262_DIGOUT_NID,
12954 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12955 .channel_mode = alc262_modes,
12956 .input_mux = &alc262_fujitsu_capture_source,
12957 .unsol_event = alc_sku_unsol_event,
12958 .setup = alc262_lenovo_3000_setup,
12959 .init_hook = alc_inithook,
12962 .mixers = { alc262_nec_mixer },
12963 .init_verbs = { alc262_nec_verbs },
12964 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12965 .dac_nids = alc262_dac_nids,
12967 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12968 .channel_mode = alc262_modes,
12969 .input_mux = &alc262_capture_source,
12971 [ALC262_TOSHIBA_S06] = {
12972 .mixers = { alc262_toshiba_s06_mixer },
12973 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12974 alc262_eapd_verbs },
12975 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12976 .capsrc_nids = alc262_dmic_capsrc_nids,
12977 .dac_nids = alc262_dac_nids,
12978 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12979 .num_adc_nids = 1, /* single ADC */
12980 .dig_out_nid = ALC262_DIGOUT_NID,
12981 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12982 .channel_mode = alc262_modes,
12983 .unsol_event = alc_sku_unsol_event,
12984 .setup = alc262_toshiba_s06_setup,
12985 .init_hook = alc_inithook,
12987 [ALC262_TOSHIBA_RX1] = {
12988 .mixers = { alc262_toshiba_rx1_mixer },
12989 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12990 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12991 .dac_nids = alc262_dac_nids,
12993 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12994 .channel_mode = alc262_modes,
12995 .input_mux = &alc262_capture_source,
12996 .unsol_event = alc_sku_unsol_event,
12997 .setup = alc262_hippo_setup,
12998 .init_hook = alc_inithook,
13001 .mixers = { alc262_tyan_mixer },
13002 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
13003 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
13004 .dac_nids = alc262_dac_nids,
13006 .dig_out_nid = ALC262_DIGOUT_NID,
13007 .num_channel_mode = ARRAY_SIZE(alc262_modes),
13008 .channel_mode = alc262_modes,
13009 .input_mux = &alc262_capture_source,
13010 .unsol_event = alc_sku_unsol_event,
13011 .setup = alc262_tyan_setup,
13012 .init_hook = alc_hp_automute,
13016 static int patch_alc262(struct hda_codec *codec)
13018 struct alc_spec *spec;
13022 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13026 codec->spec = spec;
13028 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
13033 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
13034 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
13035 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
13036 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
13039 alc_auto_parse_customize_define(codec);
13041 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
13043 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
13047 if (board_config < 0) {
13048 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13050 board_config = ALC262_AUTO;
13053 if (board_config == ALC262_AUTO) {
13054 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
13055 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
13058 if (board_config == ALC262_AUTO) {
13059 /* automatic parse from the BIOS config */
13060 err = alc262_parse_auto_config(codec);
13066 "hda_codec: Cannot set up configuration "
13067 "from BIOS. Using base mode...\n");
13068 board_config = ALC262_BASIC;
13072 if (!spec->no_analog && has_cdefine_beep(codec)) {
13073 err = snd_hda_attach_beep_device(codec, 0x1);
13080 if (board_config != ALC262_AUTO)
13081 setup_preset(codec, &alc262_presets[board_config]);
13083 spec->stream_analog_playback = &alc262_pcm_analog_playback;
13084 spec->stream_analog_capture = &alc262_pcm_analog_capture;
13086 spec->stream_digital_playback = &alc262_pcm_digital_playback;
13087 spec->stream_digital_capture = &alc262_pcm_digital_capture;
13089 if (!spec->adc_nids && spec->input_mux) {
13091 /* check whether the digital-mic has to be supported */
13092 for (i = 0; i < spec->input_mux->num_items; i++) {
13093 if (spec->input_mux->items[i].index >= 9)
13096 if (i < spec->input_mux->num_items) {
13097 /* use only ADC0 */
13098 spec->adc_nids = alc262_dmic_adc_nids;
13099 spec->num_adc_nids = 1;
13100 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13102 /* all analog inputs */
13103 /* check whether NID 0x07 is valid */
13104 unsigned int wcap = get_wcaps(codec, 0x07);
13107 wcap = get_wcaps_type(wcap);
13108 if (wcap != AC_WID_AUD_IN) {
13109 spec->adc_nids = alc262_adc_nids_alt;
13110 spec->num_adc_nids =
13111 ARRAY_SIZE(alc262_adc_nids_alt);
13112 spec->capsrc_nids = alc262_capsrc_nids_alt;
13114 spec->adc_nids = alc262_adc_nids;
13115 spec->num_adc_nids =
13116 ARRAY_SIZE(alc262_adc_nids);
13117 spec->capsrc_nids = alc262_capsrc_nids;
13121 if (!spec->cap_mixer && !spec->no_analog)
13122 set_capture_mixer(codec);
13123 if (!spec->no_analog && has_cdefine_beep(codec))
13124 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13126 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13128 spec->vmaster_nid = 0x0c;
13130 codec->patch_ops = alc_patch_ops;
13131 if (board_config == ALC262_AUTO)
13132 spec->init_hook = alc262_auto_init;
13133 spec->shutup = alc_eapd_shutup;
13135 alc_init_jacks(codec);
13136 #ifdef CONFIG_SND_HDA_POWER_SAVE
13137 if (!spec->loopback.amplist)
13138 spec->loopback.amplist = alc262_loopbacks;
13145 * ALC268 channel source setting (2 channel)
13147 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13148 #define alc268_modes alc260_modes
13150 static const hda_nid_t alc268_dac_nids[2] = {
13155 static const hda_nid_t alc268_adc_nids[2] = {
13160 static const hda_nid_t alc268_adc_nids_alt[1] = {
13165 static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13167 static const struct snd_kcontrol_new alc268_base_mixer[] = {
13168 /* output mixer control */
13169 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13170 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13171 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13173 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13174 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13175 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13179 static const struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13180 /* output mixer control */
13181 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13183 ALC262_HIPPO_MASTER_SWITCH,
13184 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13185 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13186 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13190 /* bind Beep switches of both NID 0x0f and 0x10 */
13191 static const struct hda_bind_ctls alc268_bind_beep_sw = {
13192 .ops = &snd_hda_bind_sw,
13194 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13195 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13200 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
13201 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13202 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13206 static const struct hda_verb alc268_eapd_verbs[] = {
13207 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13208 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13212 /* Toshiba specific */
13213 static const struct hda_verb alc268_toshiba_verbs[] = {
13214 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13218 /* Acer specific */
13219 /* bind volumes of both NID 0x02 and 0x03 */
13220 static const struct hda_bind_ctls alc268_acer_bind_master_vol = {
13221 .ops = &snd_hda_bind_vol,
13223 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13224 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13229 static void alc268_acer_setup(struct hda_codec *codec)
13231 struct alc_spec *spec = codec->spec;
13233 spec->autocfg.hp_pins[0] = 0x14;
13234 spec->autocfg.speaker_pins[0] = 0x15;
13235 spec->automute = 1;
13236 spec->automute_mode = ALC_AUTOMUTE_AMP;
13239 #define alc268_acer_master_sw_get alc262_hp_master_sw_get
13240 #define alc268_acer_master_sw_put alc262_hp_master_sw_put
13242 static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13243 /* output mixer control */
13244 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13247 .name = "Master Playback Switch",
13248 .subdevice = HDA_SUBDEV_NID_FLAG | 0x15,
13249 .info = snd_ctl_boolean_mono_info,
13250 .get = alc268_acer_master_sw_get,
13251 .put = alc268_acer_master_sw_put,
13253 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13257 static const struct snd_kcontrol_new alc268_acer_mixer[] = {
13258 /* output mixer control */
13259 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13261 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13262 .name = "Master Playback Switch",
13263 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13264 .info = snd_ctl_boolean_mono_info,
13265 .get = alc268_acer_master_sw_get,
13266 .put = alc268_acer_master_sw_put,
13268 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13269 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13270 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13274 static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13275 /* output mixer control */
13276 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13278 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13279 .name = "Master Playback Switch",
13280 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13281 .info = snd_ctl_boolean_mono_info,
13282 .get = alc268_acer_master_sw_get,
13283 .put = alc268_acer_master_sw_put,
13285 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13286 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13290 static const struct hda_verb alc268_acer_aspire_one_verbs[] = {
13291 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13292 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13293 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13294 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13295 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13300 static const struct hda_verb alc268_acer_verbs[] = {
13301 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13302 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13306 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13307 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13311 /* unsolicited event for HP jack sensing */
13312 #define alc268_toshiba_setup alc262_hippo_setup
13314 static void alc268_acer_lc_setup(struct hda_codec *codec)
13316 struct alc_spec *spec = codec->spec;
13317 spec->autocfg.hp_pins[0] = 0x15;
13318 spec->autocfg.speaker_pins[0] = 0x14;
13319 spec->automute = 1;
13320 spec->automute_mode = ALC_AUTOMUTE_AMP;
13321 spec->ext_mic.pin = 0x18;
13322 spec->ext_mic.mux_idx = 0;
13323 spec->int_mic.pin = 0x12;
13324 spec->int_mic.mux_idx = 6;
13325 spec->auto_mic = 1;
13328 static const struct snd_kcontrol_new alc268_dell_mixer[] = {
13329 /* output mixer control */
13330 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13331 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13332 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13334 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13335 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13339 static const struct hda_verb alc268_dell_verbs[] = {
13340 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13341 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13343 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13347 /* mute/unmute internal speaker according to the hp jack and mute state */
13348 static void alc268_dell_setup(struct hda_codec *codec)
13350 struct alc_spec *spec = codec->spec;
13352 spec->autocfg.hp_pins[0] = 0x15;
13353 spec->autocfg.speaker_pins[0] = 0x14;
13354 spec->ext_mic.pin = 0x18;
13355 spec->ext_mic.mux_idx = 0;
13356 spec->int_mic.pin = 0x19;
13357 spec->int_mic.mux_idx = 1;
13358 spec->auto_mic = 1;
13359 spec->automute = 1;
13360 spec->automute_mode = ALC_AUTOMUTE_PIN;
13363 static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13364 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13365 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13366 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13368 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13369 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13370 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13371 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13375 static const struct hda_verb alc267_quanta_il1_verbs[] = {
13376 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13381 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13383 struct alc_spec *spec = codec->spec;
13384 spec->autocfg.hp_pins[0] = 0x15;
13385 spec->autocfg.speaker_pins[0] = 0x14;
13386 spec->ext_mic.pin = 0x18;
13387 spec->ext_mic.mux_idx = 0;
13388 spec->int_mic.pin = 0x19;
13389 spec->int_mic.mux_idx = 1;
13390 spec->auto_mic = 1;
13391 spec->automute = 1;
13392 spec->automute_mode = ALC_AUTOMUTE_PIN;
13396 * generic initialization of ADC, input mixers and output mixers
13398 static const struct hda_verb alc268_base_init_verbs[] = {
13399 /* Unmute DAC0-1 and set vol = 0 */
13400 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13401 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13404 * Set up output mixers (0x0c - 0x0e)
13406 /* set vol=0 to output mixers */
13407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13410 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13411 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13414 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13416 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13417 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13418 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13419 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13420 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13422 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13424 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13426 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13428 /* set PCBEEP vol = 0, mute connections */
13429 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13431 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13433 /* Unmute Selector 23h,24h and set the default input to mic-in */
13435 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13436 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13437 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13444 * generic initialization of ADC, input mixers and output mixers
13446 static const struct hda_verb alc268_volume_init_verbs[] = {
13447 /* set output DAC */
13448 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13449 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13451 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13452 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13453 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13454 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13455 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13457 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13459 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13461 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13462 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13464 /* set PCBEEP vol = 0, mute connections */
13465 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13467 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13472 static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13473 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13474 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13478 static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13479 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13480 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13485 static const struct snd_kcontrol_new alc268_capture_mixer[] = {
13486 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13487 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13488 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13489 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13494 static const struct hda_input_mux alc268_capture_source = {
13498 { "Front Mic", 0x1 },
13504 static const struct hda_input_mux alc268_acer_capture_source = {
13508 { "Internal Mic", 0x1 },
13513 static const struct hda_input_mux alc268_acer_dmic_capture_source = {
13517 { "Internal Mic", 0x6 },
13522 #ifdef CONFIG_SND_DEBUG
13523 static const struct snd_kcontrol_new alc268_test_mixer[] = {
13524 /* Volume widgets */
13525 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13526 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13527 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13528 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13529 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13530 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13531 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13532 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13533 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13534 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13535 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13536 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13537 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13538 /* The below appears problematic on some hardwares */
13539 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13540 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13541 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13542 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13543 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13545 /* Modes for retasking pin widgets */
13546 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13547 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13548 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13549 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13551 /* Controls for GPIO pins, assuming they are configured as outputs */
13552 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13553 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13554 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13555 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13557 /* Switches to allow the digital SPDIF output pin to be enabled.
13558 * The ALC268 does not have an SPDIF input.
13560 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13562 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13563 * this output to turn on an external amplifier.
13565 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13566 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13572 /* create input playback/capture controls for the given pin */
13573 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13574 const char *ctlname, int idx)
13585 case 0x1a: /* ALC259/269 only */
13586 case 0x1b: /* ALC259/269 only */
13587 case 0x21: /* ALC269vb has this pin, too */
13591 snd_printd(KERN_WARNING "hda_codec: "
13592 "ignoring pin 0x%x as unknown\n", nid);
13595 if (spec->multiout.dac_nids[0] != dac &&
13596 spec->multiout.dac_nids[1] != dac) {
13597 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13598 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13602 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
13606 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13607 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13609 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13610 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13616 /* add playback controls from the parsed DAC table */
13617 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13618 const struct auto_pin_cfg *cfg)
13623 spec->multiout.dac_nids = spec->private_dac_nids;
13625 nid = cfg->line_out_pins[0];
13628 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13632 err = alc268_new_analog_output(spec, nid, name, 0);
13637 nid = cfg->speaker_pins[0];
13639 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13640 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13644 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13648 nid = cfg->hp_pins[0];
13650 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13655 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13657 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13658 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13665 /* create playback/capture controls for input pins */
13666 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13667 const struct auto_pin_cfg *cfg)
13669 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13672 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13673 hda_nid_t nid, int pin_type)
13677 alc_set_pin_output(codec, nid, pin_type);
13678 if (nid == 0x14 || nid == 0x16)
13682 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13685 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13687 struct alc_spec *spec = codec->spec;
13690 for (i = 0; i < spec->autocfg.line_outs; i++) {
13691 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13692 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13693 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13697 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13699 struct alc_spec *spec = codec->spec;
13703 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13704 pin = spec->autocfg.hp_pins[i];
13705 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13707 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13708 pin = spec->autocfg.speaker_pins[i];
13709 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13711 if (spec->autocfg.mono_out_pin)
13712 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13713 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13716 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13718 struct alc_spec *spec = codec->spec;
13719 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13720 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13721 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13722 unsigned int dac_vol1, dac_vol2;
13724 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13725 snd_hda_codec_write(codec, speaker_nid, 0,
13726 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13727 /* mute mixer inputs from 0x1d */
13728 snd_hda_codec_write(codec, 0x0f, 0,
13729 AC_VERB_SET_AMP_GAIN_MUTE,
13731 snd_hda_codec_write(codec, 0x10, 0,
13732 AC_VERB_SET_AMP_GAIN_MUTE,
13735 /* unmute mixer inputs from 0x1d */
13736 snd_hda_codec_write(codec, 0x0f, 0,
13737 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13738 snd_hda_codec_write(codec, 0x10, 0,
13739 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13742 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13743 if (line_nid == 0x14)
13744 dac_vol2 = AMP_OUT_ZERO;
13745 else if (line_nid == 0x15)
13746 dac_vol1 = AMP_OUT_ZERO;
13747 if (hp_nid == 0x14)
13748 dac_vol2 = AMP_OUT_ZERO;
13749 else if (hp_nid == 0x15)
13750 dac_vol1 = AMP_OUT_ZERO;
13751 if (line_nid != 0x16 || hp_nid != 0x16 ||
13752 spec->autocfg.line_out_pins[1] != 0x16 ||
13753 spec->autocfg.line_out_pins[2] != 0x16)
13754 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13756 snd_hda_codec_write(codec, 0x02, 0,
13757 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13758 snd_hda_codec_write(codec, 0x03, 0,
13759 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13762 /* pcm configuration: identical with ALC880 */
13763 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13764 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13765 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13766 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13769 * BIOS auto configuration
13771 static int alc268_parse_auto_config(struct hda_codec *codec)
13773 struct alc_spec *spec = codec->spec;
13775 static const hda_nid_t alc268_ignore[] = { 0 };
13777 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13781 if (!spec->autocfg.line_outs) {
13782 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13783 spec->multiout.max_channels = 2;
13784 spec->no_analog = 1;
13787 return 0; /* can't find valid BIOS pin config */
13789 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13792 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13796 spec->multiout.max_channels = 2;
13799 /* digital only support output */
13800 alc_auto_parse_digital(codec);
13801 if (spec->kctls.list)
13802 add_mixer(spec, spec->kctls.list);
13804 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13805 add_mixer(spec, alc268_beep_mixer);
13807 add_verb(spec, alc268_volume_init_verbs);
13808 spec->num_mux_defs = 2;
13809 spec->input_mux = &spec->private_imux[0];
13811 err = alc_auto_add_mic_boost(codec);
13815 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13820 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13821 #define alc268_auto_init_input_src alc882_auto_init_input_src
13823 /* init callback for auto-configuration model -- overriding the default init */
13824 static void alc268_auto_init(struct hda_codec *codec)
13826 struct alc_spec *spec = codec->spec;
13827 alc268_auto_init_multi_out(codec);
13828 alc268_auto_init_hp_out(codec);
13829 alc268_auto_init_mono_speaker_out(codec);
13830 alc268_auto_init_analog_input(codec);
13831 alc268_auto_init_input_src(codec);
13832 alc_auto_init_digital(codec);
13833 if (spec->unsol_event)
13834 alc_inithook(codec);
13838 * configuration and preset
13840 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13841 [ALC267_QUANTA_IL1] = "quanta-il1",
13842 [ALC268_3ST] = "3stack",
13843 [ALC268_TOSHIBA] = "toshiba",
13844 [ALC268_ACER] = "acer",
13845 [ALC268_ACER_DMIC] = "acer-dmic",
13846 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13847 [ALC268_DELL] = "dell",
13848 [ALC268_ZEPTO] = "zepto",
13849 #ifdef CONFIG_SND_DEBUG
13850 [ALC268_TEST] = "test",
13852 [ALC268_AUTO] = "auto",
13855 static const struct snd_pci_quirk alc268_cfg_tbl[] = {
13856 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13857 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13858 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13859 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13860 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13861 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13862 ALC268_ACER_ASPIRE_ONE),
13863 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13864 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
13865 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13866 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13867 /* almost compatible with toshiba but with optional digital outs;
13868 * auto-probing seems working fine
13870 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13872 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13873 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13874 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13875 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13876 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13880 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13881 static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13882 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13883 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13884 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13889 static const struct alc_config_preset alc268_presets[] = {
13890 [ALC267_QUANTA_IL1] = {
13891 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13892 alc268_capture_nosrc_mixer },
13893 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13894 alc267_quanta_il1_verbs },
13895 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13896 .dac_nids = alc268_dac_nids,
13897 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13898 .adc_nids = alc268_adc_nids_alt,
13900 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13901 .channel_mode = alc268_modes,
13902 .unsol_event = alc_sku_unsol_event,
13903 .setup = alc267_quanta_il1_setup,
13904 .init_hook = alc_inithook,
13907 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13908 alc268_beep_mixer },
13909 .init_verbs = { alc268_base_init_verbs },
13910 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13911 .dac_nids = alc268_dac_nids,
13912 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13913 .adc_nids = alc268_adc_nids_alt,
13914 .capsrc_nids = alc268_capsrc_nids,
13916 .dig_out_nid = ALC268_DIGOUT_NID,
13917 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13918 .channel_mode = alc268_modes,
13919 .input_mux = &alc268_capture_source,
13921 [ALC268_TOSHIBA] = {
13922 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13923 alc268_beep_mixer },
13924 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13925 alc268_toshiba_verbs },
13926 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13927 .dac_nids = alc268_dac_nids,
13928 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13929 .adc_nids = alc268_adc_nids_alt,
13930 .capsrc_nids = alc268_capsrc_nids,
13932 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13933 .channel_mode = alc268_modes,
13934 .input_mux = &alc268_capture_source,
13935 .unsol_event = alc_sku_unsol_event,
13936 .setup = alc268_toshiba_setup,
13937 .init_hook = alc_inithook,
13940 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13941 alc268_beep_mixer },
13942 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13943 alc268_acer_verbs },
13944 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13945 .dac_nids = alc268_dac_nids,
13946 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13947 .adc_nids = alc268_adc_nids_alt,
13948 .capsrc_nids = alc268_capsrc_nids,
13950 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13951 .channel_mode = alc268_modes,
13952 .input_mux = &alc268_acer_capture_source,
13953 .unsol_event = alc_sku_unsol_event,
13954 .setup = alc268_acer_setup,
13955 .init_hook = alc_inithook,
13957 [ALC268_ACER_DMIC] = {
13958 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13959 alc268_beep_mixer },
13960 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13961 alc268_acer_verbs },
13962 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13963 .dac_nids = alc268_dac_nids,
13964 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13965 .adc_nids = alc268_adc_nids_alt,
13966 .capsrc_nids = alc268_capsrc_nids,
13968 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13969 .channel_mode = alc268_modes,
13970 .input_mux = &alc268_acer_dmic_capture_source,
13971 .unsol_event = alc_sku_unsol_event,
13972 .setup = alc268_acer_setup,
13973 .init_hook = alc_inithook,
13975 [ALC268_ACER_ASPIRE_ONE] = {
13976 .mixers = { alc268_acer_aspire_one_mixer,
13978 alc268_capture_nosrc_mixer },
13979 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13980 alc268_acer_aspire_one_verbs },
13981 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13982 .dac_nids = alc268_dac_nids,
13983 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13984 .adc_nids = alc268_adc_nids_alt,
13985 .capsrc_nids = alc268_capsrc_nids,
13987 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13988 .channel_mode = alc268_modes,
13989 .unsol_event = alc_sku_unsol_event,
13990 .setup = alc268_acer_lc_setup,
13991 .init_hook = alc_inithook,
13994 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13995 alc268_capture_nosrc_mixer },
13996 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13997 alc268_dell_verbs },
13998 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13999 .dac_nids = alc268_dac_nids,
14000 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14001 .adc_nids = alc268_adc_nids_alt,
14002 .capsrc_nids = alc268_capsrc_nids,
14004 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14005 .channel_mode = alc268_modes,
14006 .unsol_event = alc_sku_unsol_event,
14007 .setup = alc268_dell_setup,
14008 .init_hook = alc_inithook,
14011 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
14012 alc268_beep_mixer },
14013 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14014 alc268_toshiba_verbs },
14015 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14016 .dac_nids = alc268_dac_nids,
14017 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14018 .adc_nids = alc268_adc_nids_alt,
14019 .capsrc_nids = alc268_capsrc_nids,
14021 .dig_out_nid = ALC268_DIGOUT_NID,
14022 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14023 .channel_mode = alc268_modes,
14024 .input_mux = &alc268_capture_source,
14025 .unsol_event = alc_sku_unsol_event,
14026 .setup = alc268_toshiba_setup,
14027 .init_hook = alc_inithook,
14029 #ifdef CONFIG_SND_DEBUG
14031 .mixers = { alc268_test_mixer, alc268_capture_mixer },
14032 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
14033 alc268_volume_init_verbs },
14034 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
14035 .dac_nids = alc268_dac_nids,
14036 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
14037 .adc_nids = alc268_adc_nids_alt,
14038 .capsrc_nids = alc268_capsrc_nids,
14040 .dig_out_nid = ALC268_DIGOUT_NID,
14041 .num_channel_mode = ARRAY_SIZE(alc268_modes),
14042 .channel_mode = alc268_modes,
14043 .input_mux = &alc268_capture_source,
14048 static int patch_alc268(struct hda_codec *codec)
14050 struct alc_spec *spec;
14052 int i, has_beep, err;
14054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14058 codec->spec = spec;
14060 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
14064 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
14065 board_config = snd_hda_check_board_codec_sid_config(codec,
14066 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
14068 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
14069 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14071 board_config = ALC268_AUTO;
14074 if (board_config == ALC268_AUTO) {
14075 /* automatic parse from the BIOS config */
14076 err = alc268_parse_auto_config(codec);
14082 "hda_codec: Cannot set up configuration "
14083 "from BIOS. Using base mode...\n");
14084 board_config = ALC268_3ST;
14088 if (board_config != ALC268_AUTO)
14089 setup_preset(codec, &alc268_presets[board_config]);
14091 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14092 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14093 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14095 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14098 for (i = 0; i < spec->num_mixers; i++) {
14099 if (spec->mixers[i] == alc268_beep_mixer) {
14106 err = snd_hda_attach_beep_device(codec, 0x1);
14111 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14112 /* override the amp caps for beep generator */
14113 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14114 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14115 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14116 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14117 (0 << AC_AMPCAP_MUTE_SHIFT));
14120 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14121 /* check whether NID 0x07 is valid */
14122 unsigned int wcap = get_wcaps(codec, 0x07);
14124 spec->capsrc_nids = alc268_capsrc_nids;
14126 wcap = get_wcaps_type(wcap);
14127 if (spec->auto_mic ||
14128 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14129 spec->adc_nids = alc268_adc_nids_alt;
14130 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14131 if (spec->auto_mic)
14132 fixup_automic_adc(codec);
14133 if (spec->auto_mic || spec->input_mux->num_items == 1)
14134 add_mixer(spec, alc268_capture_nosrc_mixer);
14136 add_mixer(spec, alc268_capture_alt_mixer);
14138 spec->adc_nids = alc268_adc_nids;
14139 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14140 add_mixer(spec, alc268_capture_mixer);
14144 spec->vmaster_nid = 0x02;
14146 codec->patch_ops = alc_patch_ops;
14147 if (board_config == ALC268_AUTO)
14148 spec->init_hook = alc268_auto_init;
14149 spec->shutup = alc_eapd_shutup;
14151 alc_init_jacks(codec);
14157 * ALC269 channel source setting (2 channel)
14159 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14161 #define alc269_dac_nids alc260_dac_nids
14163 static const hda_nid_t alc269_adc_nids[1] = {
14168 static const hda_nid_t alc269_capsrc_nids[1] = {
14172 static const hda_nid_t alc269vb_adc_nids[1] = {
14177 static const hda_nid_t alc269vb_capsrc_nids[1] = {
14181 static const hda_nid_t alc269_adc_candidates[] = {
14182 0x08, 0x09, 0x07, 0x11,
14185 #define alc269_modes alc260_modes
14186 #define alc269_capture_source alc880_lg_lw_capture_source
14188 static const struct snd_kcontrol_new alc269_base_mixer[] = {
14189 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14190 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14191 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14192 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14195 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14196 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14197 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14198 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14200 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14204 static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14205 /* output mixer control */
14206 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14209 .name = "Master Playback Switch",
14210 .subdevice = HDA_SUBDEV_AMP_FLAG,
14211 .info = snd_hda_mixer_amp_switch_info,
14212 .get = snd_hda_mixer_amp_switch_get,
14213 .put = alc268_acer_master_sw_put,
14214 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14218 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14219 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14220 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14221 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14225 static const struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14226 /* output mixer control */
14227 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14229 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14230 .name = "Master Playback Switch",
14231 .subdevice = HDA_SUBDEV_AMP_FLAG,
14232 .info = snd_hda_mixer_amp_switch_info,
14233 .get = snd_hda_mixer_amp_switch_get,
14234 .put = alc268_acer_master_sw_put,
14235 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14239 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14240 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14241 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14242 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14243 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14244 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14245 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14249 static const struct snd_kcontrol_new alc269_laptop_mixer[] = {
14250 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14251 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14257 static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14258 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14259 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14261 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14265 static const struct snd_kcontrol_new alc269_asus_mixer[] = {
14266 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14267 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14271 /* capture mixer elements */
14272 static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14273 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14274 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14275 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14276 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14280 static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14281 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14282 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14283 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14287 static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14288 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14289 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14290 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14291 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14295 static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14296 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14297 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14298 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14303 #define alc269_fujitsu_mixer alc269_laptop_mixer
14305 static const struct hda_verb alc269_quanta_fl1_verbs[] = {
14306 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14307 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14309 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14310 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14311 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14315 static const struct hda_verb alc269_lifebook_verbs[] = {
14316 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14317 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14318 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14319 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14320 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14321 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14322 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14323 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14325 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14329 /* toggle speaker-output according to the hp-jack state */
14330 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14332 alc_hp_automute(codec);
14334 snd_hda_codec_write(codec, 0x20, 0,
14335 AC_VERB_SET_COEF_INDEX, 0x0c);
14336 snd_hda_codec_write(codec, 0x20, 0,
14337 AC_VERB_SET_PROC_COEF, 0x680);
14339 snd_hda_codec_write(codec, 0x20, 0,
14340 AC_VERB_SET_COEF_INDEX, 0x0c);
14341 snd_hda_codec_write(codec, 0x20, 0,
14342 AC_VERB_SET_PROC_COEF, 0x480);
14345 #define alc269_lifebook_speaker_automute \
14346 alc269_quanta_fl1_speaker_automute
14348 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14350 unsigned int present_laptop;
14351 unsigned int present_dock;
14353 present_laptop = snd_hda_jack_detect(codec, 0x18);
14354 present_dock = snd_hda_jack_detect(codec, 0x1b);
14356 /* Laptop mic port overrides dock mic port, design decision */
14358 snd_hda_codec_write(codec, 0x23, 0,
14359 AC_VERB_SET_CONNECT_SEL, 0x3);
14360 if (present_laptop)
14361 snd_hda_codec_write(codec, 0x23, 0,
14362 AC_VERB_SET_CONNECT_SEL, 0x0);
14363 if (!present_dock && !present_laptop)
14364 snd_hda_codec_write(codec, 0x23, 0,
14365 AC_VERB_SET_CONNECT_SEL, 0x1);
14368 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14371 switch (res >> 26) {
14372 case ALC880_HP_EVENT:
14373 alc269_quanta_fl1_speaker_automute(codec);
14375 case ALC880_MIC_EVENT:
14376 alc_mic_automute(codec);
14381 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14384 if ((res >> 26) == ALC880_HP_EVENT)
14385 alc269_lifebook_speaker_automute(codec);
14386 if ((res >> 26) == ALC880_MIC_EVENT)
14387 alc269_lifebook_mic_autoswitch(codec);
14390 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14392 struct alc_spec *spec = codec->spec;
14393 spec->autocfg.hp_pins[0] = 0x15;
14394 spec->autocfg.speaker_pins[0] = 0x14;
14395 spec->automute_mixer_nid[0] = 0x0c;
14396 spec->automute = 1;
14397 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14398 spec->ext_mic.pin = 0x18;
14399 spec->ext_mic.mux_idx = 0;
14400 spec->int_mic.pin = 0x19;
14401 spec->int_mic.mux_idx = 1;
14402 spec->auto_mic = 1;
14405 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14407 alc269_quanta_fl1_speaker_automute(codec);
14408 alc_mic_automute(codec);
14411 static void alc269_lifebook_setup(struct hda_codec *codec)
14413 struct alc_spec *spec = codec->spec;
14414 spec->autocfg.hp_pins[0] = 0x15;
14415 spec->autocfg.hp_pins[1] = 0x1a;
14416 spec->autocfg.speaker_pins[0] = 0x14;
14417 spec->automute_mixer_nid[0] = 0x0c;
14418 spec->automute = 1;
14419 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14422 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14424 alc269_lifebook_speaker_automute(codec);
14425 alc269_lifebook_mic_autoswitch(codec);
14428 static const struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14430 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14431 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14432 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14433 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14434 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14435 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14439 static const struct hda_verb alc269_laptop_amic_init_verbs[] = {
14440 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14441 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14442 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14443 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14444 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14445 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14449 static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14450 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14451 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14452 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14454 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14455 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14456 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14460 static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14461 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14462 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14463 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14466 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14467 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14471 static const struct hda_verb alc271_acer_dmic_verbs[] = {
14472 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14473 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14474 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14476 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14477 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14478 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14479 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14480 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14481 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14485 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14487 struct alc_spec *spec = codec->spec;
14488 spec->autocfg.hp_pins[0] = 0x15;
14489 spec->autocfg.speaker_pins[0] = 0x14;
14490 spec->automute_mixer_nid[0] = 0x0c;
14491 spec->automute = 1;
14492 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14493 spec->ext_mic.pin = 0x18;
14494 spec->ext_mic.mux_idx = 0;
14495 spec->int_mic.pin = 0x19;
14496 spec->int_mic.mux_idx = 1;
14497 spec->auto_mic = 1;
14500 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14502 struct alc_spec *spec = codec->spec;
14503 spec->autocfg.hp_pins[0] = 0x15;
14504 spec->autocfg.speaker_pins[0] = 0x14;
14505 spec->automute_mixer_nid[0] = 0x0c;
14506 spec->automute = 1;
14507 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14508 spec->ext_mic.pin = 0x18;
14509 spec->ext_mic.mux_idx = 0;
14510 spec->int_mic.pin = 0x12;
14511 spec->int_mic.mux_idx = 5;
14512 spec->auto_mic = 1;
14515 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14517 struct alc_spec *spec = codec->spec;
14518 spec->autocfg.hp_pins[0] = 0x21;
14519 spec->autocfg.speaker_pins[0] = 0x14;
14520 spec->automute_mixer_nid[0] = 0x0c;
14521 spec->automute = 1;
14522 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14523 spec->ext_mic.pin = 0x18;
14524 spec->ext_mic.mux_idx = 0;
14525 spec->int_mic.pin = 0x19;
14526 spec->int_mic.mux_idx = 1;
14527 spec->auto_mic = 1;
14530 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14532 struct alc_spec *spec = codec->spec;
14533 spec->autocfg.hp_pins[0] = 0x21;
14534 spec->autocfg.speaker_pins[0] = 0x14;
14535 spec->automute_mixer_nid[0] = 0x0c;
14536 spec->automute = 1;
14537 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14538 spec->ext_mic.pin = 0x18;
14539 spec->ext_mic.mux_idx = 0;
14540 spec->int_mic.pin = 0x12;
14541 spec->int_mic.mux_idx = 6;
14542 spec->auto_mic = 1;
14546 * generic initialization of ADC, input mixers and output mixers
14548 static const struct hda_verb alc269_init_verbs[] = {
14550 * Unmute ADC0 and set the default input to mic-in
14552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14555 * Set up output mixers (0x02 - 0x03)
14557 /* set vol=0 to output mixers */
14558 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14559 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14561 /* set up input amps for analog loopback */
14562 /* Amp Indices: DAC = 0, mixer = 1 */
14563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14572 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14573 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14574 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14576 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14579 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14581 /* FIXME: use Mux-type input source selection */
14582 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14583 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14584 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14587 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14591 static const struct hda_verb alc269vb_init_verbs[] = {
14593 * Unmute ADC0 and set the default input to mic-in
14595 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14598 * Set up output mixers (0x02 - 0x03)
14600 /* set vol=0 to output mixers */
14601 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14602 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14604 /* set up input amps for analog loopback */
14605 /* Amp Indices: DAC = 0, mixer = 1 */
14606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14610 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14611 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14614 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14615 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14616 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14617 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14618 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14619 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14621 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14622 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14624 /* FIXME: use Mux-type input source selection */
14625 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14626 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14627 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14630 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14634 #define alc269_auto_create_multi_out_ctls \
14635 alc268_auto_create_multi_out_ctls
14636 #define alc269_auto_create_input_ctls \
14637 alc268_auto_create_input_ctls
14639 #ifdef CONFIG_SND_HDA_POWER_SAVE
14640 #define alc269_loopbacks alc880_loopbacks
14643 /* pcm configuration: identical with ALC880 */
14644 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14645 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14646 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14647 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14649 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14653 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14654 /* NID is set in alc_build_pcms */
14656 .open = alc880_playback_pcm_open,
14657 .prepare = alc880_playback_pcm_prepare,
14658 .cleanup = alc880_playback_pcm_cleanup
14662 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14666 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14667 /* NID is set in alc_build_pcms */
14670 #ifdef CONFIG_SND_HDA_POWER_SAVE
14671 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14673 switch (codec->subsystem_id) {
14680 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14682 /* update mute-LED according to the speaker mute state */
14683 if (nid == 0x01 || nid == 0x14) {
14685 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14690 /* mic2 vref pin is used for mute LED control */
14691 snd_hda_codec_update_cache(codec, 0x19, 0,
14692 AC_VERB_SET_PIN_WIDGET_CONTROL,
14695 return alc_check_power_status(codec, nid);
14697 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14699 static int alc275_setup_dual_adc(struct hda_codec *codec)
14701 struct alc_spec *spec = codec->spec;
14703 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14705 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14706 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14707 if (spec->ext_mic.pin <= 0x12) {
14708 spec->private_adc_nids[0] = 0x08;
14709 spec->private_adc_nids[1] = 0x11;
14710 spec->private_capsrc_nids[0] = 0x23;
14711 spec->private_capsrc_nids[1] = 0x22;
14713 spec->private_adc_nids[0] = 0x11;
14714 spec->private_adc_nids[1] = 0x08;
14715 spec->private_capsrc_nids[0] = 0x22;
14716 spec->private_capsrc_nids[1] = 0x23;
14718 spec->adc_nids = spec->private_adc_nids;
14719 spec->capsrc_nids = spec->private_capsrc_nids;
14720 spec->num_adc_nids = 2;
14721 spec->dual_adc_switch = 1;
14722 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14723 spec->adc_nids[0], spec->adc_nids[1]);
14729 /* different alc269-variants */
14731 ALC269_TYPE_NORMAL,
14732 ALC269_TYPE_ALC258,
14733 ALC269_TYPE_ALC259,
14734 ALC269_TYPE_ALC269VB,
14735 ALC269_TYPE_ALC270,
14736 ALC269_TYPE_ALC271X,
14740 * BIOS auto configuration
14742 static int alc269_parse_auto_config(struct hda_codec *codec)
14744 struct alc_spec *spec = codec->spec;
14746 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14748 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14753 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14756 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14757 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14759 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14764 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14766 alc_auto_parse_digital(codec);
14768 if (spec->kctls.list)
14769 add_mixer(spec, spec->kctls.list);
14771 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14772 add_verb(spec, alc269vb_init_verbs);
14773 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14775 add_verb(spec, alc269_init_verbs);
14776 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14779 spec->num_mux_defs = 1;
14780 spec->input_mux = &spec->private_imux[0];
14782 if (!alc275_setup_dual_adc(codec))
14783 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14784 sizeof(alc269_adc_candidates));
14786 err = alc_auto_add_mic_boost(codec);
14790 if (!spec->cap_mixer && !spec->no_analog)
14791 set_capture_mixer(codec);
14796 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14797 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14798 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14799 #define alc269_auto_init_input_src alc882_auto_init_input_src
14802 /* init callback for auto-configuration model -- overriding the default init */
14803 static void alc269_auto_init(struct hda_codec *codec)
14805 struct alc_spec *spec = codec->spec;
14806 alc269_auto_init_multi_out(codec);
14807 alc269_auto_init_hp_out(codec);
14808 alc269_auto_init_analog_input(codec);
14809 if (!spec->dual_adc_switch)
14810 alc269_auto_init_input_src(codec);
14811 alc_auto_init_digital(codec);
14812 if (spec->unsol_event)
14813 alc_inithook(codec);
14816 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14818 int val = alc_read_coef_idx(codec, 0x04);
14823 alc_write_coef_idx(codec, 0x04, val);
14826 static void alc269_shutup(struct hda_codec *codec)
14828 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14829 alc269_toggle_power_output(codec, 0);
14830 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14831 alc269_toggle_power_output(codec, 0);
14836 #ifdef SND_HDA_NEEDS_RESUME
14837 static int alc269_resume(struct hda_codec *codec)
14839 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14840 alc269_toggle_power_output(codec, 0);
14844 codec->patch_ops.init(codec);
14846 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14847 alc269_toggle_power_output(codec, 1);
14851 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14852 alc269_toggle_power_output(codec, 1);
14854 snd_hda_codec_resume_amp(codec);
14855 snd_hda_codec_resume_cache(codec);
14856 hda_call_check_power_status(codec, 0x01);
14859 #endif /* SND_HDA_NEEDS_RESUME */
14861 static void alc269_fixup_hweq(struct hda_codec *codec,
14862 const struct alc_fixup *fix, int action)
14866 if (action != ALC_FIXUP_ACT_INIT)
14868 coef = alc_read_coef_idx(codec, 0x1e);
14869 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14872 static void alc271_fixup_dmic(struct hda_codec *codec,
14873 const struct alc_fixup *fix, int action)
14875 static const struct hda_verb verbs[] = {
14876 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14877 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14882 if (strcmp(codec->chip_name, "ALC271X"))
14884 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
14885 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
14886 snd_hda_sequence_write(codec, verbs);
14890 ALC269_FIXUP_SONY_VAIO,
14891 ALC275_FIXUP_SONY_VAIO_GPIO2,
14892 ALC269_FIXUP_DELL_M101Z,
14893 ALC269_FIXUP_SKU_IGNORE,
14894 ALC269_FIXUP_ASUS_G73JW,
14895 ALC269_FIXUP_LENOVO_EAPD,
14896 ALC275_FIXUP_SONY_HWEQ,
14900 static const struct alc_fixup alc269_fixups[] = {
14901 [ALC269_FIXUP_SONY_VAIO] = {
14902 .type = ALC_FIXUP_VERBS,
14903 .v.verbs = (const struct hda_verb[]) {
14904 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14908 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14909 .type = ALC_FIXUP_VERBS,
14910 .v.verbs = (const struct hda_verb[]) {
14911 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14912 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14913 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14917 .chain_id = ALC269_FIXUP_SONY_VAIO
14919 [ALC269_FIXUP_DELL_M101Z] = {
14920 .type = ALC_FIXUP_VERBS,
14921 .v.verbs = (const struct hda_verb[]) {
14922 /* Enables internal speaker */
14923 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14924 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14928 [ALC269_FIXUP_SKU_IGNORE] = {
14929 .type = ALC_FIXUP_SKU,
14930 .v.sku = ALC_FIXUP_SKU_IGNORE,
14932 [ALC269_FIXUP_ASUS_G73JW] = {
14933 .type = ALC_FIXUP_PINS,
14934 .v.pins = (const struct alc_pincfg[]) {
14935 { 0x17, 0x99130111 }, /* subwoofer */
14939 [ALC269_FIXUP_LENOVO_EAPD] = {
14940 .type = ALC_FIXUP_VERBS,
14941 .v.verbs = (const struct hda_verb[]) {
14942 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14946 [ALC275_FIXUP_SONY_HWEQ] = {
14947 .type = ALC_FIXUP_FUNC,
14948 .v.func = alc269_fixup_hweq,
14950 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14952 [ALC271_FIXUP_DMIC] = {
14953 .type = ALC_FIXUP_FUNC,
14954 .v.func = alc271_fixup_dmic,
14958 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
14959 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14960 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14961 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14962 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14963 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14964 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
14965 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14966 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14967 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14968 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14969 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14970 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14971 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14977 * configuration and preset
14979 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14980 [ALC269_BASIC] = "basic",
14981 [ALC269_QUANTA_FL1] = "quanta",
14982 [ALC269_AMIC] = "laptop-amic",
14983 [ALC269_DMIC] = "laptop-dmic",
14984 [ALC269_FUJITSU] = "fujitsu",
14985 [ALC269_LIFEBOOK] = "lifebook",
14986 [ALC269_AUTO] = "auto",
14989 static const struct snd_pci_quirk alc269_cfg_tbl[] = {
14990 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14991 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14992 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14994 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14995 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14996 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14997 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14998 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14999 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
15000 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
15001 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
15002 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
15003 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
15004 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
15005 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
15006 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
15007 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
15008 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
15009 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
15010 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
15011 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
15012 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
15013 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
15014 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
15015 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
15016 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
15017 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
15018 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
15019 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
15020 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
15021 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
15022 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
15023 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
15024 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
15025 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
15026 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
15027 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
15028 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
15029 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
15030 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
15032 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
15034 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
15035 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
15036 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
15037 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
15038 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
15039 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
15040 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
15041 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
15042 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
15043 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
15047 static const struct alc_config_preset alc269_presets[] = {
15049 .mixers = { alc269_base_mixer },
15050 .init_verbs = { alc269_init_verbs },
15051 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15052 .dac_nids = alc269_dac_nids,
15054 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15055 .channel_mode = alc269_modes,
15056 .input_mux = &alc269_capture_source,
15058 [ALC269_QUANTA_FL1] = {
15059 .mixers = { alc269_quanta_fl1_mixer },
15060 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
15061 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15062 .dac_nids = alc269_dac_nids,
15064 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15065 .channel_mode = alc269_modes,
15066 .input_mux = &alc269_capture_source,
15067 .unsol_event = alc269_quanta_fl1_unsol_event,
15068 .setup = alc269_quanta_fl1_setup,
15069 .init_hook = alc269_quanta_fl1_init_hook,
15072 .mixers = { alc269_laptop_mixer },
15073 .cap_mixer = alc269_laptop_analog_capture_mixer,
15074 .init_verbs = { alc269_init_verbs,
15075 alc269_laptop_amic_init_verbs },
15076 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15077 .dac_nids = alc269_dac_nids,
15079 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15080 .channel_mode = alc269_modes,
15081 .unsol_event = alc_sku_unsol_event,
15082 .setup = alc269_laptop_amic_setup,
15083 .init_hook = alc_inithook,
15086 .mixers = { alc269_laptop_mixer },
15087 .cap_mixer = alc269_laptop_digital_capture_mixer,
15088 .init_verbs = { alc269_init_verbs,
15089 alc269_laptop_dmic_init_verbs },
15090 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15091 .dac_nids = alc269_dac_nids,
15093 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15094 .channel_mode = alc269_modes,
15095 .unsol_event = alc_sku_unsol_event,
15096 .setup = alc269_laptop_dmic_setup,
15097 .init_hook = alc_inithook,
15099 [ALC269VB_AMIC] = {
15100 .mixers = { alc269vb_laptop_mixer },
15101 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15102 .init_verbs = { alc269vb_init_verbs,
15103 alc269vb_laptop_amic_init_verbs },
15104 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15105 .dac_nids = alc269_dac_nids,
15107 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15108 .channel_mode = alc269_modes,
15109 .unsol_event = alc_sku_unsol_event,
15110 .setup = alc269vb_laptop_amic_setup,
15111 .init_hook = alc_inithook,
15113 [ALC269VB_DMIC] = {
15114 .mixers = { alc269vb_laptop_mixer },
15115 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15116 .init_verbs = { alc269vb_init_verbs,
15117 alc269vb_laptop_dmic_init_verbs },
15118 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15119 .dac_nids = alc269_dac_nids,
15121 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15122 .channel_mode = alc269_modes,
15123 .unsol_event = alc_sku_unsol_event,
15124 .setup = alc269vb_laptop_dmic_setup,
15125 .init_hook = alc_inithook,
15127 [ALC269_FUJITSU] = {
15128 .mixers = { alc269_fujitsu_mixer },
15129 .cap_mixer = alc269_laptop_digital_capture_mixer,
15130 .init_verbs = { alc269_init_verbs,
15131 alc269_laptop_dmic_init_verbs },
15132 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15133 .dac_nids = alc269_dac_nids,
15135 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15136 .channel_mode = alc269_modes,
15137 .unsol_event = alc_sku_unsol_event,
15138 .setup = alc269_laptop_dmic_setup,
15139 .init_hook = alc_inithook,
15141 [ALC269_LIFEBOOK] = {
15142 .mixers = { alc269_lifebook_mixer },
15143 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15144 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15145 .dac_nids = alc269_dac_nids,
15147 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15148 .channel_mode = alc269_modes,
15149 .input_mux = &alc269_capture_source,
15150 .unsol_event = alc269_lifebook_unsol_event,
15151 .setup = alc269_lifebook_setup,
15152 .init_hook = alc269_lifebook_init_hook,
15155 .mixers = { alc269_asus_mixer },
15156 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15157 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15158 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15159 .dac_nids = alc269_dac_nids,
15160 .adc_nids = alc262_dmic_adc_nids,
15161 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15162 .capsrc_nids = alc262_dmic_capsrc_nids,
15163 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15164 .channel_mode = alc269_modes,
15165 .input_mux = &alc269_capture_source,
15166 .dig_out_nid = ALC880_DIGOUT_NID,
15167 .unsol_event = alc_sku_unsol_event,
15168 .setup = alc269vb_laptop_dmic_setup,
15169 .init_hook = alc_inithook,
15173 static int alc269_fill_coef(struct hda_codec *codec)
15177 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15178 alc_write_coef_idx(codec, 0xf, 0x960b);
15179 alc_write_coef_idx(codec, 0xe, 0x8817);
15182 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15183 alc_write_coef_idx(codec, 0xf, 0x960b);
15184 alc_write_coef_idx(codec, 0xe, 0x8814);
15187 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15188 val = alc_read_coef_idx(codec, 0x04);
15189 /* Power up output pin */
15190 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15193 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15194 val = alc_read_coef_idx(codec, 0xd);
15195 if ((val & 0x0c00) >> 10 != 0x1) {
15196 /* Capless ramp up clock control */
15197 alc_write_coef_idx(codec, 0xd, val | (1<<10));
15199 val = alc_read_coef_idx(codec, 0x17);
15200 if ((val & 0x01c0) >> 6 != 0x4) {
15201 /* Class D power on reset */
15202 alc_write_coef_idx(codec, 0x17, val | (1<<7));
15206 val = alc_read_coef_idx(codec, 0xd); /* Class D */
15207 alc_write_coef_idx(codec, 0xd, val | (1<<14));
15209 val = alc_read_coef_idx(codec, 0x4); /* HP */
15210 alc_write_coef_idx(codec, 0x4, val | (1<<11));
15215 static int patch_alc269(struct hda_codec *codec)
15217 struct alc_spec *spec;
15218 int board_config, coef;
15221 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15225 codec->spec = spec;
15227 alc_auto_parse_customize_define(codec);
15229 if (codec->vendor_id == 0x10ec0269) {
15230 coef = alc_read_coef_idx(codec, 0);
15231 if ((coef & 0x00f0) == 0x0010) {
15232 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15233 spec->cdefine.platform_type == 1) {
15234 alc_codec_rename(codec, "ALC271X");
15235 spec->codec_variant = ALC269_TYPE_ALC271X;
15236 } else if ((coef & 0xf000) == 0x1000) {
15237 spec->codec_variant = ALC269_TYPE_ALC270;
15238 } else if ((coef & 0xf000) == 0x2000) {
15239 alc_codec_rename(codec, "ALC259");
15240 spec->codec_variant = ALC269_TYPE_ALC259;
15241 } else if ((coef & 0xf000) == 0x3000) {
15242 alc_codec_rename(codec, "ALC258");
15243 spec->codec_variant = ALC269_TYPE_ALC258;
15245 alc_codec_rename(codec, "ALC269VB");
15246 spec->codec_variant = ALC269_TYPE_ALC269VB;
15249 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15250 alc269_fill_coef(codec);
15253 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15257 if (board_config < 0) {
15258 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15260 board_config = ALC269_AUTO;
15263 if (board_config == ALC269_AUTO) {
15264 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15265 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15268 if (board_config == ALC269_AUTO) {
15269 /* automatic parse from the BIOS config */
15270 err = alc269_parse_auto_config(codec);
15276 "hda_codec: Cannot set up configuration "
15277 "from BIOS. Using base mode...\n");
15278 board_config = ALC269_BASIC;
15282 if (has_cdefine_beep(codec)) {
15283 err = snd_hda_attach_beep_device(codec, 0x1);
15290 if (board_config != ALC269_AUTO)
15291 setup_preset(codec, &alc269_presets[board_config]);
15293 if (board_config == ALC269_QUANTA_FL1) {
15294 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15295 * fix the sample rate of analog I/O to 44.1kHz
15297 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15298 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15299 } else if (spec->dual_adc_switch) {
15300 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15301 /* switch ADC dynamically */
15302 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15304 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15305 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15307 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15308 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15310 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15311 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15312 spec->adc_nids = alc269_adc_nids;
15313 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15314 spec->capsrc_nids = alc269_capsrc_nids;
15316 spec->adc_nids = alc269vb_adc_nids;
15317 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15318 spec->capsrc_nids = alc269vb_capsrc_nids;
15322 if (!spec->cap_mixer)
15323 set_capture_mixer(codec);
15324 if (has_cdefine_beep(codec))
15325 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15327 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15329 spec->vmaster_nid = 0x02;
15331 codec->patch_ops = alc_patch_ops;
15332 #ifdef SND_HDA_NEEDS_RESUME
15333 codec->patch_ops.resume = alc269_resume;
15335 if (board_config == ALC269_AUTO)
15336 spec->init_hook = alc269_auto_init;
15337 spec->shutup = alc269_shutup;
15339 alc_init_jacks(codec);
15340 #ifdef CONFIG_SND_HDA_POWER_SAVE
15341 if (!spec->loopback.amplist)
15342 spec->loopback.amplist = alc269_loopbacks;
15343 if (alc269_mic2_for_mute_led(codec))
15344 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15351 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15355 * set the path ways for 2 channel output
15356 * need to set the codec line out and mic 1 pin widgets to inputs
15358 static const struct hda_verb alc861_threestack_ch2_init[] = {
15359 /* set pin widget 1Ah (line in) for input */
15360 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15361 /* set pin widget 18h (mic1/2) for input, for mic also enable
15364 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15366 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15368 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15369 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15375 * need to set the codec line out and mic 1 pin widgets to outputs
15377 static const struct hda_verb alc861_threestack_ch6_init[] = {
15378 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15379 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15380 /* set pin widget 18h (mic1) for output (CLFE)*/
15381 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15383 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15384 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15386 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15388 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15389 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15394 static const struct hda_channel_mode alc861_threestack_modes[2] = {
15395 { 2, alc861_threestack_ch2_init },
15396 { 6, alc861_threestack_ch6_init },
15398 /* Set mic1 as input and unmute the mixer */
15399 static const struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15400 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15401 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15404 /* Set mic1 as output and mute mixer */
15405 static const struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15406 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15407 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15411 static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15412 { 2, alc861_uniwill_m31_ch2_init },
15413 { 4, alc861_uniwill_m31_ch4_init },
15416 /* Set mic1 and line-in as input and unmute the mixer */
15417 static const struct hda_verb alc861_asus_ch2_init[] = {
15418 /* set pin widget 1Ah (line in) for input */
15419 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15420 /* set pin widget 18h (mic1/2) for input, for mic also enable
15423 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15425 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15428 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15432 /* Set mic1 nad line-in as output and mute mixer */
15433 static const struct hda_verb alc861_asus_ch6_init[] = {
15434 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15435 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15436 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15437 /* set pin widget 18h (mic1) for output (CLFE)*/
15438 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15439 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15440 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15441 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15443 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15445 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15446 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15451 static const struct hda_channel_mode alc861_asus_modes[2] = {
15452 { 2, alc861_asus_ch2_init },
15453 { 6, alc861_asus_ch6_init },
15458 static const struct snd_kcontrol_new alc861_base_mixer[] = {
15459 /* output mixer control */
15460 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15461 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15462 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15463 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15464 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15466 /*Input mixer control */
15467 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15468 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15469 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15470 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15471 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15472 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15474 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15475 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15476 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15481 static const struct snd_kcontrol_new alc861_3ST_mixer[] = {
15482 /* output mixer control */
15483 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15484 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15485 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15486 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15487 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15489 /* Input mixer control */
15490 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15491 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15492 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15493 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15494 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15495 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15496 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15497 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15498 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15502 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15503 .name = "Channel Mode",
15504 .info = alc_ch_mode_info,
15505 .get = alc_ch_mode_get,
15506 .put = alc_ch_mode_put,
15507 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15512 static const struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15513 /* output mixer control */
15514 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15516 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15521 static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15522 /* output mixer control */
15523 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15524 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15525 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15526 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15527 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15529 /* Input mixer control */
15530 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15531 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15532 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15533 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15534 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15535 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15537 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15538 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15542 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15543 .name = "Channel Mode",
15544 .info = alc_ch_mode_info,
15545 .get = alc_ch_mode_get,
15546 .put = alc_ch_mode_put,
15547 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15552 static const struct snd_kcontrol_new alc861_asus_mixer[] = {
15553 /* output mixer control */
15554 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15555 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15556 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15557 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15558 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15560 /* Input mixer control */
15561 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15562 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15563 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15564 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15565 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15566 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15568 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15569 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15570 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15573 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15574 .name = "Channel Mode",
15575 .info = alc_ch_mode_info,
15576 .get = alc_ch_mode_get,
15577 .put = alc_ch_mode_put,
15578 .private_value = ARRAY_SIZE(alc861_asus_modes),
15583 /* additional mixer */
15584 static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15585 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15586 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15591 * generic initialization of ADC, input mixers and output mixers
15593 static const struct hda_verb alc861_base_init_verbs[] = {
15595 * Unmute ADC0 and set the default input to mic-in
15597 /* port-A for surround (rear panel) */
15598 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15599 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15600 /* port-B for mic-in (rear panel) with vref */
15601 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15602 /* port-C for line-in (rear panel) */
15603 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15604 /* port-D for Front */
15605 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15606 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15607 /* port-E for HP out (front panel) */
15608 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15609 /* route front PCM to HP */
15610 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15611 /* port-F for mic-in (front panel) with vref */
15612 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15613 /* port-G for CLFE (rear panel) */
15614 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15615 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15616 /* port-H for side (rear panel) */
15617 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15618 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15620 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15621 /* route front mic to ADC1*/
15622 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15625 /* Unmute DAC0~3 & spdif out*/
15626 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15627 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15628 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15629 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15632 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15633 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15634 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15635 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15636 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15638 /* Unmute Stereo Mixer 15 */
15639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15646 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15647 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15648 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15649 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15650 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15651 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15652 /* hp used DAC 3 (Front) */
15653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15654 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15659 static const struct hda_verb alc861_threestack_init_verbs[] = {
15661 * Unmute ADC0 and set the default input to mic-in
15663 /* port-A for surround (rear panel) */
15664 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15665 /* port-B for mic-in (rear panel) with vref */
15666 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15667 /* port-C for line-in (rear panel) */
15668 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15669 /* port-D for Front */
15670 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15671 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15672 /* port-E for HP out (front panel) */
15673 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15674 /* route front PCM to HP */
15675 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15676 /* port-F for mic-in (front panel) with vref */
15677 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15678 /* port-G for CLFE (rear panel) */
15679 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15680 /* port-H for side (rear panel) */
15681 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15683 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15684 /* route front mic to ADC1*/
15685 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15686 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15687 /* Unmute DAC0~3 & spdif out*/
15688 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15689 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15690 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15691 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15694 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15695 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15696 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15697 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15698 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15700 /* Unmute Stereo Mixer 15 */
15701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15702 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15706 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15708 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15709 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15710 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15711 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15712 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15713 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15714 /* hp used DAC 3 (Front) */
15715 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15716 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15720 static const struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15722 * Unmute ADC0 and set the default input to mic-in
15724 /* port-A for surround (rear panel) */
15725 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15726 /* port-B for mic-in (rear panel) with vref */
15727 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15728 /* port-C for line-in (rear panel) */
15729 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15730 /* port-D for Front */
15731 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15732 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15733 /* port-E for HP out (front panel) */
15734 /* this has to be set to VREF80 */
15735 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15736 /* route front PCM to HP */
15737 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15738 /* port-F for mic-in (front panel) with vref */
15739 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15740 /* port-G for CLFE (rear panel) */
15741 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15742 /* port-H for side (rear panel) */
15743 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15745 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15746 /* route front mic to ADC1*/
15747 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15748 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15749 /* Unmute DAC0~3 & spdif out*/
15750 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15751 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15752 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15753 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15756 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15757 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15758 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15759 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15760 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15762 /* Unmute Stereo Mixer 15 */
15763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15764 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15768 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15769 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15770 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15771 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15772 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15774 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15775 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15776 /* hp used DAC 3 (Front) */
15777 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15778 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15782 static const struct hda_verb alc861_asus_init_verbs[] = {
15784 * Unmute ADC0 and set the default input to mic-in
15786 /* port-A for surround (rear panel)
15787 * according to codec#0 this is the HP jack
15789 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15790 /* route front PCM to HP */
15791 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15792 /* port-B for mic-in (rear panel) with vref */
15793 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15794 /* port-C for line-in (rear panel) */
15795 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15796 /* port-D for Front */
15797 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15798 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15799 /* port-E for HP out (front panel) */
15800 /* this has to be set to VREF80 */
15801 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15802 /* route front PCM to HP */
15803 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15804 /* port-F for mic-in (front panel) with vref */
15805 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15806 /* port-G for CLFE (rear panel) */
15807 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15808 /* port-H for side (rear panel) */
15809 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15811 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15812 /* route front mic to ADC1*/
15813 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15814 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15815 /* Unmute DAC0~3 & spdif out*/
15816 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15817 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15818 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15819 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15821 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15822 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15823 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15824 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15825 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15827 /* Unmute Stereo Mixer 15 */
15828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15831 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15835 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15836 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15840 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15841 /* hp used DAC 3 (Front) */
15842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15843 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15847 /* additional init verbs for ASUS laptops */
15848 static const struct hda_verb alc861_asus_laptop_init_verbs[] = {
15849 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15850 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15855 * generic initialization of ADC, input mixers and output mixers
15857 static const struct hda_verb alc861_auto_init_verbs[] = {
15859 * Unmute ADC0 and set the default input to mic-in
15861 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15862 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15864 /* Unmute DAC0~3 & spdif out*/
15865 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15866 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15867 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15868 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15869 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15871 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15872 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15873 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15874 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15875 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15877 /* Unmute Stereo Mixer 15 */
15878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15880 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15885 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15886 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15887 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15888 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15889 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15890 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15894 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15895 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15896 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15897 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15898 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15899 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15901 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15906 static const struct hda_verb alc861_toshiba_init_verbs[] = {
15907 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15912 /* toggle speaker-output according to the hp-jack state */
15913 static void alc861_toshiba_automute(struct hda_codec *codec)
15915 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15917 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15918 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15919 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15920 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15923 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15926 if ((res >> 26) == ALC880_HP_EVENT)
15927 alc861_toshiba_automute(codec);
15930 /* pcm configuration: identical with ALC880 */
15931 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15932 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15933 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15934 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15937 #define ALC861_DIGOUT_NID 0x07
15939 static const struct hda_channel_mode alc861_8ch_modes[1] = {
15943 static const hda_nid_t alc861_dac_nids[4] = {
15944 /* front, surround, clfe, side */
15945 0x03, 0x06, 0x05, 0x04
15948 static const hda_nid_t alc660_dac_nids[3] = {
15949 /* front, clfe, surround */
15953 static const hda_nid_t alc861_adc_nids[1] = {
15958 static const struct hda_input_mux alc861_capture_source = {
15962 { "Front Mic", 0x3 },
15969 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15971 struct alc_spec *spec = codec->spec;
15972 hda_nid_t mix, srcs[5];
15975 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15977 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15980 for (i = 0; i < num; i++) {
15982 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15983 if (type != AC_WID_AUD_OUT)
15985 for (j = 0; j < spec->multiout.num_dacs; j++)
15986 if (spec->multiout.dac_nids[j] == srcs[i])
15988 if (j >= spec->multiout.num_dacs)
15994 /* fill in the dac_nids table from the parsed pin configuration */
15995 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15996 const struct auto_pin_cfg *cfg)
15998 struct alc_spec *spec = codec->spec;
16000 hda_nid_t nid, dac;
16002 spec->multiout.dac_nids = spec->private_dac_nids;
16003 for (i = 0; i < cfg->line_outs; i++) {
16004 nid = cfg->line_out_pins[i];
16005 dac = alc861_look_for_dac(codec, nid);
16008 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
16013 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
16014 hda_nid_t nid, int idx, unsigned int chs)
16016 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
16017 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
16020 #define alc861_create_out_sw(codec, pfx, nid, chs) \
16021 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
16023 /* add playback controls from the parsed DAC table */
16024 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16025 const struct auto_pin_cfg *cfg)
16027 struct alc_spec *spec = codec->spec;
16028 static const char * const chname[4] = {
16029 "Front", "Surround", NULL /*CLFE*/, "Side"
16031 const char *pfx = alc_get_line_out_pfx(spec, true);
16033 int i, err, noutputs;
16035 noutputs = cfg->line_outs;
16036 if (spec->multi_ios > 0)
16037 noutputs += spec->multi_ios;
16039 for (i = 0; i < noutputs; i++) {
16040 nid = spec->multiout.dac_nids[i];
16043 if (!pfx && i == 2) {
16045 err = alc861_create_out_sw(codec, "Center", nid, 1);
16048 err = alc861_create_out_sw(codec, "LFE", nid, 2);
16052 const char *name = pfx;
16058 err = __alc861_create_out_sw(codec, name, nid, index, 3);
16066 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
16068 struct alc_spec *spec = codec->spec;
16075 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
16076 nid = alc861_look_for_dac(codec, pin);
16078 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
16081 spec->multiout.hp_nid = nid;
16087 /* create playback/capture controls for input pins */
16088 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
16089 const struct auto_pin_cfg *cfg)
16091 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
16094 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
16096 int pin_type, hda_nid_t dac)
16098 hda_nid_t mix, srcs[5];
16101 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
16103 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16105 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
16107 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
16110 for (i = 0; i < num; i++) {
16112 if (srcs[i] == dac || srcs[i] == 0x15)
16113 mute = AMP_IN_UNMUTE(i);
16115 mute = AMP_IN_MUTE(i);
16116 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16121 static void alc861_auto_init_multi_out(struct hda_codec *codec)
16123 struct alc_spec *spec = codec->spec;
16126 for (i = 0; i < spec->autocfg.line_outs; i++) {
16127 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16128 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16130 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
16131 spec->multiout.dac_nids[i]);
16135 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16137 struct alc_spec *spec = codec->spec;
16139 if (spec->autocfg.hp_outs)
16140 alc861_auto_set_output_and_unmute(codec,
16141 spec->autocfg.hp_pins[0],
16143 spec->multiout.hp_nid);
16144 if (spec->autocfg.speaker_outs)
16145 alc861_auto_set_output_and_unmute(codec,
16146 spec->autocfg.speaker_pins[0],
16148 spec->multiout.dac_nids[0]);
16151 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16153 struct alc_spec *spec = codec->spec;
16154 struct auto_pin_cfg *cfg = &spec->autocfg;
16157 for (i = 0; i < cfg->num_inputs; i++) {
16158 hda_nid_t nid = cfg->inputs[i].pin;
16159 if (nid >= 0x0c && nid <= 0x11)
16160 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16164 /* parse the BIOS configuration and set up the alc_spec */
16165 /* return 1 if successful, 0 if the proper config is not found,
16166 * or a negative error code
16168 static int alc861_parse_auto_config(struct hda_codec *codec)
16170 struct alc_spec *spec = codec->spec;
16172 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16174 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16178 if (!spec->autocfg.line_outs)
16179 return 0; /* can't find valid BIOS pin config */
16181 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16184 err = alc_auto_add_multi_channel_mode(codec);
16187 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16190 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16193 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16197 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16199 alc_auto_parse_digital(codec);
16201 if (spec->kctls.list)
16202 add_mixer(spec, spec->kctls.list);
16204 add_verb(spec, alc861_auto_init_verbs);
16206 spec->num_mux_defs = 1;
16207 spec->input_mux = &spec->private_imux[0];
16209 spec->adc_nids = alc861_adc_nids;
16210 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16211 set_capture_mixer(codec);
16213 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16218 /* additional initialization for auto-configuration model */
16219 static void alc861_auto_init(struct hda_codec *codec)
16221 struct alc_spec *spec = codec->spec;
16222 alc861_auto_init_multi_out(codec);
16223 alc861_auto_init_hp_out(codec);
16224 alc861_auto_init_analog_input(codec);
16225 alc_auto_init_digital(codec);
16226 if (spec->unsol_event)
16227 alc_inithook(codec);
16230 #ifdef CONFIG_SND_HDA_POWER_SAVE
16231 static const struct hda_amp_list alc861_loopbacks[] = {
16232 { 0x15, HDA_INPUT, 0 },
16233 { 0x15, HDA_INPUT, 1 },
16234 { 0x15, HDA_INPUT, 2 },
16235 { 0x15, HDA_INPUT, 3 },
16242 * configuration and preset
16244 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16245 [ALC861_3ST] = "3stack",
16246 [ALC660_3ST] = "3stack-660",
16247 [ALC861_3ST_DIG] = "3stack-dig",
16248 [ALC861_6ST_DIG] = "6stack-dig",
16249 [ALC861_UNIWILL_M31] = "uniwill-m31",
16250 [ALC861_TOSHIBA] = "toshiba",
16251 [ALC861_ASUS] = "asus",
16252 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16253 [ALC861_AUTO] = "auto",
16256 static const struct snd_pci_quirk alc861_cfg_tbl[] = {
16257 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16258 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16259 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16260 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16261 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16262 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16263 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16264 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16265 * Any other models that need this preset?
16267 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16268 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16269 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16270 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16271 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16272 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16273 /* FIXME: the below seems conflict */
16274 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16275 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16276 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16280 static const struct alc_config_preset alc861_presets[] = {
16282 .mixers = { alc861_3ST_mixer },
16283 .init_verbs = { alc861_threestack_init_verbs },
16284 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16285 .dac_nids = alc861_dac_nids,
16286 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16287 .channel_mode = alc861_threestack_modes,
16289 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16290 .adc_nids = alc861_adc_nids,
16291 .input_mux = &alc861_capture_source,
16293 [ALC861_3ST_DIG] = {
16294 .mixers = { alc861_base_mixer },
16295 .init_verbs = { alc861_threestack_init_verbs },
16296 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16297 .dac_nids = alc861_dac_nids,
16298 .dig_out_nid = ALC861_DIGOUT_NID,
16299 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16300 .channel_mode = alc861_threestack_modes,
16302 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16303 .adc_nids = alc861_adc_nids,
16304 .input_mux = &alc861_capture_source,
16306 [ALC861_6ST_DIG] = {
16307 .mixers = { alc861_base_mixer },
16308 .init_verbs = { alc861_base_init_verbs },
16309 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16310 .dac_nids = alc861_dac_nids,
16311 .dig_out_nid = ALC861_DIGOUT_NID,
16312 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16313 .channel_mode = alc861_8ch_modes,
16314 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16315 .adc_nids = alc861_adc_nids,
16316 .input_mux = &alc861_capture_source,
16319 .mixers = { alc861_3ST_mixer },
16320 .init_verbs = { alc861_threestack_init_verbs },
16321 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16322 .dac_nids = alc660_dac_nids,
16323 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16324 .channel_mode = alc861_threestack_modes,
16326 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16327 .adc_nids = alc861_adc_nids,
16328 .input_mux = &alc861_capture_source,
16330 [ALC861_UNIWILL_M31] = {
16331 .mixers = { alc861_uniwill_m31_mixer },
16332 .init_verbs = { alc861_uniwill_m31_init_verbs },
16333 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16334 .dac_nids = alc861_dac_nids,
16335 .dig_out_nid = ALC861_DIGOUT_NID,
16336 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16337 .channel_mode = alc861_uniwill_m31_modes,
16339 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16340 .adc_nids = alc861_adc_nids,
16341 .input_mux = &alc861_capture_source,
16343 [ALC861_TOSHIBA] = {
16344 .mixers = { alc861_toshiba_mixer },
16345 .init_verbs = { alc861_base_init_verbs,
16346 alc861_toshiba_init_verbs },
16347 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16348 .dac_nids = alc861_dac_nids,
16349 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16350 .channel_mode = alc883_3ST_2ch_modes,
16351 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16352 .adc_nids = alc861_adc_nids,
16353 .input_mux = &alc861_capture_source,
16354 .unsol_event = alc861_toshiba_unsol_event,
16355 .init_hook = alc861_toshiba_automute,
16358 .mixers = { alc861_asus_mixer },
16359 .init_verbs = { alc861_asus_init_verbs },
16360 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16361 .dac_nids = alc861_dac_nids,
16362 .dig_out_nid = ALC861_DIGOUT_NID,
16363 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16364 .channel_mode = alc861_asus_modes,
16367 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16368 .adc_nids = alc861_adc_nids,
16369 .input_mux = &alc861_capture_source,
16371 [ALC861_ASUS_LAPTOP] = {
16372 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16373 .init_verbs = { alc861_asus_init_verbs,
16374 alc861_asus_laptop_init_verbs },
16375 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16376 .dac_nids = alc861_dac_nids,
16377 .dig_out_nid = ALC861_DIGOUT_NID,
16378 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16379 .channel_mode = alc883_3ST_2ch_modes,
16381 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16382 .adc_nids = alc861_adc_nids,
16383 .input_mux = &alc861_capture_source,
16387 /* Pin config fixes */
16389 PINFIX_FSC_AMILO_PI1505,
16392 static const struct alc_fixup alc861_fixups[] = {
16393 [PINFIX_FSC_AMILO_PI1505] = {
16394 .type = ALC_FIXUP_PINS,
16395 .v.pins = (const struct alc_pincfg[]) {
16396 { 0x0b, 0x0221101f }, /* HP */
16397 { 0x0f, 0x90170310 }, /* speaker */
16403 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
16404 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16408 static int patch_alc861(struct hda_codec *codec)
16410 struct alc_spec *spec;
16414 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16418 codec->spec = spec;
16420 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16424 if (board_config < 0) {
16425 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16427 board_config = ALC861_AUTO;
16430 if (board_config == ALC861_AUTO) {
16431 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16432 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16435 if (board_config == ALC861_AUTO) {
16436 /* automatic parse from the BIOS config */
16437 err = alc861_parse_auto_config(codec);
16443 "hda_codec: Cannot set up configuration "
16444 "from BIOS. Using base mode...\n");
16445 board_config = ALC861_3ST_DIG;
16449 err = snd_hda_attach_beep_device(codec, 0x23);
16455 if (board_config != ALC861_AUTO)
16456 setup_preset(codec, &alc861_presets[board_config]);
16458 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16459 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16461 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16462 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16464 if (!spec->cap_mixer)
16465 set_capture_mixer(codec);
16466 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16468 spec->vmaster_nid = 0x03;
16470 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16472 codec->patch_ops = alc_patch_ops;
16473 if (board_config == ALC861_AUTO) {
16474 spec->init_hook = alc861_auto_init;
16475 #ifdef CONFIG_SND_HDA_POWER_SAVE
16476 spec->power_hook = alc_power_eapd;
16479 #ifdef CONFIG_SND_HDA_POWER_SAVE
16480 if (!spec->loopback.amplist)
16481 spec->loopback.amplist = alc861_loopbacks;
16488 * ALC861-VD support
16492 * In addition, an independent DAC
16494 #define ALC861VD_DIGOUT_NID 0x06
16496 static const hda_nid_t alc861vd_dac_nids[4] = {
16497 /* front, surr, clfe, side surr */
16498 0x02, 0x03, 0x04, 0x05
16501 /* dac_nids for ALC660vd are in a different order - according to
16502 * Realtek's driver.
16503 * This should probably result in a different mixer for 6stack models
16504 * of ALC660vd codecs, but for now there is only 3stack mixer
16505 * - and it is the same as in 861vd.
16506 * adc_nids in ALC660vd are (is) the same as in 861vd
16508 static const hda_nid_t alc660vd_dac_nids[3] = {
16509 /* front, rear, clfe, rear_surr */
16513 static const hda_nid_t alc861vd_adc_nids[1] = {
16518 static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16521 /* FIXME: should be a matrix-type input source selection */
16522 static const struct hda_input_mux alc861vd_capture_source = {
16526 { "Front Mic", 0x1 },
16532 static const struct hda_input_mux alc861vd_dallas_capture_source = {
16536 { "Internal Mic", 0x1 },
16540 static const struct hda_input_mux alc861vd_hp_capture_source = {
16543 { "Front Mic", 0x0 },
16544 { "ATAPI Mic", 0x1 },
16551 static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16558 static const struct hda_verb alc861vd_6stack_ch6_init[] = {
16559 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16560 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16561 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16562 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16569 static const struct hda_verb alc861vd_6stack_ch8_init[] = {
16570 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16571 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16572 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16573 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16577 static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
16578 { 6, alc861vd_6stack_ch6_init },
16579 { 8, alc861vd_6stack_ch8_init },
16582 static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16585 .name = "Channel Mode",
16586 .info = alc_ch_mode_info,
16587 .get = alc_ch_mode_get,
16588 .put = alc_ch_mode_put,
16593 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16594 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16596 static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16597 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16598 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16600 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16601 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16603 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16605 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16607 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16608 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16610 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16611 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16615 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16619 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16620 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16621 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16623 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16624 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16626 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16627 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16632 static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16633 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16634 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16638 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16639 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16642 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16643 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16644 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16646 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16647 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16649 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16650 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16655 static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16656 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16657 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16658 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16660 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16662 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16664 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16666 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16667 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16668 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16670 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16671 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16676 /* Pin assignment: Speaker=0x14, HP = 0x15,
16677 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16679 static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16680 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16681 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16682 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16683 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16684 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16687 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16688 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16689 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16693 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16694 * Front Mic=0x18, ATAPI Mic = 0x19,
16696 static const struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16697 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16698 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16699 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16700 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16701 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16702 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16703 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16704 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16710 * generic initialization of ADC, input mixers and output mixers
16712 static const struct hda_verb alc861vd_volume_init_verbs[] = {
16714 * Unmute ADC0 and set the default input to mic-in
16716 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16719 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16720 * the analog-loopback mixer widget
16722 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16729 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16731 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16732 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16733 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16736 * Set up output mixers (0x02 - 0x05)
16738 /* set vol=0 to output mixers */
16739 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16740 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16741 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16742 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16744 /* set up input amps for analog loopback */
16745 /* Amp Indices: DAC = 0, mixer = 1 */
16746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16750 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16752 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16753 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16759 * 3-stack pin configuration:
16760 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16762 static const struct hda_verb alc861vd_3stack_init_verbs[] = {
16764 * Set pin mode and muting
16766 /* set front pin widgets 0x14 for output */
16767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16769 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16771 /* Mic (rear) pin: input vref at 80% */
16772 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16773 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16774 /* Front Mic pin: input vref at 80% */
16775 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16777 /* Line In pin: input */
16778 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16779 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16780 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16782 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16783 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16784 /* CD pin widget for input */
16785 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16791 * 6-stack pin configuration:
16793 static const struct hda_verb alc861vd_6stack_init_verbs[] = {
16795 * Set pin mode and muting
16797 /* set front pin widgets 0x14 for output */
16798 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16799 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16800 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16802 /* Rear Pin: output 1 (0x0d) */
16803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16805 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16806 /* CLFE Pin: output 2 (0x0e) */
16807 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16808 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16809 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16810 /* Side Pin: output 3 (0x0f) */
16811 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16812 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16813 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16815 /* Mic (rear) pin: input vref at 80% */
16816 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16817 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16818 /* Front Mic pin: input vref at 80% */
16819 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16820 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16821 /* Line In pin: input */
16822 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16823 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16824 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16827 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16828 /* CD pin widget for input */
16829 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16834 static const struct hda_verb alc861vd_eapd_verbs[] = {
16835 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16839 static const struct hda_verb alc660vd_eapd_verbs[] = {
16840 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16841 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16845 static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16849 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16850 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16854 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16856 struct alc_spec *spec = codec->spec;
16857 spec->autocfg.hp_pins[0] = 0x1b;
16858 spec->autocfg.speaker_pins[0] = 0x14;
16859 spec->automute = 1;
16860 spec->automute_mode = ALC_AUTOMUTE_AMP;
16863 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16865 alc_hp_automute(codec);
16866 alc88x_simple_mic_automute(codec);
16869 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16872 switch (res >> 26) {
16873 case ALC880_MIC_EVENT:
16874 alc88x_simple_mic_automute(codec);
16877 alc_sku_unsol_event(codec, res);
16882 static const struct hda_verb alc861vd_dallas_verbs[] = {
16883 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16884 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16885 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16886 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16889 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16890 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16891 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16894 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16895 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16898 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16901 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16902 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16903 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16904 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16906 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16907 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16908 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16909 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16912 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16913 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16918 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16920 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16921 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16922 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16927 /* toggle speaker-output according to the hp-jack state */
16928 static void alc861vd_dallas_setup(struct hda_codec *codec)
16930 struct alc_spec *spec = codec->spec;
16932 spec->autocfg.hp_pins[0] = 0x15;
16933 spec->autocfg.speaker_pins[0] = 0x14;
16934 spec->automute = 1;
16935 spec->automute_mode = ALC_AUTOMUTE_AMP;
16938 #ifdef CONFIG_SND_HDA_POWER_SAVE
16939 #define alc861vd_loopbacks alc880_loopbacks
16942 /* pcm configuration: identical with ALC880 */
16943 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16944 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16945 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16946 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16949 * configuration and preset
16951 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16952 [ALC660VD_3ST] = "3stack-660",
16953 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16954 [ALC660VD_ASUS_V1S] = "asus-v1s",
16955 [ALC861VD_3ST] = "3stack",
16956 [ALC861VD_3ST_DIG] = "3stack-digout",
16957 [ALC861VD_6ST_DIG] = "6stack-digout",
16958 [ALC861VD_LENOVO] = "lenovo",
16959 [ALC861VD_DALLAS] = "dallas",
16960 [ALC861VD_HP] = "hp",
16961 [ALC861VD_AUTO] = "auto",
16964 static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16965 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16966 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16967 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16968 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16969 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16970 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16971 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16972 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16973 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16974 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16975 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16976 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16977 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16978 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16979 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16983 static const struct alc_config_preset alc861vd_presets[] = {
16985 .mixers = { alc861vd_3st_mixer },
16986 .init_verbs = { alc861vd_volume_init_verbs,
16987 alc861vd_3stack_init_verbs },
16988 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16989 .dac_nids = alc660vd_dac_nids,
16990 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16991 .channel_mode = alc861vd_3stack_2ch_modes,
16992 .input_mux = &alc861vd_capture_source,
16994 [ALC660VD_3ST_DIG] = {
16995 .mixers = { alc861vd_3st_mixer },
16996 .init_verbs = { alc861vd_volume_init_verbs,
16997 alc861vd_3stack_init_verbs },
16998 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16999 .dac_nids = alc660vd_dac_nids,
17000 .dig_out_nid = ALC861VD_DIGOUT_NID,
17001 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17002 .channel_mode = alc861vd_3stack_2ch_modes,
17003 .input_mux = &alc861vd_capture_source,
17006 .mixers = { alc861vd_3st_mixer },
17007 .init_verbs = { alc861vd_volume_init_verbs,
17008 alc861vd_3stack_init_verbs },
17009 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17010 .dac_nids = alc861vd_dac_nids,
17011 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17012 .channel_mode = alc861vd_3stack_2ch_modes,
17013 .input_mux = &alc861vd_capture_source,
17015 [ALC861VD_3ST_DIG] = {
17016 .mixers = { alc861vd_3st_mixer },
17017 .init_verbs = { alc861vd_volume_init_verbs,
17018 alc861vd_3stack_init_verbs },
17019 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17020 .dac_nids = alc861vd_dac_nids,
17021 .dig_out_nid = ALC861VD_DIGOUT_NID,
17022 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17023 .channel_mode = alc861vd_3stack_2ch_modes,
17024 .input_mux = &alc861vd_capture_source,
17026 [ALC861VD_6ST_DIG] = {
17027 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
17028 .init_verbs = { alc861vd_volume_init_verbs,
17029 alc861vd_6stack_init_verbs },
17030 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17031 .dac_nids = alc861vd_dac_nids,
17032 .dig_out_nid = ALC861VD_DIGOUT_NID,
17033 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
17034 .channel_mode = alc861vd_6stack_modes,
17035 .input_mux = &alc861vd_capture_source,
17037 [ALC861VD_LENOVO] = {
17038 .mixers = { alc861vd_lenovo_mixer },
17039 .init_verbs = { alc861vd_volume_init_verbs,
17040 alc861vd_3stack_init_verbs,
17041 alc861vd_eapd_verbs,
17042 alc861vd_lenovo_unsol_verbs },
17043 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17044 .dac_nids = alc660vd_dac_nids,
17045 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17046 .channel_mode = alc861vd_3stack_2ch_modes,
17047 .input_mux = &alc861vd_capture_source,
17048 .unsol_event = alc861vd_lenovo_unsol_event,
17049 .setup = alc861vd_lenovo_setup,
17050 .init_hook = alc861vd_lenovo_init_hook,
17052 [ALC861VD_DALLAS] = {
17053 .mixers = { alc861vd_dallas_mixer },
17054 .init_verbs = { alc861vd_dallas_verbs },
17055 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17056 .dac_nids = alc861vd_dac_nids,
17057 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17058 .channel_mode = alc861vd_3stack_2ch_modes,
17059 .input_mux = &alc861vd_dallas_capture_source,
17060 .unsol_event = alc_sku_unsol_event,
17061 .setup = alc861vd_dallas_setup,
17062 .init_hook = alc_hp_automute,
17065 .mixers = { alc861vd_hp_mixer },
17066 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
17067 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
17068 .dac_nids = alc861vd_dac_nids,
17069 .dig_out_nid = ALC861VD_DIGOUT_NID,
17070 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17071 .channel_mode = alc861vd_3stack_2ch_modes,
17072 .input_mux = &alc861vd_hp_capture_source,
17073 .unsol_event = alc_sku_unsol_event,
17074 .setup = alc861vd_dallas_setup,
17075 .init_hook = alc_hp_automute,
17077 [ALC660VD_ASUS_V1S] = {
17078 .mixers = { alc861vd_lenovo_mixer },
17079 .init_verbs = { alc861vd_volume_init_verbs,
17080 alc861vd_3stack_init_verbs,
17081 alc861vd_eapd_verbs,
17082 alc861vd_lenovo_unsol_verbs },
17083 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
17084 .dac_nids = alc660vd_dac_nids,
17085 .dig_out_nid = ALC861VD_DIGOUT_NID,
17086 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17087 .channel_mode = alc861vd_3stack_2ch_modes,
17088 .input_mux = &alc861vd_capture_source,
17089 .unsol_event = alc861vd_lenovo_unsol_event,
17090 .setup = alc861vd_lenovo_setup,
17091 .init_hook = alc861vd_lenovo_init_hook,
17096 * BIOS auto configuration
17098 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
17099 const struct auto_pin_cfg *cfg)
17101 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
17105 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
17106 hda_nid_t nid, int pin_type, int dac_idx)
17108 alc_set_pin_output(codec, nid, pin_type);
17111 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
17113 struct alc_spec *spec = codec->spec;
17116 for (i = 0; i <= HDA_SIDE; i++) {
17117 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17118 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17120 alc861vd_auto_set_output_and_unmute(codec, nid,
17126 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
17128 struct alc_spec *spec = codec->spec;
17131 pin = spec->autocfg.hp_pins[0];
17132 if (pin) /* connect to front and use dac 0 */
17133 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17134 pin = spec->autocfg.speaker_pins[0];
17136 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17139 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
17141 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17143 struct alc_spec *spec = codec->spec;
17144 struct auto_pin_cfg *cfg = &spec->autocfg;
17147 for (i = 0; i < cfg->num_inputs; i++) {
17148 hda_nid_t nid = cfg->inputs[i].pin;
17149 if (alc_is_input_pin(codec, nid)) {
17150 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17151 if (nid != ALC861VD_PIN_CD_NID &&
17152 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17153 snd_hda_codec_write(codec, nid, 0,
17154 AC_VERB_SET_AMP_GAIN_MUTE,
17160 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17162 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17163 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17165 /* add playback controls from the parsed DAC table */
17166 /* Based on ALC880 version. But ALC861VD has separate,
17167 * different NIDs for mute/unmute switch and volume control */
17168 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17169 const struct auto_pin_cfg *cfg)
17171 static const char * const chname[4] = {
17172 "Front", "Surround", "CLFE", "Side"
17174 const char *pfx = alc_get_line_out_pfx(spec, true);
17175 hda_nid_t nid_v, nid_s;
17176 int i, err, noutputs;
17178 noutputs = cfg->line_outs;
17179 if (spec->multi_ios > 0)
17180 noutputs += spec->multi_ios;
17182 for (i = 0; i < noutputs; i++) {
17183 if (!spec->multiout.dac_nids[i])
17185 nid_v = alc861vd_idx_to_mixer_vol(
17187 spec->multiout.dac_nids[i]));
17188 nid_s = alc861vd_idx_to_mixer_switch(
17190 spec->multiout.dac_nids[i]));
17192 if (!pfx && i == 2) {
17194 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17196 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17200 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17202 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17206 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17208 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17212 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17214 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17219 const char *name = pfx;
17225 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17227 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17231 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17233 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17242 /* add playback controls for speaker and HP outputs */
17243 /* Based on ALC880 version. But ALC861VD has separate,
17244 * different NIDs for mute/unmute switch and volume control */
17245 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17246 hda_nid_t pin, const char *pfx)
17248 hda_nid_t nid_v, nid_s;
17254 if (alc880_is_fixed_pin(pin)) {
17255 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17256 /* specify the DAC as the extra output */
17257 if (!spec->multiout.hp_nid)
17258 spec->multiout.hp_nid = nid_v;
17260 spec->multiout.extra_out_nid[0] = nid_v;
17261 /* control HP volume/switch on the output mixer amp */
17262 nid_v = alc861vd_idx_to_mixer_vol(
17263 alc880_fixed_pin_idx(pin));
17264 nid_s = alc861vd_idx_to_mixer_switch(
17265 alc880_fixed_pin_idx(pin));
17267 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17268 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17271 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17272 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17275 } else if (alc880_is_multi_pin(pin)) {
17276 /* set manual connection */
17277 /* we have only a switch on HP-out PIN */
17278 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17279 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17286 /* parse the BIOS configuration and set up the alc_spec
17287 * return 1 if successful, 0 if the proper config is not found,
17288 * or a negative error code
17289 * Based on ALC880 version - had to change it to override
17290 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17291 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17293 struct alc_spec *spec = codec->spec;
17295 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17297 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17301 if (!spec->autocfg.line_outs)
17302 return 0; /* can't find valid BIOS pin config */
17304 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17307 err = alc_auto_add_multi_channel_mode(codec);
17310 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17313 err = alc861vd_auto_create_extra_out(spec,
17314 spec->autocfg.speaker_pins[0],
17318 err = alc861vd_auto_create_extra_out(spec,
17319 spec->autocfg.hp_pins[0],
17323 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17327 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17329 alc_auto_parse_digital(codec);
17331 if (spec->kctls.list)
17332 add_mixer(spec, spec->kctls.list);
17334 add_verb(spec, alc861vd_volume_init_verbs);
17336 spec->num_mux_defs = 1;
17337 spec->input_mux = &spec->private_imux[0];
17339 err = alc_auto_add_mic_boost(codec);
17343 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17348 /* additional initialization for auto-configuration model */
17349 static void alc861vd_auto_init(struct hda_codec *codec)
17351 struct alc_spec *spec = codec->spec;
17352 alc861vd_auto_init_multi_out(codec);
17353 alc861vd_auto_init_hp_out(codec);
17354 alc861vd_auto_init_analog_input(codec);
17355 alc861vd_auto_init_input_src(codec);
17356 alc_auto_init_digital(codec);
17357 if (spec->unsol_event)
17358 alc_inithook(codec);
17362 ALC660VD_FIX_ASUS_GPIO1
17366 static const struct alc_fixup alc861vd_fixups[] = {
17367 [ALC660VD_FIX_ASUS_GPIO1] = {
17368 .type = ALC_FIXUP_VERBS,
17369 .v.verbs = (const struct hda_verb[]) {
17370 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17371 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17372 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17378 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17379 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17383 static int patch_alc861vd(struct hda_codec *codec)
17385 struct alc_spec *spec;
17386 int err, board_config;
17388 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17392 codec->spec = spec;
17394 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17398 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17399 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17401 board_config = ALC861VD_AUTO;
17404 if (board_config == ALC861VD_AUTO) {
17405 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17406 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17409 if (board_config == ALC861VD_AUTO) {
17410 /* automatic parse from the BIOS config */
17411 err = alc861vd_parse_auto_config(codec);
17417 "hda_codec: Cannot set up configuration "
17418 "from BIOS. Using base mode...\n");
17419 board_config = ALC861VD_3ST;
17423 err = snd_hda_attach_beep_device(codec, 0x23);
17429 if (board_config != ALC861VD_AUTO)
17430 setup_preset(codec, &alc861vd_presets[board_config]);
17432 if (codec->vendor_id == 0x10ec0660) {
17433 /* always turn on EAPD */
17434 add_verb(spec, alc660vd_eapd_verbs);
17437 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17438 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17440 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17441 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17443 if (!spec->adc_nids) {
17444 spec->adc_nids = alc861vd_adc_nids;
17445 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17447 if (!spec->capsrc_nids)
17448 spec->capsrc_nids = alc861vd_capsrc_nids;
17450 set_capture_mixer(codec);
17451 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17453 spec->vmaster_nid = 0x02;
17455 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17457 codec->patch_ops = alc_patch_ops;
17459 if (board_config == ALC861VD_AUTO)
17460 spec->init_hook = alc861vd_auto_init;
17461 spec->shutup = alc_eapd_shutup;
17462 #ifdef CONFIG_SND_HDA_POWER_SAVE
17463 if (!spec->loopback.amplist)
17464 spec->loopback.amplist = alc861vd_loopbacks;
17473 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17474 * configuration. Each pin widget can choose any input DACs and a mixer.
17475 * Each ADC is connected from a mixer of all inputs. This makes possible
17476 * 6-channel independent captures.
17478 * In addition, an independent DAC for the multi-playback (not used in this
17481 #define ALC662_DIGOUT_NID 0x06
17482 #define ALC662_DIGIN_NID 0x0a
17484 static const hda_nid_t alc662_dac_nids[3] = {
17485 /* front, rear, clfe */
17489 static const hda_nid_t alc272_dac_nids[2] = {
17493 static const hda_nid_t alc662_adc_nids[2] = {
17498 static const hda_nid_t alc272_adc_nids[1] = {
17503 static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17504 static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17508 /* FIXME: should be a matrix-type input source selection */
17509 static const struct hda_input_mux alc662_capture_source = {
17513 { "Front Mic", 0x1 },
17519 static const struct hda_input_mux alc662_lenovo_101e_capture_source = {
17527 static const struct hda_input_mux alc663_capture_source = {
17531 { "Front Mic", 0x1 },
17536 #if 0 /* set to 1 for testing other input sources below */
17537 static const struct hda_input_mux alc272_nc10_capture_source = {
17540 { "Autoselect Mic", 0x0 },
17541 { "Internal Mic", 0x1 },
17542 { "In-0x02", 0x2 },
17543 { "In-0x03", 0x3 },
17544 { "In-0x04", 0x4 },
17545 { "In-0x05", 0x5 },
17546 { "In-0x06", 0x6 },
17547 { "In-0x07", 0x7 },
17548 { "In-0x08", 0x8 },
17549 { "In-0x09", 0x9 },
17550 { "In-0x0a", 0x0a },
17551 { "In-0x0b", 0x0b },
17552 { "In-0x0c", 0x0c },
17553 { "In-0x0d", 0x0d },
17554 { "In-0x0e", 0x0e },
17555 { "In-0x0f", 0x0f },
17563 static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17570 static const struct hda_verb alc662_3ST_ch2_init[] = {
17571 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17572 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17573 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17574 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17581 static const struct hda_verb alc662_3ST_ch6_init[] = {
17582 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17583 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17584 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17585 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17586 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17587 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17591 static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17592 { 2, alc662_3ST_ch2_init },
17593 { 6, alc662_3ST_ch6_init },
17599 static const struct hda_verb alc662_sixstack_ch6_init[] = {
17600 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17601 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17602 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17609 static const struct hda_verb alc662_sixstack_ch8_init[] = {
17610 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17611 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17612 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17616 static const struct hda_channel_mode alc662_5stack_modes[2] = {
17617 { 2, alc662_sixstack_ch6_init },
17618 { 6, alc662_sixstack_ch8_init },
17621 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17622 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17625 static const struct snd_kcontrol_new alc662_base_mixer[] = {
17626 /* output mixer control */
17627 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17628 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17629 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17630 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17631 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17632 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17633 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17634 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17637 /*Input mixer control */
17638 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17639 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17640 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17641 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17642 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17643 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17645 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17649 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17650 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17651 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17657 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17658 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17659 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17660 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17664 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17665 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17666 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17667 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17668 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17669 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17670 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17671 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17672 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17673 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17674 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17675 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17676 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17677 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17680 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17681 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17685 static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17686 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17687 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17688 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17689 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17691 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17692 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17698 static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17699 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17700 ALC262_HIPPO_MASTER_SWITCH,
17702 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17703 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17704 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17706 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17707 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17708 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17712 static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17713 ALC262_HIPPO_MASTER_SWITCH,
17714 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17715 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17716 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17717 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17718 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17719 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17720 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17726 static const struct hda_bind_ctls alc663_asus_bind_master_vol = {
17727 .ops = &snd_hda_bind_vol,
17729 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17730 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17735 static const struct hda_bind_ctls alc663_asus_one_bind_switch = {
17736 .ops = &snd_hda_bind_sw,
17738 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17739 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17744 static const struct snd_kcontrol_new alc663_m51va_mixer[] = {
17745 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17746 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17747 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17748 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17752 static const struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17753 .ops = &snd_hda_bind_sw,
17755 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17756 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17757 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17762 static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17763 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17764 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17765 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17766 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17767 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17768 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17773 static const struct hda_bind_ctls alc663_asus_four_bind_switch = {
17774 .ops = &snd_hda_bind_sw,
17776 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17777 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17778 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17783 static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17784 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17785 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17787 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17788 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17789 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17793 static const struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17794 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17795 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17796 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17799 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17800 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17804 static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17805 .ops = &snd_hda_bind_vol,
17807 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17808 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17813 static const struct hda_bind_ctls alc663_asus_two_bind_switch = {
17814 .ops = &snd_hda_bind_sw,
17816 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17817 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17822 static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17823 HDA_BIND_VOL("Master Playback Volume",
17824 &alc663_asus_two_bind_master_vol),
17825 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17826 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17828 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17829 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17833 static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17834 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17835 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17837 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17839 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17843 static const struct snd_kcontrol_new alc663_g71v_mixer[] = {
17844 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17845 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17846 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17847 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17848 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17850 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17851 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17852 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17853 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17857 static const struct snd_kcontrol_new alc663_g50v_mixer[] = {
17858 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17859 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17864 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17865 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17866 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17867 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17871 static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17872 .ops = &snd_hda_bind_sw,
17874 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17875 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17876 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17877 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17878 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17883 static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17884 .ops = &snd_hda_bind_sw,
17886 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17887 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17892 static const struct snd_kcontrol_new alc663_mode7_mixer[] = {
17893 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17894 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17895 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17896 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17897 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17898 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17899 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17900 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17905 static const struct snd_kcontrol_new alc663_mode8_mixer[] = {
17906 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17907 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17908 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17909 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17910 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17911 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17912 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17917 static const struct snd_kcontrol_new alc662_chmode_mixer[] = {
17919 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17920 .name = "Channel Mode",
17921 .info = alc_ch_mode_info,
17922 .get = alc_ch_mode_get,
17923 .put = alc_ch_mode_put,
17928 static const struct hda_verb alc662_init_verbs[] = {
17929 /* ADC: mute amp left and right */
17930 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17931 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17933 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17935 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17936 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17937 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17938 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17940 /* Front Pin: output 0 (0x0c) */
17941 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17942 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17944 /* Rear Pin: output 1 (0x0d) */
17945 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17948 /* CLFE Pin: output 2 (0x0e) */
17949 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17950 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17952 /* Mic (rear) pin: input vref at 80% */
17953 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17954 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17955 /* Front Mic pin: input vref at 80% */
17956 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17958 /* Line In pin: input */
17959 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17960 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17961 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17964 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17965 /* CD pin widget for input */
17966 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17968 /* FIXME: use matrix-type input source selection */
17969 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17971 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17977 static const struct hda_verb alc662_eapd_init_verbs[] = {
17978 /* always trun on EAPD */
17979 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17980 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17984 static const struct hda_verb alc662_sue_init_verbs[] = {
17985 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17986 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17990 static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17991 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17992 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17996 /* Set Unsolicited Event*/
17997 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17999 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18003 static const struct hda_verb alc663_m51va_init_verbs[] = {
18004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18005 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18006 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18007 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18008 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18009 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18011 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18012 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18016 static const struct hda_verb alc663_21jd_amic_init_verbs[] = {
18017 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18018 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18019 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18022 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18023 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18027 static const struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18029 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18030 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18031 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18032 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18033 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18034 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18035 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18039 static const struct hda_verb alc663_15jd_amic_init_verbs[] = {
18040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18042 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18043 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18044 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18045 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18046 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18050 static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18051 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18052 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18053 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18054 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18055 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18056 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18057 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
18058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18060 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18061 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18062 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18066 static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18067 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18070 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18071 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18073 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
18076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18077 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18078 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18082 static const struct hda_verb alc663_g71v_init_verbs[] = {
18083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18084 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18085 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
18087 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18088 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18089 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18091 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18092 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
18093 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18097 static const struct hda_verb alc663_g50v_init_verbs[] = {
18098 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18099 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18100 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
18102 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18103 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18107 static const struct hda_verb alc662_ecs_init_verbs[] = {
18108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18111 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18115 static const struct hda_verb alc272_dell_zm1_init_verbs[] = {
18116 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18117 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18119 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18120 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18121 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18122 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18125 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18126 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18130 static const struct hda_verb alc272_dell_init_verbs[] = {
18131 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18132 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18134 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18135 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18136 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18137 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18139 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18140 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18141 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18145 static const struct hda_verb alc663_mode7_init_verbs[] = {
18146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18147 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18148 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18149 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18151 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18152 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18153 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18154 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18155 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18158 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18159 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18160 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18164 static const struct hda_verb alc663_mode8_init_verbs[] = {
18165 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18166 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18167 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18168 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18170 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18171 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18172 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18173 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18174 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18175 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18178 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18179 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18180 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18184 static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18185 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18186 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18190 static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18191 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18192 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18196 static void alc662_lenovo_101e_setup(struct hda_codec *codec)
18198 struct alc_spec *spec = codec->spec;
18200 spec->autocfg.hp_pins[0] = 0x1b;
18201 spec->autocfg.line_out_pins[0] = 0x14;
18202 spec->autocfg.speaker_pins[0] = 0x15;
18203 spec->automute = 1;
18204 spec->detect_line = 1;
18205 spec->automute_lines = 1;
18206 spec->automute_mode = ALC_AUTOMUTE_AMP;
18209 static void alc662_eeepc_setup(struct hda_codec *codec)
18211 struct alc_spec *spec = codec->spec;
18213 alc262_hippo1_setup(codec);
18214 spec->ext_mic.pin = 0x18;
18215 spec->ext_mic.mux_idx = 0;
18216 spec->int_mic.pin = 0x19;
18217 spec->int_mic.mux_idx = 1;
18218 spec->auto_mic = 1;
18221 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18223 struct alc_spec *spec = codec->spec;
18225 spec->autocfg.hp_pins[0] = 0x14;
18226 spec->autocfg.speaker_pins[0] = 0x1b;
18227 spec->automute = 1;
18228 spec->automute_mode = ALC_AUTOMUTE_AMP;
18231 static void alc663_m51va_setup(struct hda_codec *codec)
18233 struct alc_spec *spec = codec->spec;
18234 spec->autocfg.hp_pins[0] = 0x21;
18235 spec->autocfg.speaker_pins[0] = 0x14;
18236 spec->automute_mixer_nid[0] = 0x0c;
18237 spec->automute = 1;
18238 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18239 spec->ext_mic.pin = 0x18;
18240 spec->ext_mic.mux_idx = 0;
18241 spec->int_mic.pin = 0x12;
18242 spec->int_mic.mux_idx = 9;
18243 spec->auto_mic = 1;
18246 /* ***************** Mode1 ******************************/
18247 static void alc663_mode1_setup(struct hda_codec *codec)
18249 struct alc_spec *spec = codec->spec;
18250 spec->autocfg.hp_pins[0] = 0x21;
18251 spec->autocfg.speaker_pins[0] = 0x14;
18252 spec->automute_mixer_nid[0] = 0x0c;
18253 spec->automute = 1;
18254 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18255 spec->ext_mic.pin = 0x18;
18256 spec->ext_mic.mux_idx = 0;
18257 spec->int_mic.pin = 0x19;
18258 spec->int_mic.mux_idx = 1;
18259 spec->auto_mic = 1;
18262 /* ***************** Mode2 ******************************/
18263 static void alc662_mode2_setup(struct hda_codec *codec)
18265 struct alc_spec *spec = codec->spec;
18266 spec->autocfg.hp_pins[0] = 0x1b;
18267 spec->autocfg.speaker_pins[0] = 0x14;
18268 spec->automute = 1;
18269 spec->automute_mode = ALC_AUTOMUTE_PIN;
18270 spec->ext_mic.pin = 0x18;
18271 spec->ext_mic.mux_idx = 0;
18272 spec->int_mic.pin = 0x19;
18273 spec->int_mic.mux_idx = 1;
18274 spec->auto_mic = 1;
18277 /* ***************** Mode3 ******************************/
18278 static void alc663_mode3_setup(struct hda_codec *codec)
18280 struct alc_spec *spec = codec->spec;
18281 spec->autocfg.hp_pins[0] = 0x21;
18282 spec->autocfg.hp_pins[0] = 0x15;
18283 spec->autocfg.speaker_pins[0] = 0x14;
18284 spec->automute = 1;
18285 spec->automute_mode = ALC_AUTOMUTE_PIN;
18286 spec->ext_mic.pin = 0x18;
18287 spec->ext_mic.mux_idx = 0;
18288 spec->int_mic.pin = 0x19;
18289 spec->int_mic.mux_idx = 1;
18290 spec->auto_mic = 1;
18293 /* ***************** Mode4 ******************************/
18294 static void alc663_mode4_setup(struct hda_codec *codec)
18296 struct alc_spec *spec = codec->spec;
18297 spec->autocfg.hp_pins[0] = 0x21;
18298 spec->autocfg.speaker_pins[0] = 0x14;
18299 spec->autocfg.speaker_pins[1] = 0x16;
18300 spec->automute_mixer_nid[0] = 0x0c;
18301 spec->automute_mixer_nid[1] = 0x0e;
18302 spec->automute = 1;
18303 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18304 spec->ext_mic.pin = 0x18;
18305 spec->ext_mic.mux_idx = 0;
18306 spec->int_mic.pin = 0x19;
18307 spec->int_mic.mux_idx = 1;
18308 spec->auto_mic = 1;
18311 /* ***************** Mode5 ******************************/
18312 static void alc663_mode5_setup(struct hda_codec *codec)
18314 struct alc_spec *spec = codec->spec;
18315 spec->autocfg.hp_pins[0] = 0x15;
18316 spec->autocfg.speaker_pins[0] = 0x14;
18317 spec->autocfg.speaker_pins[1] = 0x16;
18318 spec->automute_mixer_nid[0] = 0x0c;
18319 spec->automute_mixer_nid[1] = 0x0e;
18320 spec->automute = 1;
18321 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18322 spec->ext_mic.pin = 0x18;
18323 spec->ext_mic.mux_idx = 0;
18324 spec->int_mic.pin = 0x19;
18325 spec->int_mic.mux_idx = 1;
18326 spec->auto_mic = 1;
18329 /* ***************** Mode6 ******************************/
18330 static void alc663_mode6_setup(struct hda_codec *codec)
18332 struct alc_spec *spec = codec->spec;
18333 spec->autocfg.hp_pins[0] = 0x1b;
18334 spec->autocfg.hp_pins[0] = 0x15;
18335 spec->autocfg.speaker_pins[0] = 0x14;
18336 spec->automute_mixer_nid[0] = 0x0c;
18337 spec->automute = 1;
18338 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18339 spec->ext_mic.pin = 0x18;
18340 spec->ext_mic.mux_idx = 0;
18341 spec->int_mic.pin = 0x19;
18342 spec->int_mic.mux_idx = 1;
18343 spec->auto_mic = 1;
18346 /* ***************** Mode7 ******************************/
18347 static void alc663_mode7_setup(struct hda_codec *codec)
18349 struct alc_spec *spec = codec->spec;
18350 spec->autocfg.hp_pins[0] = 0x1b;
18351 spec->autocfg.hp_pins[0] = 0x21;
18352 spec->autocfg.speaker_pins[0] = 0x14;
18353 spec->autocfg.speaker_pins[0] = 0x17;
18354 spec->automute = 1;
18355 spec->automute_mode = ALC_AUTOMUTE_PIN;
18356 spec->ext_mic.pin = 0x18;
18357 spec->ext_mic.mux_idx = 0;
18358 spec->int_mic.pin = 0x19;
18359 spec->int_mic.mux_idx = 1;
18360 spec->auto_mic = 1;
18363 /* ***************** Mode8 ******************************/
18364 static void alc663_mode8_setup(struct hda_codec *codec)
18366 struct alc_spec *spec = codec->spec;
18367 spec->autocfg.hp_pins[0] = 0x21;
18368 spec->autocfg.hp_pins[1] = 0x15;
18369 spec->autocfg.speaker_pins[0] = 0x14;
18370 spec->autocfg.speaker_pins[0] = 0x17;
18371 spec->automute = 1;
18372 spec->automute_mode = ALC_AUTOMUTE_PIN;
18373 spec->ext_mic.pin = 0x18;
18374 spec->ext_mic.mux_idx = 0;
18375 spec->int_mic.pin = 0x12;
18376 spec->int_mic.mux_idx = 9;
18377 spec->auto_mic = 1;
18380 static void alc663_g71v_setup(struct hda_codec *codec)
18382 struct alc_spec *spec = codec->spec;
18383 spec->autocfg.hp_pins[0] = 0x21;
18384 spec->autocfg.line_out_pins[0] = 0x15;
18385 spec->autocfg.speaker_pins[0] = 0x14;
18386 spec->automute = 1;
18387 spec->automute_mode = ALC_AUTOMUTE_AMP;
18388 spec->detect_line = 1;
18389 spec->automute_lines = 1;
18390 spec->ext_mic.pin = 0x18;
18391 spec->ext_mic.mux_idx = 0;
18392 spec->int_mic.pin = 0x12;
18393 spec->int_mic.mux_idx = 9;
18394 spec->auto_mic = 1;
18397 #define alc663_g50v_setup alc663_m51va_setup
18399 static const struct snd_kcontrol_new alc662_ecs_mixer[] = {
18400 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18401 ALC262_HIPPO_MASTER_SWITCH,
18403 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18404 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18405 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18407 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18408 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18409 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18413 static const struct snd_kcontrol_new alc272_nc10_mixer[] = {
18414 /* Master Playback automatically created from Speaker and Headphone */
18415 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18416 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18417 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18422 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18424 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18425 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18426 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18430 #ifdef CONFIG_SND_HDA_POWER_SAVE
18431 #define alc662_loopbacks alc880_loopbacks
18435 /* pcm configuration: identical with ALC880 */
18436 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18437 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18438 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18439 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18442 * configuration and preset
18444 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18445 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18446 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18447 [ALC662_3ST_6ch] = "3stack-6ch",
18448 [ALC662_5ST_DIG] = "5stack-dig",
18449 [ALC662_LENOVO_101E] = "lenovo-101e",
18450 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18451 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18452 [ALC662_ECS] = "ecs",
18453 [ALC663_ASUS_M51VA] = "m51va",
18454 [ALC663_ASUS_G71V] = "g71v",
18455 [ALC663_ASUS_H13] = "h13",
18456 [ALC663_ASUS_G50V] = "g50v",
18457 [ALC663_ASUS_MODE1] = "asus-mode1",
18458 [ALC662_ASUS_MODE2] = "asus-mode2",
18459 [ALC663_ASUS_MODE3] = "asus-mode3",
18460 [ALC663_ASUS_MODE4] = "asus-mode4",
18461 [ALC663_ASUS_MODE5] = "asus-mode5",
18462 [ALC663_ASUS_MODE6] = "asus-mode6",
18463 [ALC663_ASUS_MODE7] = "asus-mode7",
18464 [ALC663_ASUS_MODE8] = "asus-mode8",
18465 [ALC272_DELL] = "dell",
18466 [ALC272_DELL_ZM1] = "dell-zm1",
18467 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18468 [ALC662_AUTO] = "auto",
18471 static const struct snd_pci_quirk alc662_cfg_tbl[] = {
18472 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18473 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18474 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18475 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18476 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18477 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18478 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18479 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18480 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18481 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18482 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18483 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18484 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18485 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18486 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18487 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18488 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18489 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18490 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18491 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18492 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18493 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18494 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18495 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18496 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18497 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18498 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18499 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18500 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18501 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18502 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18503 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18504 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18505 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18506 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18507 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18508 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18509 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18510 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18511 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18512 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18513 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18514 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18515 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18516 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18517 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18518 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18519 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18520 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18521 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18522 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18523 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18524 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18525 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18526 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18527 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18528 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18529 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18530 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18531 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18532 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18533 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18534 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18535 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18536 ALC662_3ST_6ch_DIG),
18537 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18538 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18539 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18540 ALC662_3ST_6ch_DIG),
18541 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18542 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18543 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18544 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18545 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18546 ALC662_3ST_6ch_DIG),
18547 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18549 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18553 static const struct alc_config_preset alc662_presets[] = {
18554 [ALC662_3ST_2ch_DIG] = {
18555 .mixers = { alc662_3ST_2ch_mixer },
18556 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18557 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18558 .dac_nids = alc662_dac_nids,
18559 .dig_out_nid = ALC662_DIGOUT_NID,
18560 .dig_in_nid = ALC662_DIGIN_NID,
18561 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18562 .channel_mode = alc662_3ST_2ch_modes,
18563 .input_mux = &alc662_capture_source,
18565 [ALC662_3ST_6ch_DIG] = {
18566 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18567 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18568 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18569 .dac_nids = alc662_dac_nids,
18570 .dig_out_nid = ALC662_DIGOUT_NID,
18571 .dig_in_nid = ALC662_DIGIN_NID,
18572 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18573 .channel_mode = alc662_3ST_6ch_modes,
18575 .input_mux = &alc662_capture_source,
18577 [ALC662_3ST_6ch] = {
18578 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18579 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18580 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18581 .dac_nids = alc662_dac_nids,
18582 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18583 .channel_mode = alc662_3ST_6ch_modes,
18585 .input_mux = &alc662_capture_source,
18587 [ALC662_5ST_DIG] = {
18588 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18589 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18590 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18591 .dac_nids = alc662_dac_nids,
18592 .dig_out_nid = ALC662_DIGOUT_NID,
18593 .dig_in_nid = ALC662_DIGIN_NID,
18594 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18595 .channel_mode = alc662_5stack_modes,
18596 .input_mux = &alc662_capture_source,
18598 [ALC662_LENOVO_101E] = {
18599 .mixers = { alc662_lenovo_101e_mixer },
18600 .init_verbs = { alc662_init_verbs,
18601 alc662_eapd_init_verbs,
18602 alc662_sue_init_verbs },
18603 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18604 .dac_nids = alc662_dac_nids,
18605 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18606 .channel_mode = alc662_3ST_2ch_modes,
18607 .input_mux = &alc662_lenovo_101e_capture_source,
18608 .unsol_event = alc_sku_unsol_event,
18609 .setup = alc662_lenovo_101e_setup,
18610 .init_hook = alc_inithook,
18612 [ALC662_ASUS_EEEPC_P701] = {
18613 .mixers = { alc662_eeepc_p701_mixer },
18614 .init_verbs = { alc662_init_verbs,
18615 alc662_eapd_init_verbs,
18616 alc662_eeepc_sue_init_verbs },
18617 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18618 .dac_nids = alc662_dac_nids,
18619 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18620 .channel_mode = alc662_3ST_2ch_modes,
18621 .unsol_event = alc_sku_unsol_event,
18622 .setup = alc662_eeepc_setup,
18623 .init_hook = alc_inithook,
18625 [ALC662_ASUS_EEEPC_EP20] = {
18626 .mixers = { alc662_eeepc_ep20_mixer,
18627 alc662_chmode_mixer },
18628 .init_verbs = { alc662_init_verbs,
18629 alc662_eapd_init_verbs,
18630 alc662_eeepc_ep20_sue_init_verbs },
18631 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18632 .dac_nids = alc662_dac_nids,
18633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18634 .channel_mode = alc662_3ST_6ch_modes,
18635 .input_mux = &alc662_lenovo_101e_capture_source,
18636 .unsol_event = alc_sku_unsol_event,
18637 .setup = alc662_eeepc_ep20_setup,
18638 .init_hook = alc_inithook,
18641 .mixers = { alc662_ecs_mixer },
18642 .init_verbs = { alc662_init_verbs,
18643 alc662_eapd_init_verbs,
18644 alc662_ecs_init_verbs },
18645 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18646 .dac_nids = alc662_dac_nids,
18647 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18648 .channel_mode = alc662_3ST_2ch_modes,
18649 .unsol_event = alc_sku_unsol_event,
18650 .setup = alc662_eeepc_setup,
18651 .init_hook = alc_inithook,
18653 [ALC663_ASUS_M51VA] = {
18654 .mixers = { alc663_m51va_mixer },
18655 .init_verbs = { alc662_init_verbs,
18656 alc662_eapd_init_verbs,
18657 alc663_m51va_init_verbs },
18658 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18659 .dac_nids = alc662_dac_nids,
18660 .dig_out_nid = ALC662_DIGOUT_NID,
18661 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18662 .channel_mode = alc662_3ST_2ch_modes,
18663 .unsol_event = alc_sku_unsol_event,
18664 .setup = alc663_m51va_setup,
18665 .init_hook = alc_inithook,
18667 [ALC663_ASUS_G71V] = {
18668 .mixers = { alc663_g71v_mixer },
18669 .init_verbs = { alc662_init_verbs,
18670 alc662_eapd_init_verbs,
18671 alc663_g71v_init_verbs },
18672 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18673 .dac_nids = alc662_dac_nids,
18674 .dig_out_nid = ALC662_DIGOUT_NID,
18675 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18676 .channel_mode = alc662_3ST_2ch_modes,
18677 .unsol_event = alc_sku_unsol_event,
18678 .setup = alc663_g71v_setup,
18679 .init_hook = alc_inithook,
18681 [ALC663_ASUS_H13] = {
18682 .mixers = { alc663_m51va_mixer },
18683 .init_verbs = { alc662_init_verbs,
18684 alc662_eapd_init_verbs,
18685 alc663_m51va_init_verbs },
18686 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18687 .dac_nids = alc662_dac_nids,
18688 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18689 .channel_mode = alc662_3ST_2ch_modes,
18690 .setup = alc663_m51va_setup,
18691 .unsol_event = alc_sku_unsol_event,
18692 .init_hook = alc_inithook,
18694 [ALC663_ASUS_G50V] = {
18695 .mixers = { alc663_g50v_mixer },
18696 .init_verbs = { alc662_init_verbs,
18697 alc662_eapd_init_verbs,
18698 alc663_g50v_init_verbs },
18699 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18700 .dac_nids = alc662_dac_nids,
18701 .dig_out_nid = ALC662_DIGOUT_NID,
18702 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18703 .channel_mode = alc662_3ST_6ch_modes,
18704 .input_mux = &alc663_capture_source,
18705 .unsol_event = alc_sku_unsol_event,
18706 .setup = alc663_g50v_setup,
18707 .init_hook = alc_inithook,
18709 [ALC663_ASUS_MODE1] = {
18710 .mixers = { alc663_m51va_mixer },
18711 .cap_mixer = alc662_auto_capture_mixer,
18712 .init_verbs = { alc662_init_verbs,
18713 alc662_eapd_init_verbs,
18714 alc663_21jd_amic_init_verbs },
18715 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18717 .dac_nids = alc662_dac_nids,
18718 .dig_out_nid = ALC662_DIGOUT_NID,
18719 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18720 .channel_mode = alc662_3ST_2ch_modes,
18721 .unsol_event = alc_sku_unsol_event,
18722 .setup = alc663_mode1_setup,
18723 .init_hook = alc_inithook,
18725 [ALC662_ASUS_MODE2] = {
18726 .mixers = { alc662_1bjd_mixer },
18727 .cap_mixer = alc662_auto_capture_mixer,
18728 .init_verbs = { alc662_init_verbs,
18729 alc662_eapd_init_verbs,
18730 alc662_1bjd_amic_init_verbs },
18731 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18732 .dac_nids = alc662_dac_nids,
18733 .dig_out_nid = ALC662_DIGOUT_NID,
18734 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18735 .channel_mode = alc662_3ST_2ch_modes,
18736 .unsol_event = alc_sku_unsol_event,
18737 .setup = alc662_mode2_setup,
18738 .init_hook = alc_inithook,
18740 [ALC663_ASUS_MODE3] = {
18741 .mixers = { alc663_two_hp_m1_mixer },
18742 .cap_mixer = alc662_auto_capture_mixer,
18743 .init_verbs = { alc662_init_verbs,
18744 alc662_eapd_init_verbs,
18745 alc663_two_hp_amic_m1_init_verbs },
18746 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18748 .dac_nids = alc662_dac_nids,
18749 .dig_out_nid = ALC662_DIGOUT_NID,
18750 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18751 .channel_mode = alc662_3ST_2ch_modes,
18752 .unsol_event = alc_sku_unsol_event,
18753 .setup = alc663_mode3_setup,
18754 .init_hook = alc_inithook,
18756 [ALC663_ASUS_MODE4] = {
18757 .mixers = { alc663_asus_21jd_clfe_mixer },
18758 .cap_mixer = alc662_auto_capture_mixer,
18759 .init_verbs = { alc662_init_verbs,
18760 alc662_eapd_init_verbs,
18761 alc663_21jd_amic_init_verbs},
18762 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18764 .dac_nids = alc662_dac_nids,
18765 .dig_out_nid = ALC662_DIGOUT_NID,
18766 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18767 .channel_mode = alc662_3ST_2ch_modes,
18768 .unsol_event = alc_sku_unsol_event,
18769 .setup = alc663_mode4_setup,
18770 .init_hook = alc_inithook,
18772 [ALC663_ASUS_MODE5] = {
18773 .mixers = { alc663_asus_15jd_clfe_mixer },
18774 .cap_mixer = alc662_auto_capture_mixer,
18775 .init_verbs = { alc662_init_verbs,
18776 alc662_eapd_init_verbs,
18777 alc663_15jd_amic_init_verbs },
18778 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18780 .dac_nids = alc662_dac_nids,
18781 .dig_out_nid = ALC662_DIGOUT_NID,
18782 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18783 .channel_mode = alc662_3ST_2ch_modes,
18784 .unsol_event = alc_sku_unsol_event,
18785 .setup = alc663_mode5_setup,
18786 .init_hook = alc_inithook,
18788 [ALC663_ASUS_MODE6] = {
18789 .mixers = { alc663_two_hp_m2_mixer },
18790 .cap_mixer = alc662_auto_capture_mixer,
18791 .init_verbs = { alc662_init_verbs,
18792 alc662_eapd_init_verbs,
18793 alc663_two_hp_amic_m2_init_verbs },
18794 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18796 .dac_nids = alc662_dac_nids,
18797 .dig_out_nid = ALC662_DIGOUT_NID,
18798 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18799 .channel_mode = alc662_3ST_2ch_modes,
18800 .unsol_event = alc_sku_unsol_event,
18801 .setup = alc663_mode6_setup,
18802 .init_hook = alc_inithook,
18804 [ALC663_ASUS_MODE7] = {
18805 .mixers = { alc663_mode7_mixer },
18806 .cap_mixer = alc662_auto_capture_mixer,
18807 .init_verbs = { alc662_init_verbs,
18808 alc662_eapd_init_verbs,
18809 alc663_mode7_init_verbs },
18810 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18812 .dac_nids = alc662_dac_nids,
18813 .dig_out_nid = ALC662_DIGOUT_NID,
18814 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18815 .channel_mode = alc662_3ST_2ch_modes,
18816 .unsol_event = alc_sku_unsol_event,
18817 .setup = alc663_mode7_setup,
18818 .init_hook = alc_inithook,
18820 [ALC663_ASUS_MODE8] = {
18821 .mixers = { alc663_mode8_mixer },
18822 .cap_mixer = alc662_auto_capture_mixer,
18823 .init_verbs = { alc662_init_verbs,
18824 alc662_eapd_init_verbs,
18825 alc663_mode8_init_verbs },
18826 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18828 .dac_nids = alc662_dac_nids,
18829 .dig_out_nid = ALC662_DIGOUT_NID,
18830 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18831 .channel_mode = alc662_3ST_2ch_modes,
18832 .unsol_event = alc_sku_unsol_event,
18833 .setup = alc663_mode8_setup,
18834 .init_hook = alc_inithook,
18837 .mixers = { alc663_m51va_mixer },
18838 .cap_mixer = alc272_auto_capture_mixer,
18839 .init_verbs = { alc662_init_verbs,
18840 alc662_eapd_init_verbs,
18841 alc272_dell_init_verbs },
18842 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18843 .dac_nids = alc272_dac_nids,
18844 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18845 .adc_nids = alc272_adc_nids,
18846 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18847 .capsrc_nids = alc272_capsrc_nids,
18848 .channel_mode = alc662_3ST_2ch_modes,
18849 .unsol_event = alc_sku_unsol_event,
18850 .setup = alc663_m51va_setup,
18851 .init_hook = alc_inithook,
18853 [ALC272_DELL_ZM1] = {
18854 .mixers = { alc663_m51va_mixer },
18855 .cap_mixer = alc662_auto_capture_mixer,
18856 .init_verbs = { alc662_init_verbs,
18857 alc662_eapd_init_verbs,
18858 alc272_dell_zm1_init_verbs },
18859 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18860 .dac_nids = alc272_dac_nids,
18861 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18862 .adc_nids = alc662_adc_nids,
18864 .capsrc_nids = alc662_capsrc_nids,
18865 .channel_mode = alc662_3ST_2ch_modes,
18866 .unsol_event = alc_sku_unsol_event,
18867 .setup = alc663_m51va_setup,
18868 .init_hook = alc_inithook,
18870 [ALC272_SAMSUNG_NC10] = {
18871 .mixers = { alc272_nc10_mixer },
18872 .init_verbs = { alc662_init_verbs,
18873 alc662_eapd_init_verbs,
18874 alc663_21jd_amic_init_verbs },
18875 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18876 .dac_nids = alc272_dac_nids,
18877 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18878 .channel_mode = alc662_3ST_2ch_modes,
18879 /*.input_mux = &alc272_nc10_capture_source,*/
18880 .unsol_event = alc_sku_unsol_event,
18881 .setup = alc663_mode4_setup,
18882 .init_hook = alc_inithook,
18888 * BIOS auto configuration
18891 /* convert from MIX nid to DAC */
18892 static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
18897 num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
18898 for (i = 0; i < num; i++) {
18899 if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
18905 /* go down to the selector widget before the mixer */
18906 static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin)
18909 int num = snd_hda_get_connections(codec, pin, srcs,
18912 get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL)
18917 /* get MIX nid connected to the given pin targeted to DAC */
18918 static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18924 pin = alc_go_down_to_selector(codec, pin);
18925 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18926 for (i = 0; i < num; i++) {
18927 if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
18933 /* select the connection from pin to DAC if needed */
18934 static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin,
18940 pin = alc_go_down_to_selector(codec, pin);
18941 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18944 for (i = 0; i < num; i++) {
18945 if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
18946 snd_hda_codec_update_cache(codec, pin, 0,
18947 AC_VERB_SET_CONNECT_SEL, i);
18954 /* look for an empty DAC slot */
18955 static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18957 struct alc_spec *spec = codec->spec;
18961 pin = alc_go_down_to_selector(codec, pin);
18962 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18963 for (i = 0; i < num; i++) {
18964 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
18967 for (j = 0; j < spec->multiout.num_dacs; j++)
18968 if (spec->multiout.dac_nids[j] == nid)
18970 if (j >= spec->multiout.num_dacs)
18976 /* fill in the dac_nids table from the parsed pin configuration */
18977 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18978 const struct auto_pin_cfg *cfg)
18980 struct alc_spec *spec = codec->spec;
18984 spec->multiout.dac_nids = spec->private_dac_nids;
18985 for (i = 0; i < cfg->line_outs; i++) {
18986 dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]);
18989 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
18994 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18995 hda_nid_t nid, int idx, unsigned int chs)
18997 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
18998 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19001 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19002 hda_nid_t nid, int idx, unsigned int chs)
19004 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
19005 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19008 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
19009 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
19010 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
19011 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
19012 #define alc662_add_stereo_vol(spec, pfx, nid) \
19013 alc662_add_vol_ctl(spec, pfx, nid, 3)
19014 #define alc662_add_stereo_sw(spec, pfx, nid) \
19015 alc662_add_sw_ctl(spec, pfx, nid, 3)
19017 /* add playback controls from the parsed DAC table */
19018 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19019 const struct auto_pin_cfg *cfg)
19021 struct alc_spec *spec = codec->spec;
19022 static const char * const chname[4] = {
19023 "Front", "Surround", NULL /*CLFE*/, "Side"
19025 const char *pfx = alc_get_line_out_pfx(spec, true);
19026 hda_nid_t nid, mix, pin;
19027 int i, err, noutputs;
19029 noutputs = cfg->line_outs;
19030 if (spec->multi_ios > 0)
19031 noutputs += spec->multi_ios;
19033 for (i = 0; i < noutputs; i++) {
19034 nid = spec->multiout.dac_nids[i];
19037 if (i >= cfg->line_outs)
19038 pin = spec->multi_io[i - 1].pin;
19040 pin = cfg->line_out_pins[i];
19041 mix = alc_auto_dac_to_mix(codec, pin, nid);
19044 if (!pfx && i == 2) {
19046 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19049 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19052 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19055 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19059 const char *name = pfx;
19065 err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
19068 err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
19076 /* add playback controls for speaker and HP outputs */
19077 /* return DAC nid if any new DAC is assigned */
19078 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19081 struct alc_spec *spec = codec->spec;
19082 hda_nid_t nid, mix;
19087 nid = alc_auto_look_for_dac(codec, pin);
19089 /* the corresponding DAC is already occupied */
19090 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19091 return 0; /* no way */
19092 /* create a switch only */
19093 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19094 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19097 mix = alc_auto_dac_to_mix(codec, pin, nid);
19100 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19103 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19109 /* create playback/capture controls for input pins */
19110 #define alc662_auto_create_input_ctls \
19111 alc882_auto_create_input_ctls
19113 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19114 hda_nid_t nid, int pin_type,
19118 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19120 alc_set_pin_output(codec, nid, pin_type);
19121 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19122 for (i = 0; i < num; i++) {
19123 if (alc_auto_mix_to_dac(codec, srcs[i]) != dac)
19125 /* need the manual connection? */
19127 snd_hda_codec_write(codec, nid, 0,
19128 AC_VERB_SET_CONNECT_SEL, i);
19129 /* unmute mixer widget inputs */
19130 snd_hda_codec_write(codec, srcs[i], 0,
19131 AC_VERB_SET_AMP_GAIN_MUTE,
19133 snd_hda_codec_write(codec, srcs[i], 0,
19134 AC_VERB_SET_AMP_GAIN_MUTE,
19140 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19142 struct alc_spec *spec = codec->spec;
19143 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19146 for (i = 0; i <= HDA_SIDE; i++) {
19147 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19149 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19150 spec->multiout.dac_nids[i]);
19154 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19156 struct alc_spec *spec = codec->spec;
19159 pin = spec->autocfg.hp_pins[0];
19161 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19162 spec->multiout.hp_nid);
19163 pin = spec->autocfg.speaker_pins[0];
19165 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19166 spec->multiout.extra_out_nid[0]);
19169 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19171 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19173 struct alc_spec *spec = codec->spec;
19174 struct auto_pin_cfg *cfg = &spec->autocfg;
19177 for (i = 0; i < cfg->num_inputs; i++) {
19178 hda_nid_t nid = cfg->inputs[i].pin;
19179 if (alc_is_input_pin(codec, nid)) {
19180 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19181 if (nid != ALC662_PIN_CD_NID &&
19182 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19183 snd_hda_codec_write(codec, nid, 0,
19184 AC_VERB_SET_AMP_GAIN_MUTE,
19190 #define alc662_auto_init_input_src alc882_auto_init_input_src
19195 static int alc_auto_fill_multi_ios(struct hda_codec *codec,
19196 unsigned int location)
19198 struct alc_spec *spec = codec->spec;
19199 struct auto_pin_cfg *cfg = &spec->autocfg;
19200 int type, i, num_pins = 0;
19202 for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
19203 for (i = 0; i < cfg->num_inputs; i++) {
19204 hda_nid_t nid = cfg->inputs[i].pin;
19206 unsigned int defcfg, caps;
19207 if (cfg->inputs[i].type != type)
19209 defcfg = snd_hda_codec_get_pincfg(codec, nid);
19210 if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX)
19212 if (location && get_defcfg_location(defcfg) != location)
19214 caps = snd_hda_query_pin_caps(codec, nid);
19215 if (!(caps & AC_PINCAP_OUT))
19217 dac = alc_auto_look_for_dac(codec, nid);
19220 spec->multi_io[num_pins].pin = nid;
19221 spec->multi_io[num_pins].dac = dac;
19223 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19226 spec->multiout.num_dacs = 1;
19232 static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol,
19233 struct snd_ctl_elem_info *uinfo)
19235 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19236 struct alc_spec *spec = codec->spec;
19238 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
19240 uinfo->value.enumerated.items = spec->multi_ios + 1;
19241 if (uinfo->value.enumerated.item > spec->multi_ios)
19242 uinfo->value.enumerated.item = spec->multi_ios;
19243 sprintf(uinfo->value.enumerated.name, "%dch",
19244 (uinfo->value.enumerated.item + 1) * 2);
19248 static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol,
19249 struct snd_ctl_elem_value *ucontrol)
19251 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19252 struct alc_spec *spec = codec->spec;
19253 ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2;
19257 static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
19259 struct alc_spec *spec = codec->spec;
19260 hda_nid_t nid = spec->multi_io[idx].pin;
19262 if (!spec->multi_io[idx].ctl_in)
19263 spec->multi_io[idx].ctl_in =
19264 snd_hda_codec_read(codec, nid, 0,
19265 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19267 snd_hda_codec_update_cache(codec, nid, 0,
19268 AC_VERB_SET_PIN_WIDGET_CONTROL,
19270 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19271 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19273 alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
19275 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19276 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19277 HDA_AMP_MUTE, HDA_AMP_MUTE);
19278 snd_hda_codec_update_cache(codec, nid, 0,
19279 AC_VERB_SET_PIN_WIDGET_CONTROL,
19280 spec->multi_io[idx].ctl_in);
19285 static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
19286 struct snd_ctl_elem_value *ucontrol)
19288 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19289 struct alc_spec *spec = codec->spec;
19292 ch = ucontrol->value.enumerated.item[0];
19293 if (ch < 0 || ch > spec->multi_ios)
19295 if (ch == (spec->ext_channel_count - 1) / 2)
19297 spec->ext_channel_count = (ch + 1) * 2;
19298 for (i = 0; i < spec->multi_ios; i++)
19299 alc_set_multi_io(codec, i, i < ch);
19300 spec->multiout.max_channels = spec->ext_channel_count;
19304 static const struct snd_kcontrol_new alc_auto_channel_mode_enum = {
19305 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
19306 .name = "Channel Mode",
19307 .info = alc_auto_ch_mode_info,
19308 .get = alc_auto_ch_mode_get,
19309 .put = alc_auto_ch_mode_put,
19312 static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
19314 struct alc_spec *spec = codec->spec;
19315 struct auto_pin_cfg *cfg = &spec->autocfg;
19316 unsigned int location, defcfg;
19319 if (cfg->line_outs != 1 ||
19320 cfg->line_out_type != AUTO_PIN_LINE_OUT)
19323 defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
19324 location = get_defcfg_location(defcfg);
19326 num_pins = alc_auto_fill_multi_ios(codec, location);
19327 if (num_pins > 0) {
19328 struct snd_kcontrol_new *knew;
19330 knew = alc_kcontrol_new(spec);
19333 *knew = alc_auto_channel_mode_enum;
19334 knew->name = kstrdup("Channel Mode", GFP_KERNEL);
19338 spec->multi_ios = num_pins;
19339 spec->ext_channel_count = 2;
19340 spec->multiout.num_dacs = num_pins + 1;
19345 static int alc662_parse_auto_config(struct hda_codec *codec)
19347 struct alc_spec *spec = codec->spec;
19349 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19351 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19355 if (!spec->autocfg.line_outs)
19356 return 0; /* can't find valid BIOS pin config */
19358 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19361 err = alc_auto_add_multi_channel_mode(codec);
19364 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19367 err = alc662_auto_create_extra_out(codec,
19368 spec->autocfg.speaker_pins[0],
19373 spec->multiout.extra_out_nid[0] = err;
19374 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19379 spec->multiout.hp_nid = err;
19380 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19384 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19386 alc_auto_parse_digital(codec);
19388 if (spec->kctls.list)
19389 add_mixer(spec, spec->kctls.list);
19391 spec->num_mux_defs = 1;
19392 spec->input_mux = &spec->private_imux[0];
19394 err = alc_auto_add_mic_boost(codec);
19398 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19399 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19400 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19402 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19407 /* additional initialization for auto-configuration model */
19408 static void alc662_auto_init(struct hda_codec *codec)
19410 struct alc_spec *spec = codec->spec;
19411 alc662_auto_init_multi_out(codec);
19412 alc662_auto_init_hp_out(codec);
19413 alc662_auto_init_analog_input(codec);
19414 alc662_auto_init_input_src(codec);
19415 alc_auto_init_digital(codec);
19416 if (spec->unsol_event)
19417 alc_inithook(codec);
19420 static void alc272_fixup_mario(struct hda_codec *codec,
19421 const struct alc_fixup *fix, int action)
19423 if (action != ALC_FIXUP_ACT_PROBE)
19425 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19426 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19427 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19428 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19429 (0 << AC_AMPCAP_MUTE_SHIFT)))
19430 printk(KERN_WARNING
19431 "hda_codec: failed to override amp caps for NID 0x2\n");
19435 ALC662_FIXUP_ASPIRE,
19436 ALC662_FIXUP_IDEAPAD,
19437 ALC272_FIXUP_MARIO,
19438 ALC662_FIXUP_CZC_P10T,
19439 ALC662_FIXUP_SKU_IGNORE,
19442 static const struct alc_fixup alc662_fixups[] = {
19443 [ALC662_FIXUP_ASPIRE] = {
19444 .type = ALC_FIXUP_PINS,
19445 .v.pins = (const struct alc_pincfg[]) {
19446 { 0x15, 0x99130112 }, /* subwoofer */
19450 [ALC662_FIXUP_IDEAPAD] = {
19451 .type = ALC_FIXUP_PINS,
19452 .v.pins = (const struct alc_pincfg[]) {
19453 { 0x17, 0x99130112 }, /* subwoofer */
19457 [ALC272_FIXUP_MARIO] = {
19458 .type = ALC_FIXUP_FUNC,
19459 .v.func = alc272_fixup_mario,
19461 [ALC662_FIXUP_CZC_P10T] = {
19462 .type = ALC_FIXUP_VERBS,
19463 .v.verbs = (const struct hda_verb[]) {
19464 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19468 [ALC662_FIXUP_SKU_IGNORE] = {
19469 .type = ALC_FIXUP_SKU,
19470 .v.sku = ALC_FIXUP_SKU_IGNORE,
19474 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
19475 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19476 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
19477 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19478 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19479 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19480 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19481 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19485 static const struct alc_model_fixup alc662_fixup_models[] = {
19486 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19491 static int patch_alc662(struct hda_codec *codec)
19493 struct alc_spec *spec;
19494 int err, board_config;
19497 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19501 codec->spec = spec;
19503 alc_auto_parse_customize_define(codec);
19505 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19507 coef = alc_read_coef_idx(codec, 0);
19508 if (coef == 0x8020 || coef == 0x8011)
19509 alc_codec_rename(codec, "ALC661");
19510 else if (coef & (1 << 14) &&
19511 codec->bus->pci->subsystem_vendor == 0x1025 &&
19512 spec->cdefine.platform_type == 1)
19513 alc_codec_rename(codec, "ALC272X");
19514 else if (coef == 0x4011)
19515 alc_codec_rename(codec, "ALC656");
19517 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19520 if (board_config < 0) {
19521 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19523 board_config = ALC662_AUTO;
19526 if (board_config == ALC662_AUTO) {
19527 alc_pick_fixup(codec, alc662_fixup_models,
19528 alc662_fixup_tbl, alc662_fixups);
19529 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19530 /* automatic parse from the BIOS config */
19531 err = alc662_parse_auto_config(codec);
19537 "hda_codec: Cannot set up configuration "
19538 "from BIOS. Using base mode...\n");
19539 board_config = ALC662_3ST_2ch_DIG;
19543 if (has_cdefine_beep(codec)) {
19544 err = snd_hda_attach_beep_device(codec, 0x1);
19551 if (board_config != ALC662_AUTO)
19552 setup_preset(codec, &alc662_presets[board_config]);
19554 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19555 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19557 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19558 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19560 if (!spec->adc_nids) {
19561 spec->adc_nids = alc662_adc_nids;
19562 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19564 if (!spec->capsrc_nids)
19565 spec->capsrc_nids = alc662_capsrc_nids;
19567 if (!spec->cap_mixer)
19568 set_capture_mixer(codec);
19570 if (has_cdefine_beep(codec)) {
19571 switch (codec->vendor_id) {
19573 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19578 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19581 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19585 spec->vmaster_nid = 0x02;
19587 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19589 codec->patch_ops = alc_patch_ops;
19590 if (board_config == ALC662_AUTO)
19591 spec->init_hook = alc662_auto_init;
19592 spec->shutup = alc_eapd_shutup;
19594 alc_init_jacks(codec);
19596 #ifdef CONFIG_SND_HDA_POWER_SAVE
19597 if (!spec->loopback.amplist)
19598 spec->loopback.amplist = alc662_loopbacks;
19604 static int patch_alc888(struct hda_codec *codec)
19606 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19607 kfree(codec->chip_name);
19608 if (codec->vendor_id == 0x10ec0887)
19609 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19611 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19612 if (!codec->chip_name) {
19616 return patch_alc662(codec);
19618 return patch_alc882(codec);
19621 static int patch_alc899(struct hda_codec *codec)
19623 if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) {
19624 kfree(codec->chip_name);
19625 codec->chip_name = kstrdup("ALC898", GFP_KERNEL);
19627 return patch_alc882(codec);
19633 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19634 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19635 #define alc680_modes alc260_modes
19637 static const hda_nid_t alc680_dac_nids[3] = {
19638 /* Lout1, Lout2, hp */
19642 static const hda_nid_t alc680_adc_nids[3] = {
19644 /* DMIC, MIC, Line-in*/
19649 * Analog capture ADC cgange
19651 static void alc680_rec_autoswitch(struct hda_codec *codec)
19653 struct alc_spec *spec = codec->spec;
19654 struct auto_pin_cfg *cfg = &spec->autocfg;
19656 int type_found = AUTO_PIN_LAST;
19660 for (i = 0; i < cfg->num_inputs; i++) {
19661 nid = cfg->inputs[i].pin;
19662 if (!is_jack_detectable(codec, nid))
19664 if (snd_hda_jack_detect(codec, nid)) {
19665 if (cfg->inputs[i].type < type_found) {
19666 type_found = cfg->inputs[i].type;
19674 snd_hda_get_connections(codec, pin_found, &nid, 1);
19676 if (nid != spec->cur_adc)
19677 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19678 spec->cur_adc = nid;
19679 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19680 spec->cur_adc_format);
19683 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19684 struct hda_codec *codec,
19685 unsigned int stream_tag,
19686 unsigned int format,
19687 struct snd_pcm_substream *substream)
19689 struct alc_spec *spec = codec->spec;
19691 spec->cur_adc = 0x07;
19692 spec->cur_adc_stream_tag = stream_tag;
19693 spec->cur_adc_format = format;
19695 alc680_rec_autoswitch(codec);
19699 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19700 struct hda_codec *codec,
19701 struct snd_pcm_substream *substream)
19703 snd_hda_codec_cleanup_stream(codec, 0x07);
19704 snd_hda_codec_cleanup_stream(codec, 0x08);
19705 snd_hda_codec_cleanup_stream(codec, 0x09);
19709 static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19710 .substreams = 1, /* can be overridden */
19713 /* NID is set in alc_build_pcms */
19715 .prepare = alc680_capture_pcm_prepare,
19716 .cleanup = alc680_capture_pcm_cleanup
19720 static const struct snd_kcontrol_new alc680_base_mixer[] = {
19721 /* output mixer control */
19722 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19723 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19724 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19725 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19726 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19727 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19728 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19732 static const struct hda_bind_ctls alc680_bind_cap_vol = {
19733 .ops = &snd_hda_bind_vol,
19735 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19736 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19737 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19742 static const struct hda_bind_ctls alc680_bind_cap_switch = {
19743 .ops = &snd_hda_bind_sw,
19745 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19746 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19747 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19752 static const struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19753 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19754 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19759 * generic initialization of ADC, input mixers and output mixers
19761 static const struct hda_verb alc680_init_verbs[] = {
19762 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19763 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19764 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19766 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19769 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19770 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19775 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19777 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19779 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19780 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19781 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19786 /* toggle speaker-output according to the hp-jack state */
19787 static void alc680_base_setup(struct hda_codec *codec)
19789 struct alc_spec *spec = codec->spec;
19791 spec->autocfg.hp_pins[0] = 0x16;
19792 spec->autocfg.speaker_pins[0] = 0x14;
19793 spec->autocfg.speaker_pins[1] = 0x15;
19794 spec->autocfg.num_inputs = 2;
19795 spec->autocfg.inputs[0].pin = 0x18;
19796 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19797 spec->autocfg.inputs[1].pin = 0x19;
19798 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19799 spec->automute = 1;
19800 spec->automute_mode = ALC_AUTOMUTE_AMP;
19803 static void alc680_unsol_event(struct hda_codec *codec,
19806 if ((res >> 26) == ALC880_HP_EVENT)
19807 alc_hp_automute(codec);
19808 if ((res >> 26) == ALC880_MIC_EVENT)
19809 alc680_rec_autoswitch(codec);
19812 static void alc680_inithook(struct hda_codec *codec)
19814 alc_hp_automute(codec);
19815 alc680_rec_autoswitch(codec);
19818 /* create input playback/capture controls for the given pin */
19819 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19820 const char *ctlname, int idx)
19838 if (spec->multiout.dac_nids[0] != dac &&
19839 spec->multiout.dac_nids[1] != dac) {
19840 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19841 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19846 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19847 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19851 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19857 /* add playback controls from the parsed DAC table */
19858 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19859 const struct auto_pin_cfg *cfg)
19864 spec->multiout.dac_nids = spec->private_dac_nids;
19866 nid = cfg->line_out_pins[0];
19869 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19873 err = alc680_new_analog_output(spec, nid, name, 0);
19878 nid = cfg->speaker_pins[0];
19880 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19884 nid = cfg->hp_pins[0];
19886 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19894 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19895 hda_nid_t nid, int pin_type)
19897 alc_set_pin_output(codec, nid, pin_type);
19900 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19902 struct alc_spec *spec = codec->spec;
19903 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19905 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19906 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19910 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19912 struct alc_spec *spec = codec->spec;
19915 pin = spec->autocfg.hp_pins[0];
19917 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19918 pin = spec->autocfg.speaker_pins[0];
19920 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19923 /* pcm configuration: identical with ALC880 */
19924 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19925 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19926 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19927 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19928 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19931 * BIOS auto configuration
19933 static int alc680_parse_auto_config(struct hda_codec *codec)
19935 struct alc_spec *spec = codec->spec;
19937 static const hda_nid_t alc680_ignore[] = { 0 };
19939 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19944 if (!spec->autocfg.line_outs) {
19945 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19946 spec->multiout.max_channels = 2;
19947 spec->no_analog = 1;
19950 return 0; /* can't find valid BIOS pin config */
19952 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19956 spec->multiout.max_channels = 2;
19959 /* digital only support output */
19960 alc_auto_parse_digital(codec);
19961 if (spec->kctls.list)
19962 add_mixer(spec, spec->kctls.list);
19964 add_verb(spec, alc680_init_verbs);
19966 err = alc_auto_add_mic_boost(codec);
19973 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19975 /* init callback for auto-configuration model -- overriding the default init */
19976 static void alc680_auto_init(struct hda_codec *codec)
19978 struct alc_spec *spec = codec->spec;
19979 alc680_auto_init_multi_out(codec);
19980 alc680_auto_init_hp_out(codec);
19981 alc680_auto_init_analog_input(codec);
19982 alc_auto_init_digital(codec);
19983 if (spec->unsol_event)
19984 alc_inithook(codec);
19988 * configuration and preset
19990 static const char * const alc680_models[ALC680_MODEL_LAST] = {
19991 [ALC680_BASE] = "base",
19992 [ALC680_AUTO] = "auto",
19995 static const struct snd_pci_quirk alc680_cfg_tbl[] = {
19996 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20000 static const struct alc_config_preset alc680_presets[] = {
20002 .mixers = { alc680_base_mixer },
20003 .cap_mixer = alc680_master_capture_mixer,
20004 .init_verbs = { alc680_init_verbs },
20005 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
20006 .dac_nids = alc680_dac_nids,
20007 .dig_out_nid = ALC680_DIGOUT_NID,
20008 .num_channel_mode = ARRAY_SIZE(alc680_modes),
20009 .channel_mode = alc680_modes,
20010 .unsol_event = alc680_unsol_event,
20011 .setup = alc680_base_setup,
20012 .init_hook = alc680_inithook,
20017 static int patch_alc680(struct hda_codec *codec)
20019 struct alc_spec *spec;
20023 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
20027 codec->spec = spec;
20029 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
20033 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
20034 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
20036 board_config = ALC680_AUTO;
20039 if (board_config == ALC680_AUTO) {
20040 /* automatic parse from the BIOS config */
20041 err = alc680_parse_auto_config(codec);
20047 "hda_codec: Cannot set up configuration "
20048 "from BIOS. Using base mode...\n");
20049 board_config = ALC680_BASE;
20053 if (board_config != ALC680_AUTO)
20054 setup_preset(codec, &alc680_presets[board_config]);
20056 spec->stream_analog_playback = &alc680_pcm_analog_playback;
20057 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
20058 spec->stream_digital_playback = &alc680_pcm_digital_playback;
20059 spec->stream_digital_capture = &alc680_pcm_digital_capture;
20061 if (!spec->adc_nids) {
20062 spec->adc_nids = alc680_adc_nids;
20063 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
20066 if (!spec->cap_mixer)
20067 set_capture_mixer(codec);
20069 spec->vmaster_nid = 0x02;
20071 codec->patch_ops = alc_patch_ops;
20072 if (board_config == ALC680_AUTO)
20073 spec->init_hook = alc680_auto_init;
20081 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
20082 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
20083 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20084 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20085 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
20086 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
20087 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
20088 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20089 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20090 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20091 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
20092 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20093 .patch = patch_alc861 },
20094 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
20095 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
20096 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
20097 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
20098 .patch = patch_alc882 },
20099 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
20100 .patch = patch_alc662 },
20101 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
20102 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
20103 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
20104 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
20105 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
20106 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
20107 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
20108 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
20109 .patch = patch_alc882 },
20110 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
20111 .patch = patch_alc882 },
20112 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
20113 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
20114 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
20115 .patch = patch_alc882 },
20116 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20117 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20118 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20119 { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 },
20120 {} /* terminator */
20123 MODULE_ALIAS("snd-hda-codec-id:10ec*");
20125 MODULE_LICENSE("GPL");
20126 MODULE_DESCRIPTION("Realtek HD-audio codec");
20128 static struct hda_codec_preset_list realtek_list = {
20129 .preset = snd_hda_preset_realtek,
20130 .owner = THIS_MODULE,
20133 static int __init patch_realtek_init(void)
20135 return snd_hda_add_codec_preset(&realtek_list);
20138 static void __exit patch_realtek_exit(void)
20140 snd_hda_delete_codec_preset(&realtek_list);
20143 module_init(patch_realtek_init)
20144 module_exit(patch_realtek_exit)