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 */
351 hda_nid_t mixer_nid; /* analog-mixer NID */
353 /* capture setup for dynamic dual-adc switch */
354 unsigned int cur_adc_idx;
356 unsigned int cur_adc_stream_tag;
357 unsigned int cur_adc_format;
360 unsigned int num_mux_defs;
361 const struct hda_input_mux *input_mux;
362 unsigned int cur_mux[3];
363 struct alc_mic_route ext_mic;
364 struct alc_mic_route dock_mic;
365 struct alc_mic_route int_mic;
368 const struct hda_channel_mode *channel_mode;
369 int num_channel_mode;
371 int const_channel_count;
372 int ext_channel_count;
374 /* PCM information */
375 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
377 /* dynamic controls, init_verbs and input_mux */
378 struct auto_pin_cfg autocfg;
379 struct alc_customize_define cdefine;
380 struct snd_array kctls;
381 struct hda_input_mux private_imux[3];
382 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
383 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
384 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
387 void (*init_hook)(struct hda_codec *codec);
388 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
389 #ifdef CONFIG_SND_HDA_POWER_SAVE
390 void (*power_hook)(struct hda_codec *codec);
392 void (*shutup)(struct hda_codec *codec);
394 /* for pin sensing */
395 unsigned int jack_present: 1;
396 unsigned int line_jack_present:1;
397 unsigned int master_mute:1;
398 unsigned int auto_mic:1;
399 unsigned int automute:1; /* HP automute enabled */
400 unsigned int detect_line:1; /* Line-out detection enabled */
401 unsigned int automute_lines:1; /* automute line-out as well */
402 unsigned int automute_hp_lo:1; /* both HP and LO available */
405 unsigned int no_analog :1; /* digital I/O only */
406 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
407 unsigned int single_input_src:1;
409 /* auto-mute control */
411 hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS];
414 int codec_variant; /* flag for other variants */
416 /* for virtual master */
417 hda_nid_t vmaster_nid;
418 #ifdef CONFIG_SND_HDA_POWER_SAVE
419 struct hda_loopback_check loopback;
424 unsigned int pll_coef_idx, pll_coef_bit;
428 const struct alc_fixup *fixup_list;
429 const char *fixup_name;
433 struct alc_multi_io multi_io[4];
437 * configuration template - to be copied to the spec instance
439 struct alc_config_preset {
440 const struct snd_kcontrol_new *mixers[5]; /* should be identical size
443 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
444 const struct hda_verb *init_verbs[5];
445 unsigned int num_dacs;
446 const hda_nid_t *dac_nids;
447 hda_nid_t dig_out_nid; /* optional */
448 hda_nid_t hp_nid; /* optional */
449 const hda_nid_t *slave_dig_outs;
450 unsigned int num_adc_nids;
451 const hda_nid_t *adc_nids;
452 const hda_nid_t *capsrc_nids;
453 hda_nid_t dig_in_nid;
454 unsigned int num_channel_mode;
455 const struct hda_channel_mode *channel_mode;
457 int const_channel_count;
458 unsigned int num_mux_defs;
459 const struct hda_input_mux *input_mux;
460 void (*unsol_event)(struct hda_codec *, unsigned int);
461 void (*setup)(struct hda_codec *);
462 void (*init_hook)(struct hda_codec *);
463 #ifdef CONFIG_SND_HDA_POWER_SAVE
464 const struct hda_amp_list *loopbacks;
465 void (*power_hook)(struct hda_codec *codec);
473 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
474 struct snd_ctl_elem_info *uinfo)
476 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
477 struct alc_spec *spec = codec->spec;
478 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
479 if (mux_idx >= spec->num_mux_defs)
481 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
483 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
486 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
487 struct snd_ctl_elem_value *ucontrol)
489 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
490 struct alc_spec *spec = codec->spec;
491 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
493 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
497 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
498 struct snd_ctl_elem_value *ucontrol)
500 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
501 struct alc_spec *spec = codec->spec;
502 const struct hda_input_mux *imux;
503 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
504 unsigned int mux_idx;
505 hda_nid_t nid = spec->capsrc_nids ?
506 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
509 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
510 imux = &spec->input_mux[mux_idx];
511 if (!imux->num_items && mux_idx > 0)
512 imux = &spec->input_mux[0];
514 type = get_wcaps_type(get_wcaps(codec, nid));
515 if (type == AC_WID_AUD_MIX) {
516 /* Matrix-mixer style (e.g. ALC882) */
517 unsigned int *cur_val = &spec->cur_mux[adc_idx];
520 idx = ucontrol->value.enumerated.item[0];
521 if (idx >= imux->num_items)
522 idx = imux->num_items - 1;
525 for (i = 0; i < imux->num_items; i++) {
526 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
527 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
528 imux->items[i].index,
534 /* MUX style (e.g. ALC880) */
535 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
536 &spec->cur_mux[adc_idx]);
541 * channel mode setting
543 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_info *uinfo)
546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
547 struct alc_spec *spec = codec->spec;
548 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
549 spec->num_channel_mode);
552 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_value *ucontrol)
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
556 struct alc_spec *spec = codec->spec;
557 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
558 spec->num_channel_mode,
559 spec->ext_channel_count);
562 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
563 struct snd_ctl_elem_value *ucontrol)
565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
566 struct alc_spec *spec = codec->spec;
567 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
568 spec->num_channel_mode,
569 &spec->ext_channel_count);
570 if (err >= 0 && !spec->const_channel_count) {
571 spec->multiout.max_channels = spec->ext_channel_count;
572 if (spec->need_dac_fix)
573 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
579 * Control the mode of pin widget settings via the mixer. "pc" is used
580 * instead of "%" to avoid consequences of accidentally treating the % as
581 * being part of a format specifier. Maximum allowed length of a value is
582 * 63 characters plus NULL terminator.
584 * Note: some retasking pin complexes seem to ignore requests for input
585 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
586 * are requested. Therefore order this list so that this behaviour will not
587 * cause problems when mixer clients move through the enum sequentially.
588 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
591 static const char * const alc_pin_mode_names[] = {
592 "Mic 50pc bias", "Mic 80pc bias",
593 "Line in", "Line out", "Headphone out",
595 static const unsigned char alc_pin_mode_values[] = {
596 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
598 /* The control can present all 5 options, or it can limit the options based
599 * in the pin being assumed to be exclusively an input or an output pin. In
600 * addition, "input" pins may or may not process the mic bias option
601 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
602 * accept requests for bias as of chip versions up to March 2006) and/or
603 * wiring in the computer.
605 #define ALC_PIN_DIR_IN 0x00
606 #define ALC_PIN_DIR_OUT 0x01
607 #define ALC_PIN_DIR_INOUT 0x02
608 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
609 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
611 /* Info about the pin modes supported by the different pin direction modes.
612 * For each direction the minimum and maximum values are given.
614 static const signed char alc_pin_mode_dir_info[5][2] = {
615 { 0, 2 }, /* ALC_PIN_DIR_IN */
616 { 3, 4 }, /* ALC_PIN_DIR_OUT */
617 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
618 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
619 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
621 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
622 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
623 #define alc_pin_mode_n_items(_dir) \
624 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
626 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
627 struct snd_ctl_elem_info *uinfo)
629 unsigned int item_num = uinfo->value.enumerated.item;
630 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
632 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
634 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
636 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
637 item_num = alc_pin_mode_min(dir);
638 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
642 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
643 struct snd_ctl_elem_value *ucontrol)
646 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
647 hda_nid_t nid = kcontrol->private_value & 0xffff;
648 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
649 long *valp = ucontrol->value.integer.value;
650 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
651 AC_VERB_GET_PIN_WIDGET_CONTROL,
654 /* Find enumerated value for current pinctl setting */
655 i = alc_pin_mode_min(dir);
656 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
658 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
662 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
663 struct snd_ctl_elem_value *ucontrol)
666 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
667 hda_nid_t nid = kcontrol->private_value & 0xffff;
668 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
669 long val = *ucontrol->value.integer.value;
670 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
671 AC_VERB_GET_PIN_WIDGET_CONTROL,
674 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
675 val = alc_pin_mode_min(dir);
677 change = pinctl != alc_pin_mode_values[val];
679 /* Set pin mode to that requested */
680 snd_hda_codec_write_cache(codec, nid, 0,
681 AC_VERB_SET_PIN_WIDGET_CONTROL,
682 alc_pin_mode_values[val]);
684 /* Also enable the retasking pin's input/output as required
685 * for the requested pin mode. Enum values of 2 or less are
688 * Dynamically switching the input/output buffers probably
689 * reduces noise slightly (particularly on input) so we'll
690 * do it. However, having both input and output buffers
691 * enabled simultaneously doesn't seem to be problematic if
692 * this turns out to be necessary in the future.
695 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
696 HDA_AMP_MUTE, HDA_AMP_MUTE);
697 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
700 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
701 HDA_AMP_MUTE, HDA_AMP_MUTE);
702 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
709 #define ALC_PIN_MODE(xname, nid, dir) \
710 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
711 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
712 .info = alc_pin_mode_info, \
713 .get = alc_pin_mode_get, \
714 .put = alc_pin_mode_put, \
715 .private_value = nid | (dir<<16) }
717 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
718 * together using a mask with more than one bit set. This control is
719 * currently used only by the ALC260 test model. At this stage they are not
720 * needed for any "production" models.
722 #ifdef CONFIG_SND_DEBUG
723 #define alc_gpio_data_info snd_ctl_boolean_mono_info
725 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
726 struct snd_ctl_elem_value *ucontrol)
728 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
729 hda_nid_t nid = kcontrol->private_value & 0xffff;
730 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
731 long *valp = ucontrol->value.integer.value;
732 unsigned int val = snd_hda_codec_read(codec, nid, 0,
733 AC_VERB_GET_GPIO_DATA, 0x00);
735 *valp = (val & mask) != 0;
738 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
739 struct snd_ctl_elem_value *ucontrol)
742 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
743 hda_nid_t nid = kcontrol->private_value & 0xffff;
744 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
745 long val = *ucontrol->value.integer.value;
746 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
747 AC_VERB_GET_GPIO_DATA,
750 /* Set/unset the masked GPIO bit(s) as needed */
751 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
756 snd_hda_codec_write_cache(codec, nid, 0,
757 AC_VERB_SET_GPIO_DATA, gpio_data);
761 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
762 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
763 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
764 .info = alc_gpio_data_info, \
765 .get = alc_gpio_data_get, \
766 .put = alc_gpio_data_put, \
767 .private_value = nid | (mask<<16) }
768 #endif /* CONFIG_SND_DEBUG */
770 /* A switch control to allow the enabling of the digital IO pins on the
771 * ALC260. This is incredibly simplistic; the intention of this control is
772 * to provide something in the test model allowing digital outputs to be
773 * identified if present. If models are found which can utilise these
774 * outputs a more complete mixer control can be devised for those models if
777 #ifdef CONFIG_SND_DEBUG
778 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
780 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
781 struct snd_ctl_elem_value *ucontrol)
783 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
784 hda_nid_t nid = kcontrol->private_value & 0xffff;
785 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
786 long *valp = ucontrol->value.integer.value;
787 unsigned int val = snd_hda_codec_read(codec, nid, 0,
788 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
790 *valp = (val & mask) != 0;
793 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
794 struct snd_ctl_elem_value *ucontrol)
797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
798 hda_nid_t nid = kcontrol->private_value & 0xffff;
799 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
800 long val = *ucontrol->value.integer.value;
801 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
802 AC_VERB_GET_DIGI_CONVERT_1,
805 /* Set/unset the masked control bit(s) as needed */
806 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
811 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
816 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
817 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
818 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
819 .info = alc_spdif_ctrl_info, \
820 .get = alc_spdif_ctrl_get, \
821 .put = alc_spdif_ctrl_put, \
822 .private_value = nid | (mask<<16) }
823 #endif /* CONFIG_SND_DEBUG */
825 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
826 * Again, this is only used in the ALC26x test models to help identify when
827 * the EAPD line must be asserted for features to work.
829 #ifdef CONFIG_SND_DEBUG
830 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
832 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
833 struct snd_ctl_elem_value *ucontrol)
835 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
836 hda_nid_t nid = kcontrol->private_value & 0xffff;
837 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
838 long *valp = ucontrol->value.integer.value;
839 unsigned int val = snd_hda_codec_read(codec, nid, 0,
840 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
842 *valp = (val & mask) != 0;
846 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
847 struct snd_ctl_elem_value *ucontrol)
850 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
851 hda_nid_t nid = kcontrol->private_value & 0xffff;
852 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
853 long val = *ucontrol->value.integer.value;
854 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
855 AC_VERB_GET_EAPD_BTLENABLE,
858 /* Set/unset the masked control bit(s) as needed */
859 change = (!val ? 0 : mask) != (ctrl_data & mask);
864 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
870 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
871 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
872 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
873 .info = alc_eapd_ctrl_info, \
874 .get = alc_eapd_ctrl_get, \
875 .put = alc_eapd_ctrl_put, \
876 .private_value = nid | (mask<<16) }
877 #endif /* CONFIG_SND_DEBUG */
880 * set up the input pin config (depending on the given auto-pin type)
882 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
885 unsigned int val = PIN_IN;
887 if (auto_pin_type == AUTO_PIN_MIC) {
890 oldval = snd_hda_codec_read(codec, nid, 0,
891 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
892 pincap = snd_hda_query_pin_caps(codec, nid);
893 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
894 /* if the default pin setup is vref50, we give it priority */
895 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
897 else if (pincap & AC_PINCAP_VREF_50)
899 else if (pincap & AC_PINCAP_VREF_100)
901 else if (pincap & AC_PINCAP_VREF_GRD)
904 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
907 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
909 struct alc_spec *spec = codec->spec;
910 struct auto_pin_cfg *cfg = &spec->autocfg;
912 if (!cfg->line_outs) {
913 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
914 cfg->line_out_pins[cfg->line_outs])
917 if (!cfg->speaker_outs) {
918 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
919 cfg->speaker_pins[cfg->speaker_outs])
923 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
924 cfg->hp_pins[cfg->hp_outs])
931 static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
933 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
935 spec->mixers[spec->num_mixers++] = mix;
938 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
940 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
942 spec->init_verbs[spec->num_init_verbs++] = verb;
946 * set up from the preset table
948 static void setup_preset(struct hda_codec *codec,
949 const struct alc_config_preset *preset)
951 struct alc_spec *spec = codec->spec;
954 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
955 add_mixer(spec, preset->mixers[i]);
956 spec->cap_mixer = preset->cap_mixer;
957 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
959 add_verb(spec, preset->init_verbs[i]);
961 spec->channel_mode = preset->channel_mode;
962 spec->num_channel_mode = preset->num_channel_mode;
963 spec->need_dac_fix = preset->need_dac_fix;
964 spec->const_channel_count = preset->const_channel_count;
966 if (preset->const_channel_count)
967 spec->multiout.max_channels = preset->const_channel_count;
969 spec->multiout.max_channels = spec->channel_mode[0].channels;
970 spec->ext_channel_count = spec->channel_mode[0].channels;
972 spec->multiout.num_dacs = preset->num_dacs;
973 spec->multiout.dac_nids = preset->dac_nids;
974 spec->multiout.dig_out_nid = preset->dig_out_nid;
975 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
976 spec->multiout.hp_nid = preset->hp_nid;
978 spec->num_mux_defs = preset->num_mux_defs;
979 if (!spec->num_mux_defs)
980 spec->num_mux_defs = 1;
981 spec->input_mux = preset->input_mux;
983 spec->num_adc_nids = preset->num_adc_nids;
984 spec->adc_nids = preset->adc_nids;
985 spec->capsrc_nids = preset->capsrc_nids;
986 spec->dig_in_nid = preset->dig_in_nid;
988 spec->unsol_event = preset->unsol_event;
989 spec->init_hook = preset->init_hook;
990 #ifdef CONFIG_SND_HDA_POWER_SAVE
991 spec->power_hook = preset->power_hook;
992 spec->loopback.amplist = preset->loopbacks;
996 preset->setup(codec);
998 alc_fixup_autocfg_pin_nums(codec);
1001 /* Enable GPIO mask and set output */
1002 static const struct hda_verb alc_gpio1_init_verbs[] = {
1003 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
1004 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
1005 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
1009 static const struct hda_verb alc_gpio2_init_verbs[] = {
1010 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
1011 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
1012 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
1016 static const struct hda_verb alc_gpio3_init_verbs[] = {
1017 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
1018 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
1019 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
1024 * Fix hardware PLL issue
1025 * On some codecs, the analog PLL gating control must be off while
1026 * the default value is 1.
1028 static void alc_fix_pll(struct hda_codec *codec)
1030 struct alc_spec *spec = codec->spec;
1035 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1036 spec->pll_coef_idx);
1037 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1038 AC_VERB_GET_PROC_COEF, 0);
1039 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1040 spec->pll_coef_idx);
1041 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1042 val & ~(1 << spec->pll_coef_bit));
1045 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1046 unsigned int coef_idx, unsigned int coef_bit)
1048 struct alc_spec *spec = codec->spec;
1049 spec->pll_nid = nid;
1050 spec->pll_coef_idx = coef_idx;
1051 spec->pll_coef_bit = coef_bit;
1055 static int alc_init_jacks(struct hda_codec *codec)
1057 #ifdef CONFIG_SND_HDA_INPUT_JACK
1058 struct alc_spec *spec = codec->spec;
1060 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1061 unsigned int mic_nid = spec->ext_mic.pin;
1062 unsigned int dock_nid = spec->dock_mic.pin;
1065 err = snd_hda_input_jack_add(codec, hp_nid,
1066 SND_JACK_HEADPHONE, NULL);
1069 snd_hda_input_jack_report(codec, hp_nid);
1073 err = snd_hda_input_jack_add(codec, mic_nid,
1074 SND_JACK_MICROPHONE, NULL);
1077 snd_hda_input_jack_report(codec, mic_nid);
1080 err = snd_hda_input_jack_add(codec, dock_nid,
1081 SND_JACK_MICROPHONE, NULL);
1084 snd_hda_input_jack_report(codec, dock_nid);
1086 #endif /* CONFIG_SND_HDA_INPUT_JACK */
1090 static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
1094 for (i = 0; i < num_pins; i++) {
1095 hda_nid_t nid = pins[i];
1098 snd_hda_input_jack_report(codec, nid);
1099 present |= snd_hda_jack_detect(codec, nid);
1104 static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
1105 bool mute, bool hp_out)
1107 struct alc_spec *spec = codec->spec;
1108 unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0;
1109 unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT);
1112 for (i = 0; i < num_pins; i++) {
1113 hda_nid_t nid = pins[i];
1116 switch (spec->automute_mode) {
1117 case ALC_AUTOMUTE_PIN:
1118 snd_hda_codec_write(codec, nid, 0,
1119 AC_VERB_SET_PIN_WIDGET_CONTROL,
1122 case ALC_AUTOMUTE_AMP:
1123 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1124 HDA_AMP_MUTE, mute_bits);
1126 case ALC_AUTOMUTE_MIXER:
1127 nid = spec->automute_mixer_nid[i];
1130 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
1131 HDA_AMP_MUTE, mute_bits);
1132 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1,
1133 HDA_AMP_MUTE, mute_bits);
1139 /* Toggle internal speakers muting */
1140 static void update_speakers(struct hda_codec *codec)
1142 struct alc_spec *spec = codec->spec;
1145 /* Control HP pins/amps depending on master_mute state;
1146 * in general, HP pins/amps control should be enabled in all cases,
1147 * but currently set only for master_mute, just to be safe
1149 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1150 spec->autocfg.hp_pins, spec->master_mute, true);
1152 if (!spec->automute)
1155 on = spec->jack_present | spec->line_jack_present;
1156 on |= spec->master_mute;
1157 do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins),
1158 spec->autocfg.speaker_pins, on, false);
1160 /* toggle line-out mutes if needed, too */
1161 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1162 if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
1163 spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
1165 if (!spec->automute_lines || !spec->automute)
1168 on = spec->jack_present;
1169 on |= spec->master_mute;
1170 do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1171 spec->autocfg.line_out_pins, on, false);
1174 static void alc_hp_automute(struct hda_codec *codec)
1176 struct alc_spec *spec = codec->spec;
1178 if (!spec->automute)
1180 spec->jack_present =
1181 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1182 spec->autocfg.hp_pins);
1183 update_speakers(codec);
1186 static void alc_line_automute(struct hda_codec *codec)
1188 struct alc_spec *spec = codec->spec;
1190 if (!spec->automute || !spec->detect_line)
1192 spec->line_jack_present =
1193 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1194 spec->autocfg.line_out_pins);
1195 update_speakers(codec);
1198 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1201 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1204 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1205 for (i = 0; i < nums; i++)
1211 /* switch the current ADC according to the jack state */
1212 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1214 struct alc_spec *spec = codec->spec;
1215 unsigned int present;
1218 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1220 spec->cur_adc_idx = 1;
1222 spec->cur_adc_idx = 0;
1223 new_adc = spec->adc_nids[spec->cur_adc_idx];
1224 if (spec->cur_adc && spec->cur_adc != new_adc) {
1225 /* stream is running, let's swap the current ADC */
1226 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1227 spec->cur_adc = new_adc;
1228 snd_hda_codec_setup_stream(codec, new_adc,
1229 spec->cur_adc_stream_tag, 0,
1230 spec->cur_adc_format);
1234 static void alc_mic_automute(struct hda_codec *codec)
1236 struct alc_spec *spec = codec->spec;
1237 struct alc_mic_route *dead1, *dead2, *alive;
1238 unsigned int present, type;
1241 if (!spec->auto_mic)
1243 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1245 if (snd_BUG_ON(!spec->adc_nids))
1248 if (spec->dual_adc_switch) {
1249 alc_dual_mic_adc_auto_switch(codec);
1253 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1255 alive = &spec->int_mic;
1256 dead1 = &spec->ext_mic;
1257 dead2 = &spec->dock_mic;
1259 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1261 alive = &spec->ext_mic;
1262 dead1 = &spec->int_mic;
1263 dead2 = &spec->dock_mic;
1265 if (!present && spec->dock_mic.pin > 0) {
1266 present = snd_hda_jack_detect(codec, spec->dock_mic.pin);
1268 alive = &spec->dock_mic;
1269 dead1 = &spec->int_mic;
1270 dead2 = &spec->ext_mic;
1272 snd_hda_input_jack_report(codec, spec->dock_mic.pin);
1275 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1276 if (type == AC_WID_AUD_MIX) {
1277 /* Matrix-mixer style (e.g. ALC882) */
1278 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1282 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1284 HDA_AMP_MUTE, HDA_AMP_MUTE);
1286 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1288 HDA_AMP_MUTE, HDA_AMP_MUTE);
1290 /* MUX style (e.g. ALC880) */
1291 snd_hda_codec_write_cache(codec, cap_nid, 0,
1292 AC_VERB_SET_CONNECT_SEL,
1295 snd_hda_input_jack_report(codec, spec->ext_mic.pin);
1297 /* FIXME: analog mixer */
1300 /* unsolicited event for HP jack sensing */
1301 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1303 if (codec->vendor_id == 0x10ec0880)
1308 case ALC880_HP_EVENT:
1309 alc_hp_automute(codec);
1311 case ALC880_FRONT_EVENT:
1312 alc_line_automute(codec);
1314 case ALC880_MIC_EVENT:
1315 alc_mic_automute(codec);
1320 static void alc_inithook(struct hda_codec *codec)
1322 alc_hp_automute(codec);
1323 alc_line_automute(codec);
1324 alc_mic_automute(codec);
1327 /* additional initialization for ALC888 variants */
1328 static void alc888_coef_init(struct hda_codec *codec)
1332 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1333 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1334 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1335 if ((tmp & 0xf0) == 0x20)
1337 snd_hda_codec_read(codec, 0x20, 0,
1338 AC_VERB_SET_PROC_COEF, 0x830);
1341 snd_hda_codec_read(codec, 0x20, 0,
1342 AC_VERB_SET_PROC_COEF, 0x3030);
1345 static void alc889_coef_init(struct hda_codec *codec)
1349 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1350 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1351 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1352 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1355 /* turn on/off EAPD control (only if available) */
1356 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1358 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1360 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1361 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1365 /* turn on/off EAPD controls of the codec */
1366 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
1368 /* We currently only handle front, HP */
1369 switch (codec->vendor_id) {
1371 set_eapd(codec, 0x0f, on);
1372 set_eapd(codec, 0x10, on);
1387 set_eapd(codec, 0x14, on);
1388 set_eapd(codec, 0x15, on);
1393 /* generic shutup callback;
1394 * just turning off EPAD and a little pause for avoiding pop-noise
1396 static void alc_eapd_shutup(struct hda_codec *codec)
1398 alc_auto_setup_eapd(codec, false);
1402 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1407 case ALC_INIT_GPIO1:
1408 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1410 case ALC_INIT_GPIO2:
1411 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1413 case ALC_INIT_GPIO3:
1414 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1416 case ALC_INIT_DEFAULT:
1417 alc_auto_setup_eapd(codec, true);
1418 switch (codec->vendor_id) {
1420 snd_hda_codec_write(codec, 0x1a, 0,
1421 AC_VERB_SET_COEF_INDEX, 7);
1422 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1423 AC_VERB_GET_PROC_COEF, 0);
1424 snd_hda_codec_write(codec, 0x1a, 0,
1425 AC_VERB_SET_COEF_INDEX, 7);
1426 snd_hda_codec_write(codec, 0x1a, 0,
1427 AC_VERB_SET_PROC_COEF,
1436 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
1437 alc889_coef_init(codec);
1440 alc888_coef_init(codec);
1442 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1445 snd_hda_codec_write(codec, 0x20, 0,
1446 AC_VERB_SET_COEF_INDEX, 7);
1447 tmp = snd_hda_codec_read(codec, 0x20, 0,
1448 AC_VERB_GET_PROC_COEF, 0);
1449 snd_hda_codec_write(codec, 0x20, 0,
1450 AC_VERB_SET_COEF_INDEX, 7);
1451 snd_hda_codec_write(codec, 0x20, 0,
1452 AC_VERB_SET_PROC_COEF,
1461 static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
1462 struct snd_ctl_elem_info *uinfo)
1464 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1465 struct alc_spec *spec = codec->spec;
1466 static const char * const texts2[] = {
1467 "Disabled", "Enabled"
1469 static const char * const texts3[] = {
1470 "Disabled", "Speaker Only", "Line-Out+Speaker"
1472 const char * const *texts;
1474 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1476 if (spec->automute_hp_lo) {
1477 uinfo->value.enumerated.items = 3;
1480 uinfo->value.enumerated.items = 2;
1483 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1484 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
1485 strcpy(uinfo->value.enumerated.name,
1486 texts[uinfo->value.enumerated.item]);
1490 static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
1491 struct snd_ctl_elem_value *ucontrol)
1493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1494 struct alc_spec *spec = codec->spec;
1496 if (!spec->automute)
1498 else if (!spec->automute_lines)
1502 ucontrol->value.enumerated.item[0] = val;
1506 static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
1507 struct snd_ctl_elem_value *ucontrol)
1509 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1510 struct alc_spec *spec = codec->spec;
1512 switch (ucontrol->value.enumerated.item[0]) {
1514 if (!spec->automute)
1519 if (spec->automute && !spec->automute_lines)
1522 spec->automute_lines = 0;
1525 if (!spec->automute_hp_lo)
1527 if (spec->automute && spec->automute_lines)
1530 spec->automute_lines = 1;
1535 update_speakers(codec);
1539 static const struct snd_kcontrol_new alc_automute_mode_enum = {
1540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1541 .name = "Auto-Mute Mode",
1542 .info = alc_automute_mode_info,
1543 .get = alc_automute_mode_get,
1544 .put = alc_automute_mode_put,
1547 static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec);
1549 static int alc_add_automute_mode_enum(struct hda_codec *codec)
1551 struct alc_spec *spec = codec->spec;
1552 struct snd_kcontrol_new *knew;
1554 knew = alc_kcontrol_new(spec);
1557 *knew = alc_automute_mode_enum;
1558 knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
1564 static void alc_init_auto_hp(struct hda_codec *codec)
1566 struct alc_spec *spec = codec->spec;
1567 struct auto_pin_cfg *cfg = &spec->autocfg;
1571 if (cfg->hp_pins[0])
1573 if (cfg->line_out_pins[0])
1575 if (cfg->speaker_pins[0])
1577 if (present < 2) /* need two different output types */
1580 spec->automute_hp_lo = 1; /* both HP and LO automute */
1582 if (!cfg->speaker_pins[0]) {
1583 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1584 sizeof(cfg->speaker_pins));
1585 cfg->speaker_outs = cfg->line_outs;
1588 if (!cfg->hp_pins[0]) {
1589 memcpy(cfg->hp_pins, cfg->line_out_pins,
1590 sizeof(cfg->hp_pins));
1591 cfg->hp_outs = cfg->line_outs;
1594 for (i = 0; i < cfg->hp_outs; i++) {
1595 hda_nid_t nid = cfg->hp_pins[i];
1596 if (!is_jack_detectable(codec, nid))
1598 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1600 snd_hda_codec_write_cache(codec, nid, 0,
1601 AC_VERB_SET_UNSOLICITED_ENABLE,
1602 AC_USRSP_EN | ALC880_HP_EVENT);
1604 spec->automute_mode = ALC_AUTOMUTE_PIN;
1606 if (spec->automute && cfg->line_out_pins[0] &&
1607 cfg->line_out_pins[0] != cfg->hp_pins[0] &&
1608 cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1609 for (i = 0; i < cfg->line_outs; i++) {
1610 hda_nid_t nid = cfg->line_out_pins[i];
1611 if (!is_jack_detectable(codec, nid))
1613 snd_printdd("realtek: Enable Line-Out auto-muting "
1614 "on NID 0x%x\n", nid);
1615 snd_hda_codec_write_cache(codec, nid, 0,
1616 AC_VERB_SET_UNSOLICITED_ENABLE,
1617 AC_USRSP_EN | ALC880_FRONT_EVENT);
1618 spec->detect_line = 1;
1620 spec->automute_lines = spec->detect_line;
1623 if (spec->automute) {
1624 /* create a control for automute mode */
1625 alc_add_automute_mode_enum(codec);
1626 spec->unsol_event = alc_sku_unsol_event;
1630 static void alc_init_auto_mic(struct hda_codec *codec)
1632 struct alc_spec *spec = codec->spec;
1633 struct auto_pin_cfg *cfg = &spec->autocfg;
1634 hda_nid_t fixed, ext, dock;
1637 fixed = ext = dock = 0;
1638 for (i = 0; i < cfg->num_inputs; i++) {
1639 hda_nid_t nid = cfg->inputs[i].pin;
1640 unsigned int defcfg;
1641 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1642 switch (snd_hda_get_input_pin_attr(defcfg)) {
1643 case INPUT_PIN_ATTR_INT:
1645 return; /* already occupied */
1646 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1647 return; /* invalid type */
1650 case INPUT_PIN_ATTR_UNUSED:
1651 return; /* invalid entry */
1652 case INPUT_PIN_ATTR_DOCK:
1654 return; /* already occupied */
1655 if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
1656 return; /* invalid type */
1661 return; /* already occupied */
1662 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1663 return; /* invalid type */
1674 if (!is_jack_detectable(codec, ext))
1675 return; /* no unsol support */
1676 if (dock && !is_jack_detectable(codec, dock))
1677 return; /* no unsol support */
1678 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1680 spec->ext_mic.pin = ext;
1681 spec->dock_mic.pin = dock;
1682 spec->int_mic.pin = fixed;
1683 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1684 spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1685 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1687 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1688 AC_VERB_SET_UNSOLICITED_ENABLE,
1689 AC_USRSP_EN | ALC880_MIC_EVENT);
1690 spec->unsol_event = alc_sku_unsol_event;
1693 /* Could be any non-zero and even value. When used as fixup, tells
1694 * the driver to ignore any present sku defines.
1696 #define ALC_FIXUP_SKU_IGNORE (2)
1698 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1700 unsigned int ass, tmp, i;
1702 struct alc_spec *spec = codec->spec;
1704 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1706 if (spec->cdefine.fixup) {
1707 ass = spec->cdefine.sku_cfg;
1708 if (ass == ALC_FIXUP_SKU_IGNORE)
1713 ass = codec->subsystem_id & 0xffff;
1714 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1718 if (codec->vendor_id == 0x10ec0260)
1720 ass = snd_hda_codec_get_pincfg(codec, nid);
1723 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1724 codec->chip_name, ass);
1730 for (i = 1; i < 16; i++) {
1734 if (((ass >> 16) & 0xf) != tmp)
1737 spec->cdefine.port_connectivity = ass >> 30;
1738 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1739 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1740 spec->cdefine.customization = ass >> 8;
1742 spec->cdefine.sku_cfg = ass;
1743 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1744 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1745 spec->cdefine.swap = (ass & 0x2) >> 1;
1746 spec->cdefine.override = ass & 0x1;
1748 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1749 nid, spec->cdefine.sku_cfg);
1750 snd_printd("SKU: port_connectivity=0x%x\n",
1751 spec->cdefine.port_connectivity);
1752 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1753 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1754 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1755 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1756 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1757 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1758 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1763 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
1766 for (i = 0; i < nums; i++)
1772 /* check subsystem ID and set up device-specific initialization;
1773 * return 1 if initialized, 0 if invalid SSID
1775 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1776 * 31 ~ 16 : Manufacture ID
1778 * 7 ~ 0 : Assembly ID
1779 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1781 static int alc_subsystem_id(struct hda_codec *codec,
1782 hda_nid_t porta, hda_nid_t porte,
1783 hda_nid_t portd, hda_nid_t porti)
1785 unsigned int ass, tmp, i;
1787 struct alc_spec *spec = codec->spec;
1789 if (spec->cdefine.fixup) {
1790 ass = spec->cdefine.sku_cfg;
1791 if (ass == ALC_FIXUP_SKU_IGNORE)
1796 ass = codec->subsystem_id & 0xffff;
1797 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1800 /* invalid SSID, check the special NID pin defcfg instead */
1802 * 31~30 : port connectivity
1805 * 19~16 : Check sum (15:1)
1810 if (codec->vendor_id == 0x10ec0260)
1812 ass = snd_hda_codec_get_pincfg(codec, nid);
1813 snd_printd("realtek: No valid SSID, "
1814 "checking pincfg 0x%08x for NID 0x%x\n",
1818 if ((ass >> 30) != 1) /* no physical connection */
1823 for (i = 1; i < 16; i++) {
1827 if (((ass >> 16) & 0xf) != tmp)
1830 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1831 ass & 0xffff, codec->vendor_id);
1835 * 2 : 0 --> Desktop, 1 --> Laptop
1836 * 3~5 : External Amplifier control
1839 tmp = (ass & 0x38) >> 3; /* external Amp control */
1842 spec->init_amp = ALC_INIT_GPIO1;
1845 spec->init_amp = ALC_INIT_GPIO2;
1848 spec->init_amp = ALC_INIT_GPIO3;
1852 spec->init_amp = ALC_INIT_DEFAULT;
1856 /* is laptop or Desktop and enable the function "Mute internal speaker
1857 * when the external headphone out jack is plugged"
1859 if (!(ass & 0x8000))
1862 * 10~8 : Jack location
1863 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1865 * 15 : 1 --> enable the function "Mute internal speaker
1866 * when the external headphone out jack is plugged"
1868 if (!spec->autocfg.hp_pins[0]) {
1870 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1881 if (found_in_nid_list(nid, spec->autocfg.line_out_pins,
1882 spec->autocfg.line_outs))
1884 spec->autocfg.hp_pins[0] = nid;
1889 static void alc_ssid_check(struct hda_codec *codec,
1890 hda_nid_t porta, hda_nid_t porte,
1891 hda_nid_t portd, hda_nid_t porti)
1893 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1894 struct alc_spec *spec = codec->spec;
1895 snd_printd("realtek: "
1896 "Enable default setup for auto mode as fallback\n");
1897 spec->init_amp = ALC_INIT_DEFAULT;
1900 alc_init_auto_hp(codec);
1901 alc_init_auto_mic(codec);
1905 * Fix-up pin default configurations and add default verbs
1913 struct alc_model_fixup {
1924 const struct alc_pincfg *pins;
1925 const struct hda_verb *verbs;
1926 void (*func)(struct hda_codec *codec,
1927 const struct alc_fixup *fix,
1941 ALC_FIXUP_ACT_PRE_PROBE,
1942 ALC_FIXUP_ACT_PROBE,
1946 static void alc_apply_fixup(struct hda_codec *codec, int action)
1948 struct alc_spec *spec = codec->spec;
1949 int id = spec->fixup_id;
1950 #ifdef CONFIG_SND_DEBUG_VERBOSE
1951 const char *modelname = spec->fixup_name;
1955 if (!spec->fixup_list)
1959 const struct alc_fixup *fix = spec->fixup_list + id;
1960 const struct alc_pincfg *cfg;
1962 switch (fix->type) {
1964 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1966 snd_printdd(KERN_INFO "hda_codec: %s: "
1967 "Apply sku override for %s\n",
1968 codec->chip_name, modelname);
1969 spec->cdefine.sku_cfg = fix->v.sku;
1970 spec->cdefine.fixup = 1;
1972 case ALC_FIXUP_PINS:
1974 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1976 snd_printdd(KERN_INFO "hda_codec: %s: "
1977 "Apply pincfg for %s\n",
1978 codec->chip_name, modelname);
1979 for (; cfg->nid; cfg++)
1980 snd_hda_codec_set_pincfg(codec, cfg->nid,
1983 case ALC_FIXUP_VERBS:
1984 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1986 snd_printdd(KERN_INFO "hda_codec: %s: "
1987 "Apply fix-verbs for %s\n",
1988 codec->chip_name, modelname);
1989 add_verb(codec->spec, fix->v.verbs);
1991 case ALC_FIXUP_FUNC:
1994 snd_printdd(KERN_INFO "hda_codec: %s: "
1995 "Apply fix-func for %s\n",
1996 codec->chip_name, modelname);
1997 fix->v.func(codec, fix, action);
2000 snd_printk(KERN_ERR "hda_codec: %s: "
2001 "Invalid fixup type %d\n",
2002 codec->chip_name, fix->type);
2013 static void alc_pick_fixup(struct hda_codec *codec,
2014 const struct alc_model_fixup *models,
2015 const struct snd_pci_quirk *quirk,
2016 const struct alc_fixup *fixlist)
2018 struct alc_spec *spec = codec->spec;
2020 const char *name = NULL;
2022 if (codec->modelname && models) {
2023 while (models->name) {
2024 if (!strcmp(codec->modelname, models->name)) {
2026 name = models->name;
2033 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
2036 #ifdef CONFIG_SND_DEBUG_VERBOSE
2042 spec->fixup_id = id;
2044 spec->fixup_list = fixlist;
2045 spec->fixup_name = name;
2049 static int alc_read_coef_idx(struct hda_codec *codec,
2050 unsigned int coef_idx)
2053 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
2055 val = snd_hda_codec_read(codec, 0x20, 0,
2056 AC_VERB_GET_PROC_COEF, 0);
2060 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
2061 unsigned int coef_val)
2063 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
2065 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
2069 /* set right pin controls for digital I/O */
2070 static void alc_auto_init_digital(struct hda_codec *codec)
2072 struct alc_spec *spec = codec->spec;
2076 for (i = 0; i < spec->autocfg.dig_outs; i++) {
2077 pin = spec->autocfg.dig_out_pins[i];
2080 snd_hda_codec_write(codec, pin, 0,
2081 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2083 dac = spec->multiout.dig_out_nid;
2085 dac = spec->slave_dig_outs[i - 1];
2086 if (!dac || !(get_wcaps(codec, dac) & AC_WCAP_OUT_AMP))
2088 snd_hda_codec_write(codec, dac, 0,
2089 AC_VERB_SET_AMP_GAIN_MUTE,
2092 pin = spec->autocfg.dig_in_pin;
2094 snd_hda_codec_write(codec, pin, 0,
2095 AC_VERB_SET_PIN_WIDGET_CONTROL,
2099 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
2100 static void alc_auto_parse_digital(struct hda_codec *codec)
2102 struct alc_spec *spec = codec->spec;
2106 /* support multiple SPDIFs; the secondary is set up as a slave */
2107 for (i = 0; i < spec->autocfg.dig_outs; i++) {
2108 err = snd_hda_get_connections(codec,
2109 spec->autocfg.dig_out_pins[i],
2114 spec->multiout.dig_out_nid = dig_nid;
2115 spec->dig_out_type = spec->autocfg.dig_out_type[0];
2117 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
2118 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
2120 spec->slave_dig_outs[i - 1] = dig_nid;
2124 if (spec->autocfg.dig_in_pin) {
2125 dig_nid = codec->start_nid;
2126 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
2127 unsigned int wcaps = get_wcaps(codec, dig_nid);
2128 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
2130 if (!(wcaps & AC_WCAP_DIGITAL))
2132 if (!(wcaps & AC_WCAP_CONN_LIST))
2134 err = get_connection_index(codec, dig_nid,
2135 spec->autocfg.dig_in_pin);
2137 spec->dig_in_nid = dig_nid;
2151 static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
2152 /* Mic-in jack as mic in */
2153 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2154 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2155 /* Line-in jack as Line in */
2156 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2157 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2158 /* Line-Out as Front */
2159 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
2166 static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
2167 /* Mic-in jack as mic in */
2168 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2169 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2170 /* Line-in jack as Surround */
2171 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2172 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2173 /* Line-Out as Front */
2174 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
2181 static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
2182 /* Mic-in jack as CLFE */
2183 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2184 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2185 /* Line-in jack as Surround */
2186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2188 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
2189 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2196 static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
2197 /* Mic-in jack as CLFE */
2198 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2199 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2200 /* Line-in jack as Surround */
2201 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2202 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2203 /* Line-Out as Side */
2204 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2208 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
2209 { 2, alc888_4ST_ch2_intel_init },
2210 { 4, alc888_4ST_ch4_intel_init },
2211 { 6, alc888_4ST_ch6_intel_init },
2212 { 8, alc888_4ST_ch8_intel_init },
2216 * ALC888 Fujitsu Siemens Amillo xa3530
2219 static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
2220 /* Front Mic: set to PIN_IN (empty by default) */
2221 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2222 /* Connect Internal HP to Front */
2223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2224 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2225 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2226 /* Connect Bass HP to Front */
2227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2229 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2230 /* Connect Line-Out side jack (SPDIF) to Side */
2231 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2232 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2233 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2234 /* Connect Mic jack to CLFE */
2235 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2236 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2237 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2238 /* Connect Line-in jack to Surround */
2239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2240 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2241 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2242 /* Connect HP out jack to Front */
2243 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2244 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2245 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2246 /* Enable unsolicited event for HP jack and Line-out jack */
2247 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2248 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2252 static void alc889_automute_setup(struct hda_codec *codec)
2254 struct alc_spec *spec = codec->spec;
2256 spec->autocfg.hp_pins[0] = 0x15;
2257 spec->autocfg.speaker_pins[0] = 0x14;
2258 spec->autocfg.speaker_pins[1] = 0x16;
2259 spec->autocfg.speaker_pins[2] = 0x17;
2260 spec->autocfg.speaker_pins[3] = 0x19;
2261 spec->autocfg.speaker_pins[4] = 0x1a;
2263 spec->automute_mode = ALC_AUTOMUTE_AMP;
2266 static void alc889_intel_init_hook(struct hda_codec *codec)
2268 alc889_coef_init(codec);
2269 alc_hp_automute(codec);
2272 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
2274 struct alc_spec *spec = codec->spec;
2276 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
2277 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2278 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2279 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2281 spec->automute_mode = ALC_AUTOMUTE_AMP;
2285 * ALC888 Acer Aspire 4930G model
2288 static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2289 /* Front Mic: set to PIN_IN (empty by default) */
2290 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2291 /* Unselect Front Mic by default in input mixer 3 */
2292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2293 /* Enable unsolicited event for HP jack */
2294 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2295 /* Connect Internal HP to front */
2296 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2297 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2298 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2299 /* Connect HP out to front */
2300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2302 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2303 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2308 * ALC888 Acer Aspire 6530G model
2311 static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2312 /* Route to built-in subwoofer as well as speakers */
2313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2317 /* Bias voltage on for external mic port */
2318 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2319 /* Front Mic: set to PIN_IN (empty by default) */
2320 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2321 /* Unselect Front Mic by default in input mixer 3 */
2322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2323 /* Enable unsolicited event for HP jack */
2324 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2325 /* Enable speaker output */
2326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2328 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2329 /* Enable headphone output */
2330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2332 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2333 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2338 *ALC888 Acer Aspire 7730G model
2341 static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2342 /* Bias voltage on for external mic port */
2343 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2344 /* Front Mic: set to PIN_IN (empty by default) */
2345 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2346 /* Unselect Front Mic by default in input mixer 3 */
2347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2348 /* Enable unsolicited event for HP jack */
2349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2350 /* Enable speaker output */
2351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2353 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2354 /* Enable headphone output */
2355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2358 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2359 /*Enable internal subwoofer */
2360 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2361 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2362 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2363 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2368 * ALC889 Acer Aspire 8930G model
2371 static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2372 /* Front Mic: set to PIN_IN (empty by default) */
2373 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2374 /* Unselect Front Mic by default in input mixer 3 */
2375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2376 /* Enable unsolicited event for HP jack */
2377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2378 /* Connect Internal Front to Front */
2379 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2380 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2381 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2382 /* Connect Internal Rear to Rear */
2383 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2384 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2385 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2386 /* Connect Internal CLFE to CLFE */
2387 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2388 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2389 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2390 /* Connect HP out to Front */
2391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2392 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2393 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2394 /* Enable all DACs */
2395 /* DAC DISABLE/MUTE 1? */
2396 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2397 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2398 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2399 /* DAC DISABLE/MUTE 2? */
2400 /* some bit here disables the other DACs. Init=0x4900 */
2401 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2402 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2404 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2405 * which makes the stereo useless. However, either the mic or the ALC889
2406 * makes the signal become a difference/sum signal instead of standard
2407 * stereo, which is annoying. So instead we flip this bit which makes the
2408 * codec replicate the sum signal to both channels, turning it into a
2411 /* DMIC_CONTROL? Init value = 0x0001 */
2412 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2413 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2417 static const struct hda_input_mux alc888_2_capture_sources[2] = {
2418 /* Front mic only available on one ADC */
2425 { "Front Mic", 0xb },
2438 static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2439 /* Interal mic only available on one ADC */
2446 { "Input Mix", 0xa },
2447 { "Internal Mic", 0xb },
2456 { "Input Mix", 0xa },
2461 static const struct hda_input_mux alc889_capture_sources[3] = {
2462 /* Digital mic only available on first "ADC" */
2469 { "Front Mic", 0xb },
2470 { "Input Mix", 0xa },
2479 { "Input Mix", 0xa },
2488 { "Input Mix", 0xa },
2493 static const struct snd_kcontrol_new alc888_base_mixer[] = {
2494 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2495 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2496 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2497 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2498 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2500 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2501 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2502 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2503 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2504 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2505 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2506 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2507 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2508 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2510 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2511 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2515 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2516 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2517 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2518 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2519 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2520 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2522 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2523 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2524 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2525 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
2526 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
2527 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2528 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2529 HDA_CODEC_VOLUME("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),
2537 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2538 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2539 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2540 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2541 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2542 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2544 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2545 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2546 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2547 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2548 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2549 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2550 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2556 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2558 struct alc_spec *spec = codec->spec;
2560 spec->autocfg.hp_pins[0] = 0x15;
2561 spec->autocfg.speaker_pins[0] = 0x14;
2562 spec->autocfg.speaker_pins[1] = 0x16;
2563 spec->autocfg.speaker_pins[2] = 0x17;
2565 spec->automute_mode = ALC_AUTOMUTE_AMP;
2568 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2570 struct alc_spec *spec = codec->spec;
2572 spec->autocfg.hp_pins[0] = 0x15;
2573 spec->autocfg.speaker_pins[0] = 0x14;
2574 spec->autocfg.speaker_pins[1] = 0x16;
2575 spec->autocfg.speaker_pins[2] = 0x17;
2577 spec->automute_mode = ALC_AUTOMUTE_AMP;
2580 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2582 struct alc_spec *spec = codec->spec;
2584 spec->autocfg.hp_pins[0] = 0x15;
2585 spec->autocfg.speaker_pins[0] = 0x14;
2586 spec->autocfg.speaker_pins[1] = 0x16;
2587 spec->autocfg.speaker_pins[2] = 0x17;
2589 spec->automute_mode = ALC_AUTOMUTE_AMP;
2592 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2594 struct alc_spec *spec = codec->spec;
2596 spec->autocfg.hp_pins[0] = 0x15;
2597 spec->autocfg.speaker_pins[0] = 0x14;
2598 spec->autocfg.speaker_pins[1] = 0x16;
2599 spec->autocfg.speaker_pins[2] = 0x1b;
2601 spec->automute_mode = ALC_AUTOMUTE_AMP;
2605 * ALC880 3-stack model
2607 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2608 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2609 * F-Mic = 0x1b, HP = 0x19
2612 static const hda_nid_t alc880_dac_nids[4] = {
2613 /* front, rear, clfe, rear_surr */
2614 0x02, 0x05, 0x04, 0x03
2617 static const hda_nid_t alc880_adc_nids[3] = {
2622 /* The datasheet says the node 0x07 is connected from inputs,
2623 * but it shows zero connection in the real implementation on some devices.
2624 * Note: this is a 915GAV bug, fixed on 915GLV
2626 static const hda_nid_t alc880_adc_nids_alt[2] = {
2631 #define ALC880_DIGOUT_NID 0x06
2632 #define ALC880_DIGIN_NID 0x0a
2634 static const struct hda_input_mux alc880_capture_source = {
2638 { "Front Mic", 0x3 },
2644 /* channel source setting (2/6 channel selection for 3-stack) */
2646 static const struct hda_verb alc880_threestack_ch2_init[] = {
2647 /* set line-in to input, mute it */
2648 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2649 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2650 /* set mic-in to input vref 80%, mute it */
2651 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2652 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2657 static const struct hda_verb alc880_threestack_ch6_init[] = {
2658 /* set line-in to output, unmute it */
2659 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2660 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2661 /* set mic-in to output, unmute it */
2662 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2663 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2667 static const struct hda_channel_mode alc880_threestack_modes[2] = {
2668 { 2, alc880_threestack_ch2_init },
2669 { 6, alc880_threestack_ch6_init },
2672 static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2673 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2674 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2675 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2676 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2677 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2678 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2679 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2680 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2681 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2682 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2683 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2684 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2685 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2686 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2687 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2688 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2691 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2692 .name = "Channel Mode",
2693 .info = alc_ch_mode_info,
2694 .get = alc_ch_mode_get,
2695 .put = alc_ch_mode_put,
2700 /* capture mixer elements */
2701 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2702 struct snd_ctl_elem_info *uinfo)
2704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2705 struct alc_spec *spec = codec->spec;
2708 mutex_lock(&codec->control_mutex);
2709 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2711 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2712 mutex_unlock(&codec->control_mutex);
2716 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2717 unsigned int size, unsigned int __user *tlv)
2719 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2720 struct alc_spec *spec = codec->spec;
2723 mutex_lock(&codec->control_mutex);
2724 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2726 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2727 mutex_unlock(&codec->control_mutex);
2731 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2732 struct snd_ctl_elem_value *ucontrol);
2734 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2735 struct snd_ctl_elem_value *ucontrol,
2738 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2739 struct alc_spec *spec = codec->spec;
2740 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2743 mutex_lock(&codec->control_mutex);
2744 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2746 err = func(kcontrol, ucontrol);
2747 mutex_unlock(&codec->control_mutex);
2751 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2752 struct snd_ctl_elem_value *ucontrol)
2754 return alc_cap_getput_caller(kcontrol, ucontrol,
2755 snd_hda_mixer_amp_volume_get);
2758 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2759 struct snd_ctl_elem_value *ucontrol)
2761 return alc_cap_getput_caller(kcontrol, ucontrol,
2762 snd_hda_mixer_amp_volume_put);
2765 /* capture mixer elements */
2766 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2768 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2769 struct snd_ctl_elem_value *ucontrol)
2771 return alc_cap_getput_caller(kcontrol, ucontrol,
2772 snd_hda_mixer_amp_switch_get);
2775 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2776 struct snd_ctl_elem_value *ucontrol)
2778 return alc_cap_getput_caller(kcontrol, ucontrol,
2779 snd_hda_mixer_amp_switch_put);
2782 #define _DEFINE_CAPMIX(num) \
2784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2785 .name = "Capture Switch", \
2786 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2788 .info = alc_cap_sw_info, \
2789 .get = alc_cap_sw_get, \
2790 .put = alc_cap_sw_put, \
2793 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2794 .name = "Capture Volume", \
2795 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2796 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2797 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2799 .info = alc_cap_vol_info, \
2800 .get = alc_cap_vol_get, \
2801 .put = alc_cap_vol_put, \
2802 .tlv = { .c = alc_cap_vol_tlv }, \
2805 #define _DEFINE_CAPSRC(num) \
2807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2808 /* .name = "Capture Source", */ \
2809 .name = "Input Source", \
2811 .info = alc_mux_enum_info, \
2812 .get = alc_mux_enum_get, \
2813 .put = alc_mux_enum_put, \
2816 #define DEFINE_CAPMIX(num) \
2817 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2818 _DEFINE_CAPMIX(num), \
2819 _DEFINE_CAPSRC(num), \
2823 #define DEFINE_CAPMIX_NOSRC(num) \
2824 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2825 _DEFINE_CAPMIX(num), \
2829 /* up to three ADCs */
2833 DEFINE_CAPMIX_NOSRC(1);
2834 DEFINE_CAPMIX_NOSRC(2);
2835 DEFINE_CAPMIX_NOSRC(3);
2838 * ALC880 5-stack model
2840 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2842 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2843 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2846 /* additional mixers to alc880_three_stack_mixer */
2847 static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2848 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2849 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2853 /* channel source setting (6/8 channel selection for 5-stack) */
2855 static const struct hda_verb alc880_fivestack_ch6_init[] = {
2856 /* set line-in to input, mute it */
2857 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2858 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2863 static const struct hda_verb alc880_fivestack_ch8_init[] = {
2864 /* set line-in to output, unmute it */
2865 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2866 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2870 static const struct hda_channel_mode alc880_fivestack_modes[2] = {
2871 { 6, alc880_fivestack_ch6_init },
2872 { 8, alc880_fivestack_ch8_init },
2877 * ALC880 6-stack model
2879 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2880 * Side = 0x05 (0x0f)
2881 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2882 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2885 static const hda_nid_t alc880_6st_dac_nids[4] = {
2886 /* front, rear, clfe, rear_surr */
2887 0x02, 0x03, 0x04, 0x05
2890 static const struct hda_input_mux alc880_6stack_capture_source = {
2894 { "Front Mic", 0x1 },
2900 /* fixed 8-channels */
2901 static const struct hda_channel_mode alc880_sixstack_modes[1] = {
2905 static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2906 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2907 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2908 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2909 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2910 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2911 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2912 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2913 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2914 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2915 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2916 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2917 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2918 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2919 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2926 .name = "Channel Mode",
2927 .info = alc_ch_mode_info,
2928 .get = alc_ch_mode_get,
2929 .put = alc_ch_mode_put,
2938 * W810 has rear IO for:
2941 * Center/LFE (DAC 04)
2944 * The system also has a pair of internal speakers, and a headphone jack.
2945 * These are both connected to Line2 on the codec, hence to DAC 02.
2947 * There is a variable resistor to control the speaker or headphone
2948 * volume. This is a hardware-only device without a software API.
2950 * Plugging headphones in will disable the internal speakers. This is
2951 * implemented in hardware, not via the driver using jack sense. In
2952 * a similar fashion, plugging into the rear socket marked "front" will
2953 * disable both the speakers and headphones.
2955 * For input, there's a microphone jack, and an "audio in" jack.
2956 * These may not do anything useful with this driver yet, because I
2957 * haven't setup any initialization verbs for these yet...
2960 static const hda_nid_t alc880_w810_dac_nids[3] = {
2961 /* front, rear/surround, clfe */
2965 /* fixed 6 channels */
2966 static const struct hda_channel_mode alc880_w810_modes[1] = {
2970 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2971 static const struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2975 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2976 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2977 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2978 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2979 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2980 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2988 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2989 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2993 static const hda_nid_t alc880_z71v_dac_nids[1] = {
2996 #define ALC880_Z71V_HP_DAC 0x03
2998 /* fixed 2 channels */
2999 static const struct hda_channel_mode alc880_2_jack_modes[1] = {
3003 static const struct snd_kcontrol_new alc880_z71v_mixer[] = {
3004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3005 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3006 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3007 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
3008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3011 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3017 * ALC880 F1734 model
3019 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
3020 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
3023 static const hda_nid_t alc880_f1734_dac_nids[1] = {
3026 #define ALC880_F1734_HP_DAC 0x02
3028 static const struct snd_kcontrol_new alc880_f1734_mixer[] = {
3029 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3030 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3031 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3032 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3033 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3034 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3040 static const struct hda_input_mux alc880_f1734_capture_source = {
3052 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3053 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3054 * Mic = 0x18, Line = 0x1a
3057 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3058 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3060 static const struct snd_kcontrol_new alc880_asus_mixer[] = {
3061 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3062 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3063 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3064 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3065 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3066 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3067 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3068 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3069 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3070 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3071 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3072 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3073 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3074 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3077 .name = "Channel Mode",
3078 .info = alc_ch_mode_info,
3079 .get = alc_ch_mode_get,
3080 .put = alc_ch_mode_put,
3086 * ALC880 ASUS W1V model
3088 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
3089 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
3090 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
3093 /* additional mixers to alc880_asus_mixer */
3094 static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
3095 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
3096 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
3101 static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
3102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3103 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
3104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
3105 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
3106 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
3107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
3108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
3109 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
3110 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
3115 static const struct snd_kcontrol_new alc880_uniwill_mixer[] = {
3116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3117 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3118 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3119 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3120 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3121 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3122 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3123 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3130 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3131 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3133 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3134 .name = "Channel Mode",
3135 .info = alc_ch_mode_info,
3136 .get = alc_ch_mode_get,
3137 .put = alc_ch_mode_put,
3142 static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
3143 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3144 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3145 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3146 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3147 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
3148 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
3149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3151 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3152 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3156 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
3157 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3158 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3159 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3160 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
3161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3167 * virtual master controls
3171 * slave controls for virtual master
3173 static const char * const alc_slave_vols[] = {
3174 "Front Playback Volume",
3175 "Surround Playback Volume",
3176 "Center Playback Volume",
3177 "LFE Playback Volume",
3178 "Side Playback Volume",
3179 "Headphone Playback Volume",
3180 "Speaker Playback Volume",
3181 "Mono Playback Volume",
3182 "Line-Out Playback Volume",
3186 static const char * const alc_slave_sws[] = {
3187 "Front Playback Switch",
3188 "Surround Playback Switch",
3189 "Center Playback Switch",
3190 "LFE Playback Switch",
3191 "Side Playback Switch",
3192 "Headphone Playback Switch",
3193 "Speaker Playback Switch",
3194 "Mono Playback Switch",
3195 "IEC958 Playback Switch",
3196 "Line-Out Playback Switch",
3201 * build control elements
3204 #define NID_MAPPING (-1)
3206 #define SUBDEV_SPEAKER_ (0 << 6)
3207 #define SUBDEV_HP_ (1 << 6)
3208 #define SUBDEV_LINE_ (2 << 6)
3209 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
3210 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
3211 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
3213 static void alc_free_kctls(struct hda_codec *codec);
3215 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3216 /* additional beep mixers; the actual parameters are overwritten at build */
3217 static const struct snd_kcontrol_new alc_beep_mixer[] = {
3218 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
3219 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
3224 static int alc_build_controls(struct hda_codec *codec)
3226 struct alc_spec *spec = codec->spec;
3227 struct snd_kcontrol *kctl = NULL;
3228 const struct snd_kcontrol_new *knew;
3233 for (i = 0; i < spec->num_mixers; i++) {
3234 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
3238 if (spec->cap_mixer) {
3239 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
3243 if (spec->multiout.dig_out_nid) {
3244 err = snd_hda_create_spdif_out_ctls(codec,
3245 spec->multiout.dig_out_nid,
3246 spec->multiout.dig_out_nid);
3249 if (!spec->no_analog) {
3250 err = snd_hda_create_spdif_share_sw(codec,
3254 spec->multiout.share_spdif = 1;
3257 if (spec->dig_in_nid) {
3258 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
3263 #ifdef CONFIG_SND_HDA_INPUT_BEEP
3264 /* create beep controls if needed */
3265 if (spec->beep_amp) {
3266 const struct snd_kcontrol_new *knew;
3267 for (knew = alc_beep_mixer; knew->name; knew++) {
3268 struct snd_kcontrol *kctl;
3269 kctl = snd_ctl_new1(knew, codec);
3272 kctl->private_value = spec->beep_amp;
3273 err = snd_hda_ctl_add(codec, 0, kctl);
3280 /* if we have no master control, let's create it */
3281 if (!spec->no_analog &&
3282 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
3283 unsigned int vmaster_tlv[4];
3284 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
3285 HDA_OUTPUT, vmaster_tlv);
3286 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
3287 vmaster_tlv, alc_slave_vols);
3291 if (!spec->no_analog &&
3292 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
3293 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
3294 NULL, alc_slave_sws);
3299 /* assign Capture Source enums to NID */
3300 if (spec->capsrc_nids || spec->adc_nids) {
3301 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
3303 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3304 for (i = 0; kctl && i < kctl->count; i++) {
3305 const hda_nid_t *nids = spec->capsrc_nids;
3307 nids = spec->adc_nids;
3308 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
3313 if (spec->cap_mixer) {
3314 const char *kname = kctl ? kctl->id.name : NULL;
3315 for (knew = spec->cap_mixer; knew->name; knew++) {
3316 if (kname && strcmp(knew->name, kname) == 0)
3318 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3319 for (i = 0; kctl && i < kctl->count; i++) {
3320 err = snd_hda_add_nid(codec, kctl, i,
3328 /* other nid->control mapping */
3329 for (i = 0; i < spec->num_mixers; i++) {
3330 for (knew = spec->mixers[i]; knew->name; knew++) {
3331 if (knew->iface != NID_MAPPING)
3333 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
3336 u = knew->subdevice;
3337 for (j = 0; j < 4; j++, u >>= 8) {
3342 case SUBDEV_SPEAKER_:
3343 nid = spec->autocfg.speaker_pins[nid];
3346 nid = spec->autocfg.line_out_pins[nid];
3349 nid = spec->autocfg.hp_pins[nid];
3354 err = snd_hda_add_nid(codec, kctl, 0, nid);
3358 u = knew->private_value;
3359 for (j = 0; j < 4; j++, u >>= 8) {
3363 err = snd_hda_add_nid(codec, kctl, 0, nid);
3370 alc_free_kctls(codec); /* no longer needed */
3377 * initialize the codec volumes, etc
3381 * generic initialization of ADC, input mixers and output mixers
3383 static const struct hda_verb alc880_volume_init_verbs[] = {
3385 * Unmute ADC0-2 and set the default input to mic-in
3387 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3389 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3391 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3394 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3396 * Note: PASD motherboards uses the Line In 2 as the input for front
3399 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3406 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3409 * Set up output mixers (0x0c - 0x0f)
3411 /* set vol=0 to output mixers */
3412 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3413 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3414 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3415 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3416 /* set up input amps for analog loopback */
3417 /* Amp Indices: DAC = 0, mixer = 1 */
3418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3422 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3424 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3425 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3431 * 3-stack pin configuration:
3432 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3434 static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
3436 * preset connection lists of input pins
3437 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3439 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3440 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3441 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3444 * Set pin mode and muting
3446 /* set front pin widgets 0x14 for output */
3447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3449 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3450 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3452 /* Mic2 (as headphone out) for HP output */
3453 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3454 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3455 /* Line In pin widget for input */
3456 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3457 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3458 /* Line2 (as front mic) pin widget for input and vref at 80% */
3459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3460 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3461 /* CD pin widget for input */
3462 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3468 * 5-stack pin configuration:
3469 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3470 * line-in/side = 0x1a, f-mic = 0x1b
3472 static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
3474 * preset connection lists of input pins
3475 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3477 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3478 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3481 * Set pin mode and muting
3483 /* set pin widgets 0x14-0x17 for output */
3484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3486 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3487 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3488 /* unmute pins for output (no gain on this amp) */
3489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3491 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3492 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3494 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3495 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3496 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3497 /* Mic2 (as headphone out) for HP output */
3498 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3500 /* Line In pin widget for input */
3501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3503 /* Line2 (as front mic) pin widget for input and vref at 80% */
3504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3505 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3506 /* CD pin widget for input */
3507 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3513 * W810 pin configuration:
3514 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3516 static const struct hda_verb alc880_pin_w810_init_verbs[] = {
3517 /* hphone/speaker input selector: front DAC */
3518 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3520 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3521 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3522 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3523 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3524 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3525 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3527 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3528 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3534 * Z71V pin configuration:
3535 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3537 static const struct hda_verb alc880_pin_z71v_init_verbs[] = {
3538 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3540 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3543 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3545 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3552 * 6-stack pin configuration:
3553 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3554 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3556 static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
3557 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3560 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3563 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3564 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3565 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3566 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3568 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3570 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3571 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3572 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3573 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3574 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3575 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3576 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3582 * Uniwill pin configuration:
3583 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3586 static const struct hda_verb alc880_uniwill_init_verbs[] = {
3587 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3590 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3593 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3594 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3595 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3596 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3598 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3600 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3601 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3602 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3604 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3605 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3606 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3607 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3608 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3609 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3610 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3611 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3612 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3614 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3615 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3622 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3624 static const struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3625 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3627 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3628 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3631 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3632 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3633 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3640 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3641 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3643 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3644 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3645 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3647 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3648 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3653 static const struct hda_verb alc880_beep_init_verbs[] = {
3654 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3658 /* auto-toggle front mic */
3659 static void alc88x_simple_mic_automute(struct hda_codec *codec)
3661 unsigned int present;
3664 present = snd_hda_jack_detect(codec, 0x18);
3665 bits = present ? HDA_AMP_MUTE : 0;
3666 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3669 static void alc880_uniwill_setup(struct hda_codec *codec)
3671 struct alc_spec *spec = codec->spec;
3673 spec->autocfg.hp_pins[0] = 0x14;
3674 spec->autocfg.speaker_pins[0] = 0x15;
3675 spec->autocfg.speaker_pins[0] = 0x16;
3677 spec->automute_mode = ALC_AUTOMUTE_AMP;
3680 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3682 alc_hp_automute(codec);
3683 alc88x_simple_mic_automute(codec);
3686 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3689 /* Looks like the unsol event is incompatible with the standard
3690 * definition. 4bit tag is placed at 28 bit!
3692 switch (res >> 28) {
3693 case ALC880_MIC_EVENT:
3694 alc88x_simple_mic_automute(codec);
3697 alc_sku_unsol_event(codec, res);
3702 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3704 struct alc_spec *spec = codec->spec;
3706 spec->autocfg.hp_pins[0] = 0x14;
3707 spec->autocfg.speaker_pins[0] = 0x15;
3709 spec->automute_mode = ALC_AUTOMUTE_AMP;
3712 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3714 unsigned int present;
3716 present = snd_hda_codec_read(codec, 0x21, 0,
3717 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3718 present &= HDA_AMP_VOLMASK;
3719 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3720 HDA_AMP_VOLMASK, present);
3721 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3722 HDA_AMP_VOLMASK, present);
3725 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3728 /* Looks like the unsol event is incompatible with the standard
3729 * definition. 4bit tag is placed at 28 bit!
3731 if ((res >> 28) == ALC880_DCVOL_EVENT)
3732 alc880_uniwill_p53_dcvol_automute(codec);
3734 alc_sku_unsol_event(codec, res);
3738 * F1734 pin configuration:
3739 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3741 static const struct hda_verb alc880_pin_f1734_init_verbs[] = {
3742 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3743 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3744 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3745 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3746 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3748 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3749 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3753 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3754 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3755 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3756 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3757 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3759 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3761 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3763 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3764 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3770 * ASUS pin configuration:
3771 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3773 static const struct hda_verb alc880_pin_asus_init_verbs[] = {
3774 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3775 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3776 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3777 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3780 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3783 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3784 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3785 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3790 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3791 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3793 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3794 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3795 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3796 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3801 /* Enable GPIO mask and set output */
3802 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3803 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3804 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3806 /* Clevo m520g init */
3807 static const struct hda_verb alc880_pin_clevo_init_verbs[] = {
3808 /* headphone output */
3809 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3818 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3819 /* Mic1 (rear panel) */
3820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3822 /* Mic2 (front panel) */
3823 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3824 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3826 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3827 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3828 /* change to EAPD mode */
3829 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3830 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3835 static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3836 /* change to EAPD mode */
3837 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3838 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3840 /* Headphone output */
3841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3843 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3844 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3846 /* Line In pin widget for input */
3847 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3848 /* CD pin widget for input */
3849 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3850 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3851 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3853 /* change to EAPD mode */
3854 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3855 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3861 * LG m1 express dual
3864 * Rear Line-In/Out (blue): 0x14
3865 * Build-in Mic-In: 0x15
3867 * HP-Out (green): 0x1b
3868 * Mic-In/Out (red): 0x19
3872 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3873 static const hda_nid_t alc880_lg_dac_nids[3] = {
3877 /* seems analog CD is not working */
3878 static const struct hda_input_mux alc880_lg_capture_source = {
3883 { "Internal Mic", 0x6 },
3887 /* 2,4,6 channel modes */
3888 static const struct hda_verb alc880_lg_ch2_init[] = {
3889 /* set line-in and mic-in to input */
3890 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3891 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3895 static const struct hda_verb alc880_lg_ch4_init[] = {
3896 /* set line-in to out and mic-in to input */
3897 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3898 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3902 static const struct hda_verb alc880_lg_ch6_init[] = {
3903 /* set line-in and mic-in to output */
3904 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3905 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3909 static const struct hda_channel_mode alc880_lg_ch_modes[3] = {
3910 { 2, alc880_lg_ch2_init },
3911 { 4, alc880_lg_ch4_init },
3912 { 6, alc880_lg_ch6_init },
3915 static const struct snd_kcontrol_new alc880_lg_mixer[] = {
3916 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3917 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3918 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3919 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3920 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3921 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3922 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3923 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3926 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3927 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3928 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3929 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3931 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3932 .name = "Channel Mode",
3933 .info = alc_ch_mode_info,
3934 .get = alc_ch_mode_get,
3935 .put = alc_ch_mode_put,
3940 static const struct hda_verb alc880_lg_init_verbs[] = {
3941 /* set capture source to mic-in */
3942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3943 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3944 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3945 /* mute all amp mixer inputs */
3946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3949 /* line-in to input */
3950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3951 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3956 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3957 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3958 /* mic-in to input */
3959 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3960 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3961 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3963 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3965 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3967 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3971 /* toggle speaker-output according to the hp-jack state */
3972 static void alc880_lg_setup(struct hda_codec *codec)
3974 struct alc_spec *spec = codec->spec;
3976 spec->autocfg.hp_pins[0] = 0x1b;
3977 spec->autocfg.speaker_pins[0] = 0x17;
3979 spec->automute_mode = ALC_AUTOMUTE_AMP;
3988 * Built-in Mic-In: 0x19
3994 static const struct hda_input_mux alc880_lg_lw_capture_source = {
3998 { "Internal Mic", 0x1 },
4003 #define alc880_lg_lw_modes alc880_threestack_modes
4005 static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
4006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4008 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4009 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
4010 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
4011 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
4012 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
4013 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
4014 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
4015 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
4016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4018 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
4019 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
4021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4022 .name = "Channel Mode",
4023 .info = alc_ch_mode_info,
4024 .get = alc_ch_mode_get,
4025 .put = alc_ch_mode_put,
4030 static const struct hda_verb alc880_lg_lw_init_verbs[] = {
4031 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4032 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
4033 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
4035 /* set capture source to mic-in */
4036 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4037 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4038 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
4041 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4042 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4044 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4045 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4046 /* mic-in to input */
4047 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4048 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4050 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4051 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4053 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4057 /* toggle speaker-output according to the hp-jack state */
4058 static void alc880_lg_lw_setup(struct hda_codec *codec)
4060 struct alc_spec *spec = codec->spec;
4062 spec->autocfg.hp_pins[0] = 0x1b;
4063 spec->autocfg.speaker_pins[0] = 0x14;
4065 spec->automute_mode = ALC_AUTOMUTE_AMP;
4068 static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
4069 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4070 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
4071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
4072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
4073 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
4074 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
4078 static const struct hda_input_mux alc880_medion_rim_capture_source = {
4082 { "Internal Mic", 0x1 },
4086 static const struct hda_verb alc880_medion_rim_init_verbs[] = {
4087 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4089 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4092 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4093 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4094 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4095 /* Mic2 (as headphone out) for HP output */
4096 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4097 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4098 /* Internal Speaker */
4099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4100 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4102 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
4103 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
4105 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4109 /* toggle speaker-output according to the hp-jack state */
4110 static void alc880_medion_rim_automute(struct hda_codec *codec)
4112 struct alc_spec *spec = codec->spec;
4113 alc_hp_automute(codec);
4115 if (spec->jack_present)
4116 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
4118 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
4121 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
4124 /* Looks like the unsol event is incompatible with the standard
4125 * definition. 4bit tag is placed at 28 bit!
4127 if ((res >> 28) == ALC880_HP_EVENT)
4128 alc880_medion_rim_automute(codec);
4131 static void alc880_medion_rim_setup(struct hda_codec *codec)
4133 struct alc_spec *spec = codec->spec;
4135 spec->autocfg.hp_pins[0] = 0x14;
4136 spec->autocfg.speaker_pins[0] = 0x1b;
4138 spec->automute_mode = ALC_AUTOMUTE_AMP;
4141 #ifdef CONFIG_SND_HDA_POWER_SAVE
4142 static const struct hda_amp_list alc880_loopbacks[] = {
4143 { 0x0b, HDA_INPUT, 0 },
4144 { 0x0b, HDA_INPUT, 1 },
4145 { 0x0b, HDA_INPUT, 2 },
4146 { 0x0b, HDA_INPUT, 3 },
4147 { 0x0b, HDA_INPUT, 4 },
4151 static const struct hda_amp_list alc880_lg_loopbacks[] = {
4152 { 0x0b, HDA_INPUT, 1 },
4153 { 0x0b, HDA_INPUT, 6 },
4154 { 0x0b, HDA_INPUT, 7 },
4163 static void alc_init_special_input_src(struct hda_codec *codec);
4165 static int alc_init(struct hda_codec *codec)
4167 struct alc_spec *spec = codec->spec;
4171 alc_auto_init_amp(codec, spec->init_amp);
4173 for (i = 0; i < spec->num_init_verbs; i++)
4174 snd_hda_sequence_write(codec, spec->init_verbs[i]);
4175 alc_init_special_input_src(codec);
4177 if (spec->init_hook)
4178 spec->init_hook(codec);
4180 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
4182 hda_call_check_power_status(codec, 0x01);
4186 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
4188 struct alc_spec *spec = codec->spec;
4190 if (spec->unsol_event)
4191 spec->unsol_event(codec, res);
4194 #ifdef CONFIG_SND_HDA_POWER_SAVE
4195 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
4197 struct alc_spec *spec = codec->spec;
4198 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
4203 * Analog playback callbacks
4205 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
4206 struct hda_codec *codec,
4207 struct snd_pcm_substream *substream)
4209 struct alc_spec *spec = codec->spec;
4210 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
4214 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4215 struct hda_codec *codec,
4216 unsigned int stream_tag,
4217 unsigned int format,
4218 struct snd_pcm_substream *substream)
4220 struct alc_spec *spec = codec->spec;
4221 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
4222 stream_tag, format, substream);
4225 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4226 struct hda_codec *codec,
4227 struct snd_pcm_substream *substream)
4229 struct alc_spec *spec = codec->spec;
4230 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
4236 static int alc880_dig_playback_pcm_open(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_open(codec, &spec->multiout);
4244 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4245 struct hda_codec *codec,
4246 unsigned int stream_tag,
4247 unsigned int format,
4248 struct snd_pcm_substream *substream)
4250 struct alc_spec *spec = codec->spec;
4251 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
4252 stream_tag, format, substream);
4255 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4256 struct hda_codec *codec,
4257 struct snd_pcm_substream *substream)
4259 struct alc_spec *spec = codec->spec;
4260 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4263 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4264 struct hda_codec *codec,
4265 struct snd_pcm_substream *substream)
4267 struct alc_spec *spec = codec->spec;
4268 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
4274 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4275 struct hda_codec *codec,
4276 unsigned int stream_tag,
4277 unsigned int format,
4278 struct snd_pcm_substream *substream)
4280 struct alc_spec *spec = codec->spec;
4282 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
4283 stream_tag, 0, format);
4287 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4288 struct hda_codec *codec,
4289 struct snd_pcm_substream *substream)
4291 struct alc_spec *spec = codec->spec;
4293 snd_hda_codec_cleanup_stream(codec,
4294 spec->adc_nids[substream->number + 1]);
4298 /* analog capture with dynamic dual-adc changes */
4299 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4300 struct hda_codec *codec,
4301 unsigned int stream_tag,
4302 unsigned int format,
4303 struct snd_pcm_substream *substream)
4305 struct alc_spec *spec = codec->spec;
4306 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
4307 spec->cur_adc_stream_tag = stream_tag;
4308 spec->cur_adc_format = format;
4309 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
4313 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4314 struct hda_codec *codec,
4315 struct snd_pcm_substream *substream)
4317 struct alc_spec *spec = codec->spec;
4318 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
4323 static const struct hda_pcm_stream dualmic_pcm_analog_capture = {
4327 .nid = 0, /* fill later */
4329 .prepare = dualmic_capture_pcm_prepare,
4330 .cleanup = dualmic_capture_pcm_cleanup
4336 static const struct hda_pcm_stream alc880_pcm_analog_playback = {
4340 /* NID is set in alc_build_pcms */
4342 .open = alc880_playback_pcm_open,
4343 .prepare = alc880_playback_pcm_prepare,
4344 .cleanup = alc880_playback_pcm_cleanup
4348 static const struct hda_pcm_stream alc880_pcm_analog_capture = {
4352 /* NID is set in alc_build_pcms */
4355 static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4359 /* NID is set in alc_build_pcms */
4362 static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4363 .substreams = 2, /* can be overridden */
4366 /* NID is set in alc_build_pcms */
4368 .prepare = alc880_alt_capture_pcm_prepare,
4369 .cleanup = alc880_alt_capture_pcm_cleanup
4373 static const struct hda_pcm_stream alc880_pcm_digital_playback = {
4377 /* NID is set in alc_build_pcms */
4379 .open = alc880_dig_playback_pcm_open,
4380 .close = alc880_dig_playback_pcm_close,
4381 .prepare = alc880_dig_playback_pcm_prepare,
4382 .cleanup = alc880_dig_playback_pcm_cleanup
4386 static const struct hda_pcm_stream alc880_pcm_digital_capture = {
4390 /* NID is set in alc_build_pcms */
4393 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4394 static const struct hda_pcm_stream alc_pcm_null_stream = {
4400 static int alc_build_pcms(struct hda_codec *codec)
4402 struct alc_spec *spec = codec->spec;
4403 struct hda_pcm *info = spec->pcm_rec;
4406 codec->num_pcms = 1;
4407 codec->pcm_info = info;
4409 if (spec->no_analog)
4412 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4413 "%s Analog", codec->chip_name);
4414 info->name = spec->stream_name_analog;
4416 if (spec->stream_analog_playback) {
4417 if (snd_BUG_ON(!spec->multiout.dac_nids))
4419 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4420 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4422 if (spec->stream_analog_capture) {
4423 if (snd_BUG_ON(!spec->adc_nids))
4425 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4426 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4429 if (spec->channel_mode) {
4430 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4431 for (i = 0; i < spec->num_channel_mode; i++) {
4432 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4433 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4439 /* SPDIF for stream index #1 */
4440 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4441 snprintf(spec->stream_name_digital,
4442 sizeof(spec->stream_name_digital),
4443 "%s Digital", codec->chip_name);
4444 codec->num_pcms = 2;
4445 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4446 info = spec->pcm_rec + 1;
4447 info->name = spec->stream_name_digital;
4448 if (spec->dig_out_type)
4449 info->pcm_type = spec->dig_out_type;
4451 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4452 if (spec->multiout.dig_out_nid &&
4453 spec->stream_digital_playback) {
4454 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4455 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4457 if (spec->dig_in_nid &&
4458 spec->stream_digital_capture) {
4459 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4460 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4462 /* FIXME: do we need this for all Realtek codec models? */
4463 codec->spdif_status_reset = 1;
4466 if (spec->no_analog)
4469 /* If the use of more than one ADC is requested for the current
4470 * model, configure a second analog capture-only PCM.
4472 /* Additional Analaog capture for index #2 */
4473 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4474 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4475 codec->num_pcms = 3;
4476 info = spec->pcm_rec + 2;
4477 info->name = spec->stream_name_analog;
4478 if (spec->alt_dac_nid) {
4479 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4480 *spec->stream_analog_alt_playback;
4481 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4484 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4485 alc_pcm_null_stream;
4486 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4488 if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) {
4489 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4490 *spec->stream_analog_alt_capture;
4491 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4493 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4494 spec->num_adc_nids - 1;
4496 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4497 alc_pcm_null_stream;
4498 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4505 static inline void alc_shutup(struct hda_codec *codec)
4507 struct alc_spec *spec = codec->spec;
4509 if (spec && spec->shutup)
4510 spec->shutup(codec);
4511 snd_hda_shutup_pins(codec);
4514 static void alc_free_kctls(struct hda_codec *codec)
4516 struct alc_spec *spec = codec->spec;
4518 if (spec->kctls.list) {
4519 struct snd_kcontrol_new *kctl = spec->kctls.list;
4521 for (i = 0; i < spec->kctls.used; i++)
4522 kfree(kctl[i].name);
4524 snd_array_free(&spec->kctls);
4527 static void alc_free(struct hda_codec *codec)
4529 struct alc_spec *spec = codec->spec;
4535 snd_hda_input_jack_free(codec);
4536 alc_free_kctls(codec);
4538 snd_hda_detach_beep_device(codec);
4541 #ifdef CONFIG_SND_HDA_POWER_SAVE
4542 static void alc_power_eapd(struct hda_codec *codec)
4544 alc_auto_setup_eapd(codec, false);
4547 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4549 struct alc_spec *spec = codec->spec;
4551 if (spec && spec->power_hook)
4552 spec->power_hook(codec);
4557 #ifdef SND_HDA_NEEDS_RESUME
4558 static int alc_resume(struct hda_codec *codec)
4560 msleep(150); /* to avoid pop noise */
4561 codec->patch_ops.init(codec);
4562 snd_hda_codec_resume_amp(codec);
4563 snd_hda_codec_resume_cache(codec);
4564 hda_call_check_power_status(codec, 0x01);
4571 static const struct hda_codec_ops alc_patch_ops = {
4572 .build_controls = alc_build_controls,
4573 .build_pcms = alc_build_pcms,
4576 .unsol_event = alc_unsol_event,
4577 #ifdef SND_HDA_NEEDS_RESUME
4578 .resume = alc_resume,
4580 #ifdef CONFIG_SND_HDA_POWER_SAVE
4581 .suspend = alc_suspend,
4582 .check_power_status = alc_check_power_status,
4584 .reboot_notify = alc_shutup,
4587 /* replace the codec chip_name with the given string */
4588 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4590 kfree(codec->chip_name);
4591 codec->chip_name = kstrdup(name, GFP_KERNEL);
4592 if (!codec->chip_name) {
4600 * Test configuration for debugging
4602 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4605 #ifdef CONFIG_SND_DEBUG
4606 static const hda_nid_t alc880_test_dac_nids[4] = {
4607 0x02, 0x03, 0x04, 0x05
4610 static const struct hda_input_mux alc880_test_capture_source = {
4619 { "Surround", 0x6 },
4623 static const struct hda_channel_mode alc880_test_modes[4] = {
4630 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4631 struct snd_ctl_elem_info *uinfo)
4633 static const char * const texts[] = {
4634 "N/A", "Line Out", "HP Out",
4635 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4637 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4639 uinfo->value.enumerated.items = 8;
4640 if (uinfo->value.enumerated.item >= 8)
4641 uinfo->value.enumerated.item = 7;
4642 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4646 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4647 struct snd_ctl_elem_value *ucontrol)
4649 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4650 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4651 unsigned int pin_ctl, item = 0;
4653 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4654 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4655 if (pin_ctl & AC_PINCTL_OUT_EN) {
4656 if (pin_ctl & AC_PINCTL_HP_EN)
4660 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4661 switch (pin_ctl & AC_PINCTL_VREFEN) {
4662 case AC_PINCTL_VREF_HIZ: item = 3; break;
4663 case AC_PINCTL_VREF_50: item = 4; break;
4664 case AC_PINCTL_VREF_GRD: item = 5; break;
4665 case AC_PINCTL_VREF_80: item = 6; break;
4666 case AC_PINCTL_VREF_100: item = 7; break;
4669 ucontrol->value.enumerated.item[0] = item;
4673 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4674 struct snd_ctl_elem_value *ucontrol)
4676 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4677 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4678 static const unsigned int ctls[] = {
4679 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4680 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4681 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4682 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4683 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4684 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4686 unsigned int old_ctl, new_ctl;
4688 old_ctl = snd_hda_codec_read(codec, nid, 0,
4689 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4690 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4691 if (old_ctl != new_ctl) {
4693 snd_hda_codec_write_cache(codec, nid, 0,
4694 AC_VERB_SET_PIN_WIDGET_CONTROL,
4696 val = ucontrol->value.enumerated.item[0] >= 3 ?
4698 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4705 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4706 struct snd_ctl_elem_info *uinfo)
4708 static const char * const texts[] = {
4709 "Front", "Surround", "CLFE", "Side"
4711 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4713 uinfo->value.enumerated.items = 4;
4714 if (uinfo->value.enumerated.item >= 4)
4715 uinfo->value.enumerated.item = 3;
4716 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4720 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4721 struct snd_ctl_elem_value *ucontrol)
4723 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4724 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4727 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4728 ucontrol->value.enumerated.item[0] = sel & 3;
4732 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4733 struct snd_ctl_elem_value *ucontrol)
4735 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4736 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4739 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4740 if (ucontrol->value.enumerated.item[0] != sel) {
4741 sel = ucontrol->value.enumerated.item[0] & 3;
4742 snd_hda_codec_write_cache(codec, nid, 0,
4743 AC_VERB_SET_CONNECT_SEL, sel);
4749 #define PIN_CTL_TEST(xname,nid) { \
4750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4752 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4753 .info = alc_test_pin_ctl_info, \
4754 .get = alc_test_pin_ctl_get, \
4755 .put = alc_test_pin_ctl_put, \
4756 .private_value = nid \
4759 #define PIN_SRC_TEST(xname,nid) { \
4760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4762 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4763 .info = alc_test_pin_src_info, \
4764 .get = alc_test_pin_src_get, \
4765 .put = alc_test_pin_src_put, \
4766 .private_value = nid \
4769 static const struct snd_kcontrol_new alc880_test_mixer[] = {
4770 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4771 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4772 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4773 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4774 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4775 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4776 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4777 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4778 PIN_CTL_TEST("Front Pin Mode", 0x14),
4779 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4780 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4781 PIN_CTL_TEST("Side Pin Mode", 0x17),
4782 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4783 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4784 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4785 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4786 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4787 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4788 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4789 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4790 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4791 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4792 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4793 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4794 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4795 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4796 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4797 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4798 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4799 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4802 .name = "Channel Mode",
4803 .info = alc_ch_mode_info,
4804 .get = alc_ch_mode_get,
4805 .put = alc_ch_mode_put,
4810 static const struct hda_verb alc880_test_init_verbs[] = {
4811 /* Unmute inputs of 0x0c - 0x0f */
4812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4816 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4818 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4820 /* Vol output for 0x0c-0x0f */
4821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4825 /* Set output pins 0x14-0x17 */
4826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4828 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4829 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4830 /* Unmute output pins 0x14-0x17 */
4831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4834 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4835 /* Set input pins 0x18-0x1c */
4836 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4837 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4838 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4839 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4840 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4841 /* Mute input pins 0x18-0x1b */
4842 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4843 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4845 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4848 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4849 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4850 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4851 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4852 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4853 /* Analog input/passthru */
4854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4858 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4866 static const char * const alc880_models[ALC880_MODEL_LAST] = {
4867 [ALC880_3ST] = "3stack",
4868 [ALC880_TCL_S700] = "tcl",
4869 [ALC880_3ST_DIG] = "3stack-digout",
4870 [ALC880_CLEVO] = "clevo",
4871 [ALC880_5ST] = "5stack",
4872 [ALC880_5ST_DIG] = "5stack-digout",
4873 [ALC880_W810] = "w810",
4874 [ALC880_Z71V] = "z71v",
4875 [ALC880_6ST] = "6stack",
4876 [ALC880_6ST_DIG] = "6stack-digout",
4877 [ALC880_ASUS] = "asus",
4878 [ALC880_ASUS_W1V] = "asus-w1v",
4879 [ALC880_ASUS_DIG] = "asus-dig",
4880 [ALC880_ASUS_DIG2] = "asus-dig2",
4881 [ALC880_UNIWILL_DIG] = "uniwill",
4882 [ALC880_UNIWILL_P53] = "uniwill-p53",
4883 [ALC880_FUJITSU] = "fujitsu",
4884 [ALC880_F1734] = "F1734",
4886 [ALC880_LG_LW] = "lg-lw",
4887 [ALC880_MEDION_RIM] = "medion",
4888 #ifdef CONFIG_SND_DEBUG
4889 [ALC880_TEST] = "test",
4891 [ALC880_AUTO] = "auto",
4894 static const struct snd_pci_quirk alc880_cfg_tbl[] = {
4895 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4896 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4897 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4898 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4899 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4900 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4901 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4902 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4903 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4904 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4905 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4906 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4907 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4908 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4909 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4910 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4911 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4912 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4913 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4914 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4915 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4916 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4917 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4918 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4919 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4920 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4921 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4922 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4923 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4924 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4925 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4926 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4927 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4928 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4929 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4930 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4931 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4932 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4933 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4934 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734),
4935 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4936 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4937 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4938 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4939 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4940 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4941 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4942 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4943 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4944 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4945 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4946 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4947 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
4948 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4949 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4950 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4951 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4952 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4953 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4954 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4955 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4956 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4957 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4958 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4959 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4960 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4961 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4962 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4964 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4965 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4966 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4971 * ALC880 codec presets
4973 static const struct alc_config_preset alc880_presets[] = {
4975 .mixers = { alc880_three_stack_mixer },
4976 .init_verbs = { alc880_volume_init_verbs,
4977 alc880_pin_3stack_init_verbs },
4978 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4979 .dac_nids = alc880_dac_nids,
4980 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4981 .channel_mode = alc880_threestack_modes,
4983 .input_mux = &alc880_capture_source,
4985 [ALC880_3ST_DIG] = {
4986 .mixers = { alc880_three_stack_mixer },
4987 .init_verbs = { alc880_volume_init_verbs,
4988 alc880_pin_3stack_init_verbs },
4989 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4990 .dac_nids = alc880_dac_nids,
4991 .dig_out_nid = ALC880_DIGOUT_NID,
4992 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4993 .channel_mode = alc880_threestack_modes,
4995 .input_mux = &alc880_capture_source,
4997 [ALC880_TCL_S700] = {
4998 .mixers = { alc880_tcl_s700_mixer },
4999 .init_verbs = { alc880_volume_init_verbs,
5000 alc880_pin_tcl_S700_init_verbs,
5001 alc880_gpio2_init_verbs },
5002 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5003 .dac_nids = alc880_dac_nids,
5004 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
5005 .num_adc_nids = 1, /* single ADC */
5007 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5008 .channel_mode = alc880_2_jack_modes,
5009 .input_mux = &alc880_capture_source,
5012 .mixers = { alc880_three_stack_mixer,
5013 alc880_five_stack_mixer},
5014 .init_verbs = { alc880_volume_init_verbs,
5015 alc880_pin_5stack_init_verbs },
5016 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5017 .dac_nids = alc880_dac_nids,
5018 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
5019 .channel_mode = alc880_fivestack_modes,
5020 .input_mux = &alc880_capture_source,
5022 [ALC880_5ST_DIG] = {
5023 .mixers = { alc880_three_stack_mixer,
5024 alc880_five_stack_mixer },
5025 .init_verbs = { alc880_volume_init_verbs,
5026 alc880_pin_5stack_init_verbs },
5027 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5028 .dac_nids = alc880_dac_nids,
5029 .dig_out_nid = ALC880_DIGOUT_NID,
5030 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
5031 .channel_mode = alc880_fivestack_modes,
5032 .input_mux = &alc880_capture_source,
5035 .mixers = { alc880_six_stack_mixer },
5036 .init_verbs = { alc880_volume_init_verbs,
5037 alc880_pin_6stack_init_verbs },
5038 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
5039 .dac_nids = alc880_6st_dac_nids,
5040 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
5041 .channel_mode = alc880_sixstack_modes,
5042 .input_mux = &alc880_6stack_capture_source,
5044 [ALC880_6ST_DIG] = {
5045 .mixers = { alc880_six_stack_mixer },
5046 .init_verbs = { alc880_volume_init_verbs,
5047 alc880_pin_6stack_init_verbs },
5048 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
5049 .dac_nids = alc880_6st_dac_nids,
5050 .dig_out_nid = ALC880_DIGOUT_NID,
5051 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
5052 .channel_mode = alc880_sixstack_modes,
5053 .input_mux = &alc880_6stack_capture_source,
5056 .mixers = { alc880_w810_base_mixer },
5057 .init_verbs = { alc880_volume_init_verbs,
5058 alc880_pin_w810_init_verbs,
5059 alc880_gpio2_init_verbs },
5060 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
5061 .dac_nids = alc880_w810_dac_nids,
5062 .dig_out_nid = ALC880_DIGOUT_NID,
5063 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
5064 .channel_mode = alc880_w810_modes,
5065 .input_mux = &alc880_capture_source,
5068 .mixers = { alc880_z71v_mixer },
5069 .init_verbs = { alc880_volume_init_verbs,
5070 alc880_pin_z71v_init_verbs },
5071 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
5072 .dac_nids = alc880_z71v_dac_nids,
5073 .dig_out_nid = ALC880_DIGOUT_NID,
5075 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5076 .channel_mode = alc880_2_jack_modes,
5077 .input_mux = &alc880_capture_source,
5080 .mixers = { alc880_f1734_mixer },
5081 .init_verbs = { alc880_volume_init_verbs,
5082 alc880_pin_f1734_init_verbs },
5083 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
5084 .dac_nids = alc880_f1734_dac_nids,
5086 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5087 .channel_mode = alc880_2_jack_modes,
5088 .input_mux = &alc880_f1734_capture_source,
5089 .unsol_event = alc880_uniwill_p53_unsol_event,
5090 .setup = alc880_uniwill_p53_setup,
5091 .init_hook = alc_hp_automute,
5094 .mixers = { alc880_asus_mixer },
5095 .init_verbs = { alc880_volume_init_verbs,
5096 alc880_pin_asus_init_verbs,
5097 alc880_gpio1_init_verbs },
5098 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5099 .dac_nids = alc880_asus_dac_nids,
5100 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5101 .channel_mode = alc880_asus_modes,
5103 .input_mux = &alc880_capture_source,
5105 [ALC880_ASUS_DIG] = {
5106 .mixers = { alc880_asus_mixer },
5107 .init_verbs = { alc880_volume_init_verbs,
5108 alc880_pin_asus_init_verbs,
5109 alc880_gpio1_init_verbs },
5110 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5111 .dac_nids = alc880_asus_dac_nids,
5112 .dig_out_nid = ALC880_DIGOUT_NID,
5113 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5114 .channel_mode = alc880_asus_modes,
5116 .input_mux = &alc880_capture_source,
5118 [ALC880_ASUS_DIG2] = {
5119 .mixers = { alc880_asus_mixer },
5120 .init_verbs = { alc880_volume_init_verbs,
5121 alc880_pin_asus_init_verbs,
5122 alc880_gpio2_init_verbs }, /* use GPIO2 */
5123 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5124 .dac_nids = alc880_asus_dac_nids,
5125 .dig_out_nid = ALC880_DIGOUT_NID,
5126 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5127 .channel_mode = alc880_asus_modes,
5129 .input_mux = &alc880_capture_source,
5131 [ALC880_ASUS_W1V] = {
5132 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
5133 .init_verbs = { alc880_volume_init_verbs,
5134 alc880_pin_asus_init_verbs,
5135 alc880_gpio1_init_verbs },
5136 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5137 .dac_nids = alc880_asus_dac_nids,
5138 .dig_out_nid = ALC880_DIGOUT_NID,
5139 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5140 .channel_mode = alc880_asus_modes,
5142 .input_mux = &alc880_capture_source,
5144 [ALC880_UNIWILL_DIG] = {
5145 .mixers = { alc880_asus_mixer },
5146 .init_verbs = { alc880_volume_init_verbs,
5147 alc880_pin_asus_init_verbs },
5148 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5149 .dac_nids = alc880_asus_dac_nids,
5150 .dig_out_nid = ALC880_DIGOUT_NID,
5151 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
5152 .channel_mode = alc880_asus_modes,
5154 .input_mux = &alc880_capture_source,
5156 [ALC880_UNIWILL] = {
5157 .mixers = { alc880_uniwill_mixer },
5158 .init_verbs = { alc880_volume_init_verbs,
5159 alc880_uniwill_init_verbs },
5160 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5161 .dac_nids = alc880_asus_dac_nids,
5162 .dig_out_nid = ALC880_DIGOUT_NID,
5163 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5164 .channel_mode = alc880_threestack_modes,
5166 .input_mux = &alc880_capture_source,
5167 .unsol_event = alc880_uniwill_unsol_event,
5168 .setup = alc880_uniwill_setup,
5169 .init_hook = alc880_uniwill_init_hook,
5171 [ALC880_UNIWILL_P53] = {
5172 .mixers = { alc880_uniwill_p53_mixer },
5173 .init_verbs = { alc880_volume_init_verbs,
5174 alc880_uniwill_p53_init_verbs },
5175 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
5176 .dac_nids = alc880_asus_dac_nids,
5177 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
5178 .channel_mode = alc880_threestack_modes,
5179 .input_mux = &alc880_capture_source,
5180 .unsol_event = alc880_uniwill_p53_unsol_event,
5181 .setup = alc880_uniwill_p53_setup,
5182 .init_hook = alc_hp_automute,
5184 [ALC880_FUJITSU] = {
5185 .mixers = { alc880_fujitsu_mixer },
5186 .init_verbs = { alc880_volume_init_verbs,
5187 alc880_uniwill_p53_init_verbs,
5188 alc880_beep_init_verbs },
5189 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5190 .dac_nids = alc880_dac_nids,
5191 .dig_out_nid = ALC880_DIGOUT_NID,
5192 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5193 .channel_mode = alc880_2_jack_modes,
5194 .input_mux = &alc880_capture_source,
5195 .unsol_event = alc880_uniwill_p53_unsol_event,
5196 .setup = alc880_uniwill_p53_setup,
5197 .init_hook = alc_hp_automute,
5200 .mixers = { alc880_three_stack_mixer },
5201 .init_verbs = { alc880_volume_init_verbs,
5202 alc880_pin_clevo_init_verbs },
5203 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5204 .dac_nids = alc880_dac_nids,
5206 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
5207 .channel_mode = alc880_threestack_modes,
5209 .input_mux = &alc880_capture_source,
5212 .mixers = { alc880_lg_mixer },
5213 .init_verbs = { alc880_volume_init_verbs,
5214 alc880_lg_init_verbs },
5215 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
5216 .dac_nids = alc880_lg_dac_nids,
5217 .dig_out_nid = ALC880_DIGOUT_NID,
5218 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
5219 .channel_mode = alc880_lg_ch_modes,
5221 .input_mux = &alc880_lg_capture_source,
5222 .unsol_event = alc_sku_unsol_event,
5223 .setup = alc880_lg_setup,
5224 .init_hook = alc_hp_automute,
5225 #ifdef CONFIG_SND_HDA_POWER_SAVE
5226 .loopbacks = alc880_lg_loopbacks,
5230 .mixers = { alc880_lg_lw_mixer },
5231 .init_verbs = { alc880_volume_init_verbs,
5232 alc880_lg_lw_init_verbs },
5233 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5234 .dac_nids = alc880_dac_nids,
5235 .dig_out_nid = ALC880_DIGOUT_NID,
5236 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5237 .channel_mode = alc880_lg_lw_modes,
5238 .input_mux = &alc880_lg_lw_capture_source,
5239 .unsol_event = alc_sku_unsol_event,
5240 .setup = alc880_lg_lw_setup,
5241 .init_hook = alc_hp_automute,
5243 [ALC880_MEDION_RIM] = {
5244 .mixers = { alc880_medion_rim_mixer },
5245 .init_verbs = { alc880_volume_init_verbs,
5246 alc880_medion_rim_init_verbs,
5247 alc_gpio2_init_verbs },
5248 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
5249 .dac_nids = alc880_dac_nids,
5250 .dig_out_nid = ALC880_DIGOUT_NID,
5251 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
5252 .channel_mode = alc880_2_jack_modes,
5253 .input_mux = &alc880_medion_rim_capture_source,
5254 .unsol_event = alc880_medion_rim_unsol_event,
5255 .setup = alc880_medion_rim_setup,
5256 .init_hook = alc880_medion_rim_automute,
5258 #ifdef CONFIG_SND_DEBUG
5260 .mixers = { alc880_test_mixer },
5261 .init_verbs = { alc880_test_init_verbs },
5262 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
5263 .dac_nids = alc880_test_dac_nids,
5264 .dig_out_nid = ALC880_DIGOUT_NID,
5265 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
5266 .channel_mode = alc880_test_modes,
5267 .input_mux = &alc880_test_capture_source,
5273 * Automatic parse of I/O pins from the BIOS configuration
5278 ALC_CTL_WIDGET_MUTE,
5281 static const struct snd_kcontrol_new alc880_control_templates[] = {
5282 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5283 HDA_CODEC_MUTE(NULL, 0, 0, 0),
5284 HDA_BIND_MUTE(NULL, 0, 0, 0),
5287 static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec)
5289 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
5290 return snd_array_new(&spec->kctls);
5293 /* add dynamic controls */
5294 static int add_control(struct alc_spec *spec, int type, const char *name,
5295 int cidx, unsigned long val)
5297 struct snd_kcontrol_new *knew;
5299 knew = alc_kcontrol_new(spec);
5302 *knew = alc880_control_templates[type];
5303 knew->name = kstrdup(name, GFP_KERNEL);
5307 if (get_amp_nid_(val))
5308 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
5309 knew->private_value = val;
5313 static int add_control_with_pfx(struct alc_spec *spec, int type,
5314 const char *pfx, const char *dir,
5315 const char *sfx, int cidx, unsigned long val)
5318 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
5319 return add_control(spec, type, name, cidx, val);
5322 #define add_pb_vol_ctrl(spec, type, pfx, val) \
5323 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
5324 #define add_pb_sw_ctrl(spec, type, pfx, val) \
5325 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
5326 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
5327 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
5328 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
5329 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
5331 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
5332 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
5333 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
5334 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
5335 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
5336 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
5337 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
5338 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
5339 #define ALC880_PIN_CD_NID 0x1c
5341 /* fill in the dac_nids table from the parsed pin configuration */
5342 static int alc880_auto_fill_dac_nids(struct hda_codec *codec)
5344 struct alc_spec *spec = codec->spec;
5345 const struct auto_pin_cfg *cfg = &spec->autocfg;
5350 memset(assigned, 0, sizeof(assigned));
5351 spec->multiout.dac_nids = spec->private_dac_nids;
5353 /* check the pins hardwired to audio widget */
5354 for (i = 0; i < cfg->line_outs; i++) {
5355 nid = cfg->line_out_pins[i];
5356 if (alc880_is_fixed_pin(nid)) {
5357 int idx = alc880_fixed_pin_idx(nid);
5358 spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
5362 /* left pins can be connect to any audio widget */
5363 for (i = 0; i < cfg->line_outs; i++) {
5364 nid = cfg->line_out_pins[i];
5365 if (alc880_is_fixed_pin(nid))
5367 /* search for an empty channel */
5368 for (j = 0; j < cfg->line_outs; j++) {
5370 spec->private_dac_nids[i] =
5371 alc880_idx_to_dac(j);
5377 spec->multiout.num_dacs = cfg->line_outs;
5381 static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
5382 bool can_be_master, int *index)
5384 struct auto_pin_cfg *cfg = &spec->autocfg;
5385 static const char * const chname[4] = {
5386 "Front", "Surround", NULL /*CLFE*/, "Side"
5390 if (cfg->line_outs == 1 && !spec->multi_ios &&
5391 !cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5394 switch (cfg->line_out_type) {
5395 case AUTO_PIN_SPEAKER_OUT:
5396 if (cfg->line_outs == 1)
5399 case AUTO_PIN_HP_OUT:
5400 /* for multi-io case, only the primary out */
5401 if (ch && spec->multi_ios)
5406 if (cfg->line_outs == 1 && !spec->multi_ios)
5413 /* add playback controls from the parsed DAC table */
5414 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5415 const struct auto_pin_cfg *cfg)
5418 int i, err, noutputs;
5420 noutputs = cfg->line_outs;
5421 if (spec->multi_ios > 0)
5422 noutputs += spec->multi_ios;
5424 for (i = 0; i < noutputs; i++) {
5427 if (!spec->multiout.dac_nids[i])
5429 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5430 name = alc_get_line_out_pfx(spec, i, false, &index);
5433 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5435 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5439 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5441 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5445 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5447 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5451 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5453 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5458 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5460 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5464 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5466 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5475 /* add playback controls for speaker and HP outputs */
5476 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5485 if (alc880_is_fixed_pin(pin)) {
5486 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5487 /* specify the DAC as the extra output */
5488 if (!spec->multiout.hp_nid)
5489 spec->multiout.hp_nid = nid;
5491 spec->multiout.extra_out_nid[0] = nid;
5492 /* control HP volume/switch on the output mixer amp */
5493 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5494 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5495 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5498 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5499 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5502 } else if (alc880_is_multi_pin(pin)) {
5503 /* set manual connection */
5504 /* we have only a switch on HP-out PIN */
5505 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5506 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5513 /* create input playback/capture controls for the given pin */
5514 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5515 const char *ctlname, int ctlidx,
5516 int idx, hda_nid_t mix_nid)
5520 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5521 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5524 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5525 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5531 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5533 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5534 return (pincap & AC_PINCAP_IN) != 0;
5537 /* create playback/capture controls for input pins */
5538 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5539 const struct auto_pin_cfg *cfg,
5541 hda_nid_t cap1, hda_nid_t cap2)
5543 struct alc_spec *spec = codec->spec;
5544 struct hda_input_mux *imux = &spec->private_imux[0];
5545 int i, err, idx, type_idx = 0;
5546 const char *prev_label = NULL;
5548 for (i = 0; i < cfg->num_inputs; i++) {
5552 pin = cfg->inputs[i].pin;
5553 if (!alc_is_input_pin(codec, pin))
5556 label = hda_get_autocfg_input_label(codec, cfg, i);
5557 if (prev_label && !strcmp(label, prev_label))
5564 idx = get_connection_index(codec, mixer, pin);
5566 err = new_analog_input(spec, pin,
5576 idx = get_connection_index(codec, cap1, pin);
5577 if (idx < 0 && cap2)
5578 idx = get_connection_index(codec, cap2, pin);
5580 snd_hda_add_imux_item(imux, label, idx, NULL);
5585 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5586 const struct auto_pin_cfg *cfg)
5588 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5591 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5592 unsigned int pin_type)
5594 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5597 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5601 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5602 hda_nid_t nid, int pin_type,
5605 alc_set_pin_output(codec, nid, pin_type);
5606 /* need the manual connection? */
5607 if (alc880_is_multi_pin(nid)) {
5608 struct alc_spec *spec = codec->spec;
5609 int idx = alc880_multi_pin_idx(nid);
5610 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5611 AC_VERB_SET_CONNECT_SEL,
5612 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5616 static int get_pin_type(int line_out_type)
5618 if (line_out_type == AUTO_PIN_HP_OUT)
5624 static void alc880_auto_init_dac(struct hda_codec *codec, hda_nid_t nid)
5628 nid = alc880_idx_to_mixer(alc880_dac_to_idx(nid));
5629 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5631 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5633 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5637 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5639 struct alc_spec *spec = codec->spec;
5642 for (i = 0; i < spec->autocfg.line_outs; i++) {
5643 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5644 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5645 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5648 for (i = 0; i < spec->multiout.num_dacs; i++)
5649 alc880_auto_init_dac(codec, spec->multiout.dac_nids[i]);
5652 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5654 struct alc_spec *spec = codec->spec;
5658 pin = spec->autocfg.speaker_pins[0];
5659 if (pin) /* connect to front */
5660 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5661 pin = spec->autocfg.hp_pins[0];
5662 if (pin) /* connect to front */
5663 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5665 alc880_auto_init_dac(codec, spec->multiout.hp_nid);
5666 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
5667 alc880_auto_init_dac(codec, spec->multiout.extra_out_nid[i]);
5670 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5672 struct alc_spec *spec = codec->spec;
5673 struct auto_pin_cfg *cfg = &spec->autocfg;
5676 for (i = 0; i < cfg->num_inputs; i++) {
5677 hda_nid_t nid = cfg->inputs[i].pin;
5678 if (alc_is_input_pin(codec, nid)) {
5679 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5680 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
5681 snd_hda_codec_write(codec, nid, 0,
5682 AC_VERB_SET_AMP_GAIN_MUTE,
5687 /* mute all loopback inputs */
5688 if (spec->mixer_nid) {
5689 int nums = snd_hda_get_conn_list(codec, spec->mixer_nid, NULL);
5690 for (i = 0; i < nums; i++)
5691 snd_hda_codec_write(codec, spec->mixer_nid, 0,
5692 AC_VERB_SET_AMP_GAIN_MUTE,
5697 static void alc880_auto_init_input_src(struct hda_codec *codec)
5699 struct alc_spec *spec = codec->spec;
5702 for (c = 0; c < spec->num_adc_nids; c++) {
5703 unsigned int mux_idx;
5704 const struct hda_input_mux *imux;
5705 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5706 imux = &spec->input_mux[mux_idx];
5707 if (!imux->num_items && mux_idx > 0)
5708 imux = &spec->input_mux[0];
5710 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5711 AC_VERB_SET_CONNECT_SEL,
5712 imux->items[0].index);
5713 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5714 AC_VERB_SET_AMP_GAIN_MUTE,
5719 static int alc_auto_add_multi_channel_mode(struct hda_codec *codec,
5720 int (*fill_dac)(struct hda_codec *));
5722 /* parse the BIOS configuration and set up the alc_spec */
5723 /* return 1 if successful, 0 if the proper config is not found,
5724 * or a negative error code
5726 static int alc880_parse_auto_config(struct hda_codec *codec)
5728 struct alc_spec *spec = codec->spec;
5730 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5732 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5736 if (!spec->autocfg.line_outs)
5737 return 0; /* can't find valid BIOS pin config */
5739 err = alc880_auto_fill_dac_nids(codec);
5742 err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids);
5745 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5748 err = alc880_auto_create_extra_out(spec,
5749 spec->autocfg.speaker_pins[0],
5753 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5757 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5761 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5763 alc_auto_parse_digital(codec);
5765 if (spec->kctls.list)
5766 add_mixer(spec, spec->kctls.list);
5768 spec->num_mux_defs = 1;
5769 spec->input_mux = &spec->private_imux[0];
5771 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5776 /* additional initialization for auto-configuration model */
5777 static void alc880_auto_init(struct hda_codec *codec)
5779 struct alc_spec *spec = codec->spec;
5780 alc880_auto_init_multi_out(codec);
5781 alc880_auto_init_extra_out(codec);
5782 alc880_auto_init_analog_input(codec);
5783 alc880_auto_init_input_src(codec);
5784 alc_auto_init_digital(codec);
5785 if (spec->unsol_event)
5786 alc_inithook(codec);
5789 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5790 * one of two digital mic pins, e.g. on ALC272
5792 static void fixup_automic_adc(struct hda_codec *codec)
5794 struct alc_spec *spec = codec->spec;
5797 for (i = 0; i < spec->num_adc_nids; i++) {
5798 hda_nid_t cap = spec->capsrc_nids ?
5799 spec->capsrc_nids[i] : spec->adc_nids[i];
5802 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5805 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5808 spec->int_mic.mux_idx = iidx;
5809 spec->ext_mic.mux_idx = eidx;
5810 if (spec->capsrc_nids)
5811 spec->capsrc_nids += i;
5812 spec->adc_nids += i;
5813 spec->num_adc_nids = 1;
5814 /* optional dock-mic */
5815 eidx = get_connection_index(codec, cap, spec->dock_mic.pin);
5817 spec->dock_mic.pin = 0;
5819 spec->dock_mic.mux_idx = eidx;
5822 snd_printd(KERN_INFO "hda_codec: %s: "
5823 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5824 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5825 spec->auto_mic = 0; /* disable auto-mic to be sure */
5828 /* select or unmute the given capsrc route */
5829 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5832 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5833 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5836 snd_hda_codec_write_cache(codec, cap, 0,
5837 AC_VERB_SET_CONNECT_SEL, idx);
5841 /* set the default connection to that pin */
5842 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5844 struct alc_spec *spec = codec->spec;
5849 for (i = 0; i < spec->num_adc_nids; i++) {
5850 hda_nid_t cap = spec->capsrc_nids ?
5851 spec->capsrc_nids[i] : spec->adc_nids[i];
5854 idx = get_connection_index(codec, cap, pin);
5857 select_or_unmute_capsrc(codec, cap, idx);
5858 return i; /* return the found index */
5860 return -1; /* not found */
5863 /* choose the ADC/MUX containing the input pin and initialize the setup */
5864 static void fixup_single_adc(struct hda_codec *codec)
5866 struct alc_spec *spec = codec->spec;
5867 struct auto_pin_cfg *cfg = &spec->autocfg;
5870 /* search for the input pin; there must be only one */
5871 if (cfg->num_inputs != 1)
5873 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5875 /* use only this ADC */
5876 if (spec->capsrc_nids)
5877 spec->capsrc_nids += i;
5878 spec->adc_nids += i;
5879 spec->num_adc_nids = 1;
5880 spec->single_input_src = 1;
5884 /* initialize dual adcs */
5885 static void fixup_dual_adc_switch(struct hda_codec *codec)
5887 struct alc_spec *spec = codec->spec;
5888 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5889 init_capsrc_for_pin(codec, spec->dock_mic.pin);
5890 init_capsrc_for_pin(codec, spec->int_mic.pin);
5893 /* initialize some special cases for input sources */
5894 static void alc_init_special_input_src(struct hda_codec *codec)
5896 struct alc_spec *spec = codec->spec;
5897 if (spec->dual_adc_switch)
5898 fixup_dual_adc_switch(codec);
5899 else if (spec->single_input_src)
5900 init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
5903 static void set_capture_mixer(struct hda_codec *codec)
5905 struct alc_spec *spec = codec->spec;
5906 static const struct snd_kcontrol_new *caps[2][3] = {
5907 { alc_capture_mixer_nosrc1,
5908 alc_capture_mixer_nosrc2,
5909 alc_capture_mixer_nosrc3 },
5910 { alc_capture_mixer1,
5912 alc_capture_mixer3 },
5914 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5916 int num_adcs = spec->num_adc_nids;
5917 if (spec->dual_adc_switch)
5919 else if (spec->auto_mic)
5920 fixup_automic_adc(codec);
5921 else if (spec->input_mux) {
5922 if (spec->input_mux->num_items > 1)
5924 else if (spec->input_mux->num_items == 1)
5925 fixup_single_adc(codec);
5927 spec->cap_mixer = caps[mux][num_adcs - 1];
5931 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5932 static void fillup_priv_adc_nids(struct hda_codec *codec, const hda_nid_t *nids,
5935 struct alc_spec *spec = codec->spec;
5936 struct auto_pin_cfg *cfg = &spec->autocfg;
5938 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5940 for (n = 0; n < num_nids; n++) {
5942 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5946 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5949 nconns = snd_hda_get_connections(codec, cap, conn,
5953 nconns = snd_hda_get_connections(codec, cap, conn,
5958 if (!fallback_adc) {
5962 for (i = 0; i < cfg->num_inputs; i++) {
5963 hda_nid_t nid = cfg->inputs[i].pin;
5964 for (j = 0; j < nconns; j++) {
5971 if (i >= cfg->num_inputs) {
5972 int num_adcs = spec->num_adc_nids;
5973 spec->private_adc_nids[num_adcs] = adc;
5974 spec->private_capsrc_nids[num_adcs] = cap;
5975 spec->num_adc_nids++;
5976 spec->adc_nids = spec->private_adc_nids;
5978 spec->capsrc_nids = spec->private_capsrc_nids;
5981 if (!spec->num_adc_nids) {
5982 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5983 " using fallback 0x%x\n",
5984 codec->chip_name, fallback_adc);
5985 spec->private_adc_nids[0] = fallback_adc;
5986 spec->adc_nids = spec->private_adc_nids;
5987 if (fallback_adc != fallback_cap) {
5988 spec->private_capsrc_nids[0] = fallback_cap;
5989 spec->capsrc_nids = spec->private_adc_nids;
5994 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5995 #define set_beep_amp(spec, nid, idx, dir) \
5996 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5998 static const struct snd_pci_quirk beep_white_list[] = {
5999 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
6000 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
6001 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
6002 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
6003 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
6007 static inline int has_cdefine_beep(struct hda_codec *codec)
6009 struct alc_spec *spec = codec->spec;
6010 const struct snd_pci_quirk *q;
6011 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
6014 return spec->cdefine.enable_pcbeep;
6017 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
6018 #define has_cdefine_beep(codec) 0
6022 * OK, here we have finally the patch for ALC880
6025 static int patch_alc880(struct hda_codec *codec)
6027 struct alc_spec *spec;
6031 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6037 spec->mixer_nid = 0x0b;
6039 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
6042 if (board_config < 0) {
6043 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6045 board_config = ALC880_AUTO;
6048 if (board_config == ALC880_AUTO) {
6049 /* automatic parse from the BIOS config */
6050 err = alc880_parse_auto_config(codec);
6056 "hda_codec: Cannot set up configuration "
6057 "from BIOS. Using 3-stack mode...\n");
6058 board_config = ALC880_3ST;
6062 err = snd_hda_attach_beep_device(codec, 0x1);
6068 if (board_config != ALC880_AUTO)
6069 setup_preset(codec, &alc880_presets[board_config]);
6071 spec->stream_analog_playback = &alc880_pcm_analog_playback;
6072 spec->stream_analog_capture = &alc880_pcm_analog_capture;
6073 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
6075 spec->stream_digital_playback = &alc880_pcm_digital_playback;
6076 spec->stream_digital_capture = &alc880_pcm_digital_capture;
6078 if (!spec->adc_nids && spec->input_mux) {
6079 /* check whether NID 0x07 is valid */
6080 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
6082 wcap = get_wcaps_type(wcap);
6083 if (wcap != AC_WID_AUD_IN) {
6084 spec->adc_nids = alc880_adc_nids_alt;
6085 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
6087 spec->adc_nids = alc880_adc_nids;
6088 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
6091 set_capture_mixer(codec);
6092 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6094 spec->vmaster_nid = 0x0c;
6096 codec->patch_ops = alc_patch_ops;
6097 if (board_config == ALC880_AUTO)
6098 spec->init_hook = alc880_auto_init;
6099 #ifdef CONFIG_SND_HDA_POWER_SAVE
6100 if (!spec->loopback.amplist)
6101 spec->loopback.amplist = alc880_loopbacks;
6112 static const hda_nid_t alc260_dac_nids[1] = {
6117 static const hda_nid_t alc260_adc_nids[1] = {
6122 static const hda_nid_t alc260_adc_nids_alt[1] = {
6127 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
6128 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
6130 static const hda_nid_t alc260_dual_adc_nids[2] = {
6135 #define ALC260_DIGOUT_NID 0x03
6136 #define ALC260_DIGIN_NID 0x06
6138 static const struct hda_input_mux alc260_capture_source = {
6142 { "Front Mic", 0x1 },
6148 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
6149 * headphone jack and the internal CD lines since these are the only pins at
6150 * which audio can appear. For flexibility, also allow the option of
6151 * recording the mixer output on the second ADC (ADC0 doesn't have a
6152 * connection to the mixer output).
6154 static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
6158 { "Mic/Line", 0x0 },
6160 { "Headphone", 0x2 },
6166 { "Mic/Line", 0x0 },
6168 { "Headphone", 0x2 },
6175 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6176 * the Fujitsu S702x, but jacks are marked differently.
6178 static const struct hda_input_mux alc260_acer_capture_sources[2] = {
6185 { "Headphone", 0x5 },
6194 { "Headphone", 0x6 },
6200 /* Maxdata Favorit 100XS */
6201 static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
6205 { "Line/Mic", 0x0 },
6212 { "Line/Mic", 0x0 },
6220 * This is just place-holder, so there's something for alc_build_pcms to look
6221 * at when it calculates the maximum number of channels. ALC260 has no mixer
6222 * element which allows changing the channel mode, so the verb list is
6225 static const struct hda_channel_mode alc260_modes[1] = {
6230 /* Mixer combinations
6232 * basic: base_output + input + pc_beep + capture
6233 * HP: base_output + input + capture_alt
6234 * HP_3013: hp_3013 + input + capture
6235 * fujitsu: fujitsu + capture
6236 * acer: acer + capture
6239 static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
6240 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6241 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6242 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6243 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6244 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6245 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6249 static const struct snd_kcontrol_new alc260_input_mixer[] = {
6250 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6251 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6252 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6253 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6255 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6256 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
6257 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
6261 /* update HP, line and mono out pins according to the master switch */
6262 static void alc260_hp_master_update(struct hda_codec *codec)
6264 update_speakers(codec);
6267 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
6268 struct snd_ctl_elem_value *ucontrol)
6270 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6271 struct alc_spec *spec = codec->spec;
6272 *ucontrol->value.integer.value = !spec->master_mute;
6276 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
6277 struct snd_ctl_elem_value *ucontrol)
6279 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6280 struct alc_spec *spec = codec->spec;
6281 int val = !*ucontrol->value.integer.value;
6283 if (val == spec->master_mute)
6285 spec->master_mute = val;
6286 alc260_hp_master_update(codec);
6290 static const struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6292 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6293 .name = "Master Playback Switch",
6294 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6295 .info = snd_ctl_boolean_mono_info,
6296 .get = alc260_hp_master_sw_get,
6297 .put = alc260_hp_master_sw_put,
6299 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6300 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6301 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6302 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
6303 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6305 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6309 static const struct hda_verb alc260_hp_unsol_verbs[] = {
6310 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6314 static void alc260_hp_setup(struct hda_codec *codec)
6316 struct alc_spec *spec = codec->spec;
6318 spec->autocfg.hp_pins[0] = 0x0f;
6319 spec->autocfg.speaker_pins[0] = 0x10;
6320 spec->autocfg.speaker_pins[1] = 0x11;
6322 spec->automute_mode = ALC_AUTOMUTE_PIN;
6325 static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6328 .name = "Master Playback Switch",
6329 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
6330 .info = snd_ctl_boolean_mono_info,
6331 .get = alc260_hp_master_sw_get,
6332 .put = alc260_hp_master_sw_put,
6334 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6335 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6336 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
6337 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
6338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6340 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6341 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
6345 static void alc260_hp_3013_setup(struct hda_codec *codec)
6347 struct alc_spec *spec = codec->spec;
6349 spec->autocfg.hp_pins[0] = 0x15;
6350 spec->autocfg.speaker_pins[0] = 0x10;
6351 spec->autocfg.speaker_pins[1] = 0x11;
6353 spec->automute_mode = ALC_AUTOMUTE_PIN;
6356 static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6357 .ops = &snd_hda_bind_vol,
6359 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
6360 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
6361 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
6366 static const struct hda_bind_ctls alc260_dc7600_bind_switch = {
6367 .ops = &snd_hda_bind_sw,
6369 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
6370 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
6375 static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6376 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6377 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6378 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
6379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
6383 static const struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6384 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6388 static void alc260_hp_3012_setup(struct hda_codec *codec)
6390 struct alc_spec *spec = codec->spec;
6392 spec->autocfg.hp_pins[0] = 0x10;
6393 spec->autocfg.speaker_pins[0] = 0x0f;
6394 spec->autocfg.speaker_pins[1] = 0x11;
6395 spec->autocfg.speaker_pins[2] = 0x15;
6397 spec->automute_mode = ALC_AUTOMUTE_PIN;
6400 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6401 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6403 static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6404 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6405 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6406 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6407 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6408 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6409 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6410 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6411 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6412 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6413 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6417 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6418 * versions of the ALC260 don't act on requests to enable mic bias from NID
6419 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6420 * datasheet doesn't mention this restriction. At this stage it's not clear
6421 * whether this behaviour is intentional or is a hardware bug in chip
6422 * revisions available in early 2006. Therefore for now allow the
6423 * "Headphone Jack Mode" control to span all choices, but if it turns out
6424 * that the lack of mic bias for this NID is intentional we could change the
6425 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6427 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6428 * don't appear to make the mic bias available from the "line" jack, even
6429 * though the NID used for this jack (0x14) can supply it. The theory is
6430 * that perhaps Acer have included blocking capacitors between the ALC260
6431 * and the output jack. If this turns out to be the case for all such
6432 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6433 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6435 * The C20x Tablet series have a mono internal speaker which is controlled
6436 * via the chip's Mono sum widget and pin complex, so include the necessary
6437 * controls for such models. On models without a "mono speaker" the control
6438 * won't do anything.
6440 static const struct snd_kcontrol_new alc260_acer_mixer[] = {
6441 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6442 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6443 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6444 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6446 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6448 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6449 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6450 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6451 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6452 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6453 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6454 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6455 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6459 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6461 static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6462 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6463 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6464 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6465 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6466 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6467 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6471 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6472 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6474 static const struct snd_kcontrol_new alc260_will_mixer[] = {
6475 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6476 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6477 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6478 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6479 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6480 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6481 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6482 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6483 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6484 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6488 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6489 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6491 static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6492 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6493 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6494 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6495 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6496 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6497 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6498 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6499 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6500 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6501 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6506 * initialization verbs
6508 static const struct hda_verb alc260_init_verbs[] = {
6509 /* Line In pin widget for input */
6510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6511 /* CD pin widget for input */
6512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6513 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6514 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6515 /* Mic2 (front panel) pin widget for input and vref at 80% */
6516 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6517 /* LINE-2 is used for line-out in rear */
6518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6519 /* select line-out */
6520 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6522 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6524 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6526 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6527 /* mute capture amp left and right */
6528 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6529 /* set connection select to line in (default select for this ADC) */
6530 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6531 /* mute capture amp left and right */
6532 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6533 /* set connection select to line in (default select for this ADC) */
6534 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6535 /* set vol=0 Line-Out mixer amp left and right */
6536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6537 /* unmute pin widget amp left and right (no gain on this amp) */
6538 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6539 /* set vol=0 HP mixer amp left and right */
6540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6541 /* unmute pin widget amp left and right (no gain on this amp) */
6542 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6543 /* set vol=0 Mono mixer amp left and right */
6544 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6545 /* unmute pin widget amp left and right (no gain on this amp) */
6546 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6547 /* unmute LINE-2 out pin */
6548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6549 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6552 /* mute analog inputs */
6553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6554 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6558 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6559 /* mute Front out path */
6560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6561 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6562 /* mute Headphone out path */
6563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6564 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6565 /* mute Mono out path */
6566 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6567 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6571 #if 0 /* should be identical with alc260_init_verbs? */
6572 static const struct hda_verb alc260_hp_init_verbs[] = {
6573 /* Headphone and output */
6574 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6576 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6577 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6578 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6579 /* Mic2 (front panel) pin widget for input and vref at 80% */
6580 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6581 /* Line In pin widget for input */
6582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6583 /* Line-2 pin widget for output */
6584 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6585 /* CD pin widget for input */
6586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6587 /* unmute amp left and right */
6588 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6589 /* set connection select to line in (default select for this ADC) */
6590 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6591 /* unmute Line-Out mixer amp left and right (volume = 0) */
6592 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6593 /* mute pin widget amp left and right (no gain on this amp) */
6594 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6595 /* unmute HP mixer amp left and right (volume = 0) */
6596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6597 /* mute pin widget amp left and right (no gain on this amp) */
6598 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6599 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6602 /* mute analog inputs */
6603 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6604 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6605 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6606 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6608 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6609 /* Unmute Front out path */
6610 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6611 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6612 /* Unmute Headphone out path */
6613 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6615 /* Unmute Mono out path */
6616 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6617 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6622 static const struct hda_verb alc260_hp_3013_init_verbs[] = {
6623 /* Line out and output */
6624 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6626 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6627 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6628 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6629 /* Mic2 (front panel) pin widget for input and vref at 80% */
6630 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6631 /* Line In pin widget for input */
6632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6633 /* Headphone pin widget for output */
6634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6635 /* CD pin widget for input */
6636 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6637 /* unmute amp left and right */
6638 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6639 /* set connection select to line in (default select for this ADC) */
6640 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6641 /* unmute Line-Out mixer amp left and right (volume = 0) */
6642 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6643 /* mute pin widget amp left and right (no gain on this amp) */
6644 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6645 /* unmute HP mixer amp left and right (volume = 0) */
6646 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6647 /* mute pin widget amp left and right (no gain on this amp) */
6648 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6649 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6652 /* mute analog inputs */
6653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6654 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6656 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6657 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6658 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6659 /* Unmute Front out path */
6660 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6661 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6662 /* Unmute Headphone out path */
6663 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6664 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6665 /* Unmute Mono out path */
6666 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6667 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6671 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6672 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6673 * audio = 0x16, internal speaker = 0x10.
6675 static const struct hda_verb alc260_fujitsu_init_verbs[] = {
6676 /* Disable all GPIOs */
6677 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6678 /* Internal speaker is connected to headphone pin */
6679 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6680 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6681 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6682 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6683 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6684 /* Ensure all other unused pins are disabled and muted. */
6685 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6686 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6687 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6688 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6689 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6690 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6694 /* Disable digital (SPDIF) pins */
6695 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6696 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6698 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6699 * when acting as an output.
6701 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6703 /* Start with output sum widgets muted and their output gains at min */
6704 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6705 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6706 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6707 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6708 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6710 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6711 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6712 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6714 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6715 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6716 /* Unmute Line1 pin widget output buffer since it starts as an output.
6717 * If the pin mode is changed by the user the pin mode control will
6718 * take care of enabling the pin's input/output buffers as needed.
6719 * Therefore there's no need to enable the input buffer at this
6722 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6723 /* Unmute input buffer of pin widget used for Line-in (no equiv
6726 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6728 /* Mute capture amp left and right */
6729 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6730 /* Set ADC connection select to match default mixer setting - line
6733 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6735 /* Do the same for the second ADC: mute capture input amp and
6736 * set ADC connection to line in (on mic1 pin)
6738 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6739 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6741 /* Mute all inputs to mixer widget (even unconnected ones) */
6742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6743 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6744 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6746 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6747 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6754 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6755 * similar laptops (adapted from Fujitsu init verbs).
6757 static const struct hda_verb alc260_acer_init_verbs[] = {
6758 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6759 * the headphone jack. Turn this on and rely on the standard mute
6760 * methods whenever the user wants to turn these outputs off.
6762 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6763 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6764 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6765 /* Internal speaker/Headphone jack is connected to Line-out pin */
6766 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6767 /* Internal microphone/Mic jack is connected to Mic1 pin */
6768 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6769 /* Line In jack is connected to Line1 pin */
6770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6771 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6772 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6773 /* Ensure all other unused pins are disabled and muted. */
6774 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6775 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6776 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6777 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6779 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6780 /* Disable digital (SPDIF) pins */
6781 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6782 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6784 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6785 * bus when acting as outputs.
6787 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6788 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6790 /* Start with output sum widgets muted and their output gains at min */
6791 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6792 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6794 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6795 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6796 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6797 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6798 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6799 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6801 /* Unmute Line-out pin widget amp left and right
6802 * (no equiv mixer ctrl)
6804 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6805 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6806 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6807 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6808 * inputs. If the pin mode is changed by the user the pin mode control
6809 * will take care of enabling the pin's input/output buffers as needed.
6810 * Therefore there's no need to enable the input buffer at this
6813 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6814 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6816 /* Mute capture amp left and right */
6817 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6818 /* Set ADC connection select to match default mixer setting - mic
6821 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6823 /* Do similar with the second ADC: mute capture input amp and
6824 * set ADC connection to mic to match ALSA's default state.
6826 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6827 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6829 /* Mute all inputs to mixer widget (even unconnected ones) */
6830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6832 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6833 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6834 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6835 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6836 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6837 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6842 /* Initialisation sequence for Maxdata Favorit 100XS
6843 * (adapted from Acer init verbs).
6845 static const struct hda_verb alc260_favorit100_init_verbs[] = {
6846 /* GPIO 0 enables the output jack.
6847 * Turn this on and rely on the standard mute
6848 * methods whenever the user wants to turn these outputs off.
6850 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6851 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6852 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6853 /* Line/Mic input jack is connected to Mic1 pin */
6854 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6855 /* Ensure all other unused pins are disabled and muted. */
6856 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6857 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6858 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6859 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6860 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6861 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6866 /* Disable digital (SPDIF) pins */
6867 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6868 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6870 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6871 * bus when acting as outputs.
6873 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6874 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6876 /* Start with output sum widgets muted and their output gains at min */
6877 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6878 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6879 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6880 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6881 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6882 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6883 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6884 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6885 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6887 /* Unmute Line-out pin widget amp left and right
6888 * (no equiv mixer ctrl)
6890 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6891 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6892 * inputs. If the pin mode is changed by the user the pin mode control
6893 * will take care of enabling the pin's input/output buffers as needed.
6894 * Therefore there's no need to enable the input buffer at this
6897 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6899 /* Mute capture amp left and right */
6900 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6901 /* Set ADC connection select to match default mixer setting - mic
6904 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6906 /* Do similar with the second ADC: mute capture input amp and
6907 * set ADC connection to mic to match ALSA's default state.
6909 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6910 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6912 /* Mute all inputs to mixer widget (even unconnected ones) */
6913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6914 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6917 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6919 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6925 static const struct hda_verb alc260_will_verbs[] = {
6926 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6927 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6928 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6929 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6930 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6931 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6935 static const struct hda_verb alc260_replacer_672v_verbs[] = {
6936 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6937 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6938 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6940 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6941 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6942 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6944 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6948 /* toggle speaker-output according to the hp-jack state */
6949 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6951 unsigned int present;
6953 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6954 present = snd_hda_jack_detect(codec, 0x0f);
6956 snd_hda_codec_write_cache(codec, 0x01, 0,
6957 AC_VERB_SET_GPIO_DATA, 1);
6958 snd_hda_codec_write_cache(codec, 0x0f, 0,
6959 AC_VERB_SET_PIN_WIDGET_CONTROL,
6962 snd_hda_codec_write_cache(codec, 0x01, 0,
6963 AC_VERB_SET_GPIO_DATA, 0);
6964 snd_hda_codec_write_cache(codec, 0x0f, 0,
6965 AC_VERB_SET_PIN_WIDGET_CONTROL,
6970 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6973 if ((res >> 26) == ALC880_HP_EVENT)
6974 alc260_replacer_672v_automute(codec);
6977 static const struct hda_verb alc260_hp_dc7600_verbs[] = {
6978 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6979 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6980 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6981 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6982 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6983 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6984 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6985 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6986 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6987 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6991 /* Test configuration for debugging, modelled after the ALC880 test
6994 #ifdef CONFIG_SND_DEBUG
6995 static const hda_nid_t alc260_test_dac_nids[1] = {
6998 static const hda_nid_t alc260_test_adc_nids[2] = {
7001 /* For testing the ALC260, each input MUX needs its own definition since
7002 * the signal assignments are different. This assumes that the first ADC
7005 static const struct hda_input_mux alc260_test_capture_sources[2] = {
7009 { "MIC1 pin", 0x0 },
7010 { "MIC2 pin", 0x1 },
7011 { "LINE1 pin", 0x2 },
7012 { "LINE2 pin", 0x3 },
7014 { "LINE-OUT pin", 0x5 },
7015 { "HP-OUT pin", 0x6 },
7021 { "MIC1 pin", 0x0 },
7022 { "MIC2 pin", 0x1 },
7023 { "LINE1 pin", 0x2 },
7024 { "LINE2 pin", 0x3 },
7027 { "LINE-OUT pin", 0x6 },
7028 { "HP-OUT pin", 0x7 },
7032 static const struct snd_kcontrol_new alc260_test_mixer[] = {
7033 /* Output driver widgets */
7034 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
7035 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
7036 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
7037 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
7038 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
7039 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
7041 /* Modes for retasking pin widgets
7042 * Note: the ALC260 doesn't seem to act on requests to enable mic
7043 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
7044 * mention this restriction. At this stage it's not clear whether
7045 * this behaviour is intentional or is a hardware bug in chip
7046 * revisions available at least up until early 2006. Therefore for
7047 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
7048 * choices, but if it turns out that the lack of mic bias for these
7049 * NIDs is intentional we could change their modes from
7050 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
7052 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
7053 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
7054 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
7055 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
7056 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
7057 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
7059 /* Loopback mixer controls */
7060 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
7061 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
7062 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
7063 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
7064 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
7065 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
7066 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
7067 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
7068 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
7069 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
7070 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
7071 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
7072 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
7073 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
7075 /* Controls for GPIO pins, assuming they are configured as outputs */
7076 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
7077 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
7078 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
7079 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
7081 /* Switches to allow the digital IO pins to be enabled. The datasheet
7082 * is ambigious as to which NID is which; testing on laptops which
7083 * make this output available should provide clarification.
7085 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
7086 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
7088 /* A switch allowing EAPD to be enabled. Some laptops seem to use
7089 * this output to turn on an external amplifier.
7091 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
7092 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
7096 static const struct hda_verb alc260_test_init_verbs[] = {
7097 /* Enable all GPIOs as outputs with an initial value of 0 */
7098 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
7099 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
7100 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
7102 /* Enable retasking pins as output, initially without power amp */
7103 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7104 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7107 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7108 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7110 /* Disable digital (SPDIF) pins initially, but users can enable
7111 * them via a mixer switch. In the case of SPDIF-out, this initverb
7112 * payload also sets the generation to 0, output to be in "consumer"
7113 * PCM format, copyright asserted, no pre-emphasis and no validity
7116 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
7117 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
7119 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
7120 * OUT1 sum bus when acting as an output.
7122 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
7123 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
7124 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
7125 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
7127 /* Start with output sum widgets muted and their output gains at min */
7128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7134 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7135 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7136 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7138 /* Unmute retasking pin widget output buffers since the default
7139 * state appears to be output. As the pin mode is changed by the
7140 * user the pin mode control will take care of enabling the pin's
7141 * input/output buffers as needed.
7143 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7144 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7145 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7146 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7147 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7148 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7149 /* Also unmute the mono-out pin widget */
7150 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7152 /* Mute capture amp left and right */
7153 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7154 /* Set ADC connection select to match default mixer setting (mic1
7157 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
7159 /* Do the same for the second ADC: mute capture input amp and
7160 * set ADC connection to mic1 pin
7162 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7163 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
7165 /* Mute all inputs to mixer widget (even unconnected ones) */
7166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
7167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
7168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
7169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
7170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
7171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
7172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
7173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
7179 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7180 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
7182 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
7183 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
7186 * for BIOS auto-configuration
7189 /* convert from pin to volume-mixer widget */
7190 static hda_nid_t alc260_pin_to_vol_mix(hda_nid_t nid)
7192 if (nid >= 0x0f && nid <= 0x11)
7194 else if (nid >= 0x12 && nid <= 0x15)
7200 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
7201 const char *pfx, int *vol_bits)
7204 unsigned long vol_val, sw_val;
7207 nid_vol = alc260_pin_to_vol_mix(nid);
7214 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, chs, 0, HDA_OUTPUT);
7215 sw_val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT);
7217 if (!(*vol_bits & (1 << nid_vol))) {
7218 /* first control for the volume widget */
7219 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
7222 *vol_bits |= (1 << nid_vol);
7224 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
7230 /* add playback controls from the parsed DAC table */
7231 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
7232 const struct auto_pin_cfg *cfg)
7238 spec->multiout.num_dacs = 1;
7239 spec->multiout.dac_nids = spec->private_dac_nids;
7240 spec->private_dac_nids[0] = 0x02;
7242 nid = cfg->line_out_pins[0];
7246 pfx = alc_get_line_out_pfx(spec, 0, true, &index);
7247 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
7252 nid = cfg->speaker_pins[0];
7254 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
7259 nid = cfg->hp_pins[0];
7261 err = alc260_add_playback_controls(spec, nid, "Headphone",
7269 /* create playback/capture controls for input pins */
7270 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
7271 const struct auto_pin_cfg *cfg)
7273 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
7276 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
7277 hda_nid_t nid, int pin_type,
7282 alc_set_pin_output(codec, nid, pin_type);
7283 /* need the manual connection? */
7285 int idx = nid - 0x12;
7286 snd_hda_codec_write(codec, idx + 0x0b, 0,
7287 AC_VERB_SET_CONNECT_SEL, sel_idx);
7290 mix = alc260_pin_to_vol_mix(nid);
7293 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7295 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7297 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
7301 static void alc260_auto_init_multi_out(struct hda_codec *codec)
7303 struct alc_spec *spec = codec->spec;
7306 nid = spec->autocfg.line_out_pins[0];
7308 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7309 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
7312 nid = spec->autocfg.speaker_pins[0];
7314 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
7316 nid = spec->autocfg.hp_pins[0];
7318 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7321 #define alc260_auto_init_analog_input alc880_auto_init_analog_input
7322 #define alc260_auto_init_input_src alc880_auto_init_input_src
7324 static int alc260_parse_auto_config(struct hda_codec *codec)
7326 struct alc_spec *spec = codec->spec;
7328 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
7330 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7334 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
7337 if (!spec->kctls.list)
7338 return 0; /* can't find valid BIOS pin config */
7339 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
7343 spec->multiout.max_channels = 2;
7345 if (spec->autocfg.dig_outs)
7346 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
7347 if (spec->kctls.list)
7348 add_mixer(spec, spec->kctls.list);
7350 spec->num_mux_defs = 1;
7351 spec->input_mux = &spec->private_imux[0];
7353 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7358 /* additional initialization for auto-configuration model */
7359 static void alc260_auto_init(struct hda_codec *codec)
7361 struct alc_spec *spec = codec->spec;
7362 alc260_auto_init_multi_out(codec);
7363 alc260_auto_init_analog_input(codec);
7364 alc260_auto_init_input_src(codec);
7365 alc_auto_init_digital(codec);
7366 if (spec->unsol_event)
7367 alc_inithook(codec);
7370 #ifdef CONFIG_SND_HDA_POWER_SAVE
7371 static const struct hda_amp_list alc260_loopbacks[] = {
7372 { 0x07, HDA_INPUT, 0 },
7373 { 0x07, HDA_INPUT, 1 },
7374 { 0x07, HDA_INPUT, 2 },
7375 { 0x07, HDA_INPUT, 3 },
7376 { 0x07, HDA_INPUT, 4 },
7388 static const struct alc_fixup alc260_fixups[] = {
7389 [PINFIX_HP_DC5750] = {
7390 .type = ALC_FIXUP_PINS,
7391 .v.pins = (const struct alc_pincfg[]) {
7392 { 0x11, 0x90130110 }, /* speaker */
7398 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
7399 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7404 * ALC260 configurations
7406 static const char * const alc260_models[ALC260_MODEL_LAST] = {
7407 [ALC260_BASIC] = "basic",
7409 [ALC260_HP_3013] = "hp-3013",
7410 [ALC260_HP_DC7600] = "hp-dc7600",
7411 [ALC260_FUJITSU_S702X] = "fujitsu",
7412 [ALC260_ACER] = "acer",
7413 [ALC260_WILL] = "will",
7414 [ALC260_REPLACER_672V] = "replacer",
7415 [ALC260_FAVORIT100] = "favorit100",
7416 #ifdef CONFIG_SND_DEBUG
7417 [ALC260_TEST] = "test",
7419 [ALC260_AUTO] = "auto",
7422 static const struct snd_pci_quirk alc260_cfg_tbl[] = {
7423 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7424 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7425 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7426 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7427 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7428 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7429 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7430 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7431 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7432 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7433 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7434 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7435 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7436 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7437 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7438 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7439 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7440 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7441 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7442 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7446 static const struct alc_config_preset alc260_presets[] = {
7448 .mixers = { alc260_base_output_mixer,
7449 alc260_input_mixer },
7450 .init_verbs = { alc260_init_verbs },
7451 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7452 .dac_nids = alc260_dac_nids,
7453 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7454 .adc_nids = alc260_dual_adc_nids,
7455 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7456 .channel_mode = alc260_modes,
7457 .input_mux = &alc260_capture_source,
7460 .mixers = { alc260_hp_output_mixer,
7461 alc260_input_mixer },
7462 .init_verbs = { alc260_init_verbs,
7463 alc260_hp_unsol_verbs },
7464 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7465 .dac_nids = alc260_dac_nids,
7466 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7467 .adc_nids = alc260_adc_nids_alt,
7468 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7469 .channel_mode = alc260_modes,
7470 .input_mux = &alc260_capture_source,
7471 .unsol_event = alc_sku_unsol_event,
7472 .setup = alc260_hp_setup,
7473 .init_hook = alc_inithook,
7475 [ALC260_HP_DC7600] = {
7476 .mixers = { alc260_hp_dc7600_mixer,
7477 alc260_input_mixer },
7478 .init_verbs = { alc260_init_verbs,
7479 alc260_hp_dc7600_verbs },
7480 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7481 .dac_nids = alc260_dac_nids,
7482 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7483 .adc_nids = alc260_adc_nids_alt,
7484 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7485 .channel_mode = alc260_modes,
7486 .input_mux = &alc260_capture_source,
7487 .unsol_event = alc_sku_unsol_event,
7488 .setup = alc260_hp_3012_setup,
7489 .init_hook = alc_inithook,
7491 [ALC260_HP_3013] = {
7492 .mixers = { alc260_hp_3013_mixer,
7493 alc260_input_mixer },
7494 .init_verbs = { alc260_hp_3013_init_verbs,
7495 alc260_hp_3013_unsol_verbs },
7496 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7497 .dac_nids = alc260_dac_nids,
7498 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7499 .adc_nids = alc260_adc_nids_alt,
7500 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7501 .channel_mode = alc260_modes,
7502 .input_mux = &alc260_capture_source,
7503 .unsol_event = alc_sku_unsol_event,
7504 .setup = alc260_hp_3013_setup,
7505 .init_hook = alc_inithook,
7507 [ALC260_FUJITSU_S702X] = {
7508 .mixers = { alc260_fujitsu_mixer },
7509 .init_verbs = { alc260_fujitsu_init_verbs },
7510 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7511 .dac_nids = alc260_dac_nids,
7512 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7513 .adc_nids = alc260_dual_adc_nids,
7514 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7515 .channel_mode = alc260_modes,
7516 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7517 .input_mux = alc260_fujitsu_capture_sources,
7520 .mixers = { alc260_acer_mixer },
7521 .init_verbs = { alc260_acer_init_verbs },
7522 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7523 .dac_nids = alc260_dac_nids,
7524 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7525 .adc_nids = alc260_dual_adc_nids,
7526 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7527 .channel_mode = alc260_modes,
7528 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7529 .input_mux = alc260_acer_capture_sources,
7531 [ALC260_FAVORIT100] = {
7532 .mixers = { alc260_favorit100_mixer },
7533 .init_verbs = { alc260_favorit100_init_verbs },
7534 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7535 .dac_nids = alc260_dac_nids,
7536 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7537 .adc_nids = alc260_dual_adc_nids,
7538 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7539 .channel_mode = alc260_modes,
7540 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7541 .input_mux = alc260_favorit100_capture_sources,
7544 .mixers = { alc260_will_mixer },
7545 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7546 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7547 .dac_nids = alc260_dac_nids,
7548 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7549 .adc_nids = alc260_adc_nids,
7550 .dig_out_nid = ALC260_DIGOUT_NID,
7551 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7552 .channel_mode = alc260_modes,
7553 .input_mux = &alc260_capture_source,
7555 [ALC260_REPLACER_672V] = {
7556 .mixers = { alc260_replacer_672v_mixer },
7557 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7558 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7559 .dac_nids = alc260_dac_nids,
7560 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7561 .adc_nids = alc260_adc_nids,
7562 .dig_out_nid = ALC260_DIGOUT_NID,
7563 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7564 .channel_mode = alc260_modes,
7565 .input_mux = &alc260_capture_source,
7566 .unsol_event = alc260_replacer_672v_unsol_event,
7567 .init_hook = alc260_replacer_672v_automute,
7569 #ifdef CONFIG_SND_DEBUG
7571 .mixers = { alc260_test_mixer },
7572 .init_verbs = { alc260_test_init_verbs },
7573 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7574 .dac_nids = alc260_test_dac_nids,
7575 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7576 .adc_nids = alc260_test_adc_nids,
7577 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7578 .channel_mode = alc260_modes,
7579 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7580 .input_mux = alc260_test_capture_sources,
7585 static int patch_alc260(struct hda_codec *codec)
7587 struct alc_spec *spec;
7588 int err, board_config;
7590 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7596 spec->mixer_nid = 0x07;
7598 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7601 if (board_config < 0) {
7602 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7604 board_config = ALC260_AUTO;
7607 if (board_config == ALC260_AUTO) {
7608 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7609 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7612 if (board_config == ALC260_AUTO) {
7613 /* automatic parse from the BIOS config */
7614 err = alc260_parse_auto_config(codec);
7620 "hda_codec: Cannot set up configuration "
7621 "from BIOS. Using base mode...\n");
7622 board_config = ALC260_BASIC;
7626 err = snd_hda_attach_beep_device(codec, 0x1);
7632 if (board_config != ALC260_AUTO)
7633 setup_preset(codec, &alc260_presets[board_config]);
7635 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7636 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7637 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7639 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7640 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7642 if (!spec->adc_nids && spec->input_mux) {
7643 /* check whether NID 0x04 is valid */
7644 unsigned int wcap = get_wcaps(codec, 0x04);
7645 wcap = get_wcaps_type(wcap);
7647 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7648 spec->adc_nids = alc260_adc_nids_alt;
7649 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7651 spec->adc_nids = alc260_adc_nids;
7652 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7655 set_capture_mixer(codec);
7656 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7658 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7660 spec->vmaster_nid = 0x08;
7662 codec->patch_ops = alc_patch_ops;
7663 if (board_config == ALC260_AUTO)
7664 spec->init_hook = alc260_auto_init;
7665 spec->shutup = alc_eapd_shutup;
7666 #ifdef CONFIG_SND_HDA_POWER_SAVE
7667 if (!spec->loopback.amplist)
7668 spec->loopback.amplist = alc260_loopbacks;
7676 * ALC882/883/885/888/889 support
7678 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7679 * configuration. Each pin widget can choose any input DACs and a mixer.
7680 * Each ADC is connected from a mixer of all inputs. This makes possible
7681 * 6-channel independent captures.
7683 * In addition, an independent DAC for the multi-playback (not used in this
7686 #define ALC882_DIGOUT_NID 0x06
7687 #define ALC882_DIGIN_NID 0x0a
7688 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7689 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7690 #define ALC1200_DIGOUT_NID 0x10
7693 static const struct hda_channel_mode alc882_ch_modes[1] = {
7698 static const hda_nid_t alc882_dac_nids[4] = {
7699 /* front, rear, clfe, rear_surr */
7700 0x02, 0x03, 0x04, 0x05
7702 #define alc883_dac_nids alc882_dac_nids
7705 #define alc882_adc_nids alc880_adc_nids
7706 #define alc882_adc_nids_alt alc880_adc_nids_alt
7707 #define alc883_adc_nids alc882_adc_nids_alt
7708 static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7709 static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7710 #define alc889_adc_nids alc880_adc_nids
7712 static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7713 static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7714 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7715 static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7716 #define alc889_capsrc_nids alc882_capsrc_nids
7719 /* FIXME: should be a matrix-type input source selection */
7721 static const struct hda_input_mux alc882_capture_source = {
7725 { "Front Mic", 0x1 },
7731 #define alc883_capture_source alc882_capture_source
7733 static const struct hda_input_mux alc889_capture_source = {
7736 { "Front Mic", 0x0 },
7742 static const struct hda_input_mux mb5_capture_source = {
7751 static const struct hda_input_mux macmini3_capture_source = {
7759 static const struct hda_input_mux alc883_3stack_6ch_intel = {
7763 { "Front Mic", 0x0 },
7769 static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
7777 static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7781 { "Internal Mic", 0x1 },
7787 static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7791 { "Internal Mic", 0x1 },
7795 static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
7799 { "Front Mic", 0x1 },
7804 static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
7812 static const struct hda_input_mux alc889A_mb31_capture_source = {
7816 /* Front Mic (0x01) unused */
7818 /* Line 2 (0x03) unused */
7819 /* CD (0x04) unused? */
7823 static const struct hda_input_mux alc889A_imac91_capture_source = {
7827 { "Line", 0x2 }, /* Not sure! */
7834 static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7841 static const struct hda_verb alc882_3ST_ch2_init[] = {
7842 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7843 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7844 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7845 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7852 static const struct hda_verb alc882_3ST_ch4_init[] = {
7853 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7854 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7855 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7856 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7857 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7864 static const struct hda_verb alc882_3ST_ch6_init[] = {
7865 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7866 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7867 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7869 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7870 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7874 static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7875 { 2, alc882_3ST_ch2_init },
7876 { 4, alc882_3ST_ch4_init },
7877 { 6, alc882_3ST_ch6_init },
7880 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7885 static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7886 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7887 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7888 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7889 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7890 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7897 static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7898 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7899 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7900 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7901 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7902 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7903 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7910 static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7911 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7912 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7913 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7914 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7915 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7916 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7917 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7921 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7922 { 2, alc883_3ST_ch2_clevo_init },
7923 { 4, alc883_3ST_ch4_clevo_init },
7924 { 6, alc883_3ST_ch6_clevo_init },
7931 static const struct hda_verb alc882_sixstack_ch6_init[] = {
7932 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7933 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7934 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7935 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7942 static const struct hda_verb alc882_sixstack_ch8_init[] = {
7943 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7944 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7945 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7946 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7950 static const struct hda_channel_mode alc882_sixstack_modes[2] = {
7951 { 6, alc882_sixstack_ch6_init },
7952 { 8, alc882_sixstack_ch8_init },
7956 /* Macbook Air 2,1 */
7958 static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7963 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7969 static const struct hda_verb alc885_mbp_ch2_init[] = {
7970 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7971 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7972 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7979 static const struct hda_verb alc885_mbp_ch4_init[] = {
7980 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7981 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7982 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7983 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7984 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7988 static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7989 { 2, alc885_mbp_ch2_init },
7990 { 4, alc885_mbp_ch4_init },
7995 * Speakers/Woofer/HP = Front
7998 static const struct hda_verb alc885_mb5_ch2_init[] = {
7999 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8006 * Speakers/HP = Front
8010 static const struct hda_verb alc885_mb5_ch6_init[] = {
8011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8013 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8017 static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
8018 { 2, alc885_mb5_ch2_init },
8019 { 6, alc885_mb5_ch6_init },
8022 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
8027 static const struct hda_verb alc883_4ST_ch2_init[] = {
8028 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8029 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8030 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8031 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8032 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8033 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8040 static const struct hda_verb alc883_4ST_ch4_init[] = {
8041 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8042 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8043 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8044 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8045 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8046 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8047 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8054 static const struct hda_verb alc883_4ST_ch6_init[] = {
8055 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8056 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8057 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8058 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8059 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8060 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8061 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8062 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8069 static const struct hda_verb alc883_4ST_ch8_init[] = {
8070 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8071 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8072 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8073 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8074 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8075 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8076 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8077 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8078 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8082 static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
8083 { 2, alc883_4ST_ch2_init },
8084 { 4, alc883_4ST_ch4_init },
8085 { 6, alc883_4ST_ch6_init },
8086 { 8, alc883_4ST_ch8_init },
8093 static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
8094 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8095 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8096 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8097 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8104 static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
8105 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8106 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8107 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8108 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8109 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8116 static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
8117 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8118 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8119 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
8120 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8121 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8122 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
8126 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
8127 { 2, alc883_3ST_ch2_intel_init },
8128 { 4, alc883_3ST_ch4_intel_init },
8129 { 6, alc883_3ST_ch6_intel_init },
8135 static const struct hda_verb alc889_ch2_intel_init[] = {
8136 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8137 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
8138 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
8139 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
8140 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8141 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8148 static const struct hda_verb alc889_ch6_intel_init[] = {
8149 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8150 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8151 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
8152 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8153 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8154 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8161 static const struct hda_verb alc889_ch8_intel_init[] = {
8162 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8163 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8164 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
8165 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
8166 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
8167 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8168 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8172 static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
8173 { 2, alc889_ch2_intel_init },
8174 { 6, alc889_ch6_intel_init },
8175 { 8, alc889_ch8_intel_init },
8181 static const struct hda_verb alc883_sixstack_ch6_init[] = {
8182 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8183 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8184 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8185 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8192 static const struct hda_verb alc883_sixstack_ch8_init[] = {
8193 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8194 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8195 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8196 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8200 static const struct hda_channel_mode alc883_sixstack_modes[2] = {
8201 { 6, alc883_sixstack_ch6_init },
8202 { 8, alc883_sixstack_ch8_init },
8206 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8207 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8209 static const struct snd_kcontrol_new alc882_base_mixer[] = {
8210 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8211 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8212 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8213 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8214 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8215 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8217 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8218 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8219 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8224 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8226 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8227 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8230 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8234 /* Macbook Air 2,1 same control for HP and internal Speaker */
8236 static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
8237 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8238 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8243 static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8244 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8245 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8247 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8250 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8252 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
8254 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
8258 static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
8259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8260 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8261 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8262 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8263 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8264 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8265 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8266 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8268 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
8270 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
8271 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
8276 static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8277 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8278 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8280 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8281 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
8282 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
8284 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
8286 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
8291 static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
8292 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8293 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8298 static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8299 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8300 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8301 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8302 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8304 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8311 static const struct snd_kcontrol_new alc882_targa_mixer[] = {
8312 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8313 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8315 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8316 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8317 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8318 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8322 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8323 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8324 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
8328 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8329 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8331 static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8332 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8333 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8335 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
8336 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8337 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8339 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
8341 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8344 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8348 static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8350 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8355 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8362 static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
8364 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8365 .name = "Channel Mode",
8366 .info = alc_ch_mode_info,
8367 .get = alc_ch_mode_get,
8368 .put = alc_ch_mode_put,
8373 static const struct hda_verb alc882_base_init_verbs[] = {
8374 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8375 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8378 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8379 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8381 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8382 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8384 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8387 /* Front Pin: output 0 (0x0c) */
8388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8389 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8390 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8391 /* Rear Pin: output 1 (0x0d) */
8392 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8393 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8395 /* CLFE Pin: output 2 (0x0e) */
8396 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8397 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8398 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8399 /* Side Pin: output 3 (0x0f) */
8400 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8401 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8402 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8403 /* Mic (rear) pin: input vref at 80% */
8404 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8405 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8406 /* Front Mic pin: input vref at 80% */
8407 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8408 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8409 /* Line In pin: input */
8410 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8411 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8412 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8413 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8414 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8415 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8416 /* CD pin widget for input */
8417 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8419 /* FIXME: use matrix-type input source selection */
8420 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8422 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8425 /* ADC2: mute amp left and right */
8426 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8427 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8428 /* ADC3: mute amp left and right */
8429 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8430 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8435 static const struct hda_verb alc882_adc1_init_verbs[] = {
8436 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8439 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8441 /* ADC1: mute amp left and right */
8442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8443 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8447 static const struct hda_verb alc882_eapd_verbs[] = {
8448 /* change to EAPD mode */
8449 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8450 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8454 static const struct hda_verb alc889_eapd_verbs[] = {
8455 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8456 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8460 static const struct hda_verb alc_hp15_unsol_verbs[] = {
8461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8466 static const struct hda_verb alc885_init_verbs[] = {
8467 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8478 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8480 /* Front HP Pin: output 0 (0x0c) */
8481 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8483 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8484 /* Front Pin: output 0 (0x0c) */
8485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8487 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8488 /* Rear Pin: output 1 (0x0d) */
8489 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8490 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8491 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8492 /* CLFE Pin: output 2 (0x0e) */
8493 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8494 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8495 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8496 /* Side Pin: output 3 (0x0f) */
8497 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8498 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8499 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8500 /* Mic (rear) pin: input vref at 80% */
8501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8502 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8503 /* Front Mic pin: input vref at 80% */
8504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8506 /* Line In pin: input */
8507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8510 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8512 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8516 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8517 /* ADC2: mute amp left and right */
8518 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8519 /* ADC3: mute amp left and right */
8520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8525 static const struct hda_verb alc885_init_input_verbs[] = {
8526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8533 /* Unmute Selector 24h and set the default input to front mic */
8534 static const struct hda_verb alc889_init_input_verbs[] = {
8535 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8536 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8541 #define alc883_init_verbs alc882_base_init_verbs
8544 static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
8545 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8546 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8547 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8550 /* FIXME: this looks suspicious...
8551 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8552 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8557 static const struct hda_verb alc882_macpro_init_verbs[] = {
8558 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8562 /* Front Pin: output 0 (0x0c) */
8563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8565 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8566 /* Front Mic pin: input vref at 80% */
8567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8569 /* Speaker: output */
8570 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8572 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8573 /* Headphone output (output 0 - 0x0c) */
8574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8576 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8578 /* FIXME: use matrix-type input source selection */
8579 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8580 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8582 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8583 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8586 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8595 /* ADC1: mute amp left and right */
8596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8597 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8598 /* ADC2: mute amp left and right */
8599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8601 /* ADC3: mute amp left and right */
8602 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8603 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8609 static const struct hda_verb alc885_mb5_init_verbs[] = {
8611 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8612 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8613 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8614 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8619 /* Surround mixer */
8620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8621 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8622 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8624 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8631 /* Front Pin (0x0c) */
8632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8634 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8635 /* LFE Pin (0x0e) */
8636 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8637 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8638 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8641 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8642 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8643 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8644 /* Front Mic pin: input vref at 80% */
8645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8649 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8651 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8652 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8653 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8658 static const struct hda_verb alc885_macmini3_init_verbs[] = {
8660 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8661 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8662 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8663 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8665 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8668 /* Surround mixer */
8669 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8670 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8675 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8678 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8679 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8680 /* Front Pin (0x0c) */
8681 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8683 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8684 /* LFE Pin (0x0e) */
8685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8687 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8691 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8692 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8705 static const struct hda_verb alc885_mba21_init_verbs[] = {
8706 /*Internal and HP Speaker Mixer*/
8707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8710 /*Internal Speaker Pin (0x0c)*/
8711 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8712 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8713 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8714 /* HP Pin: output 0 (0x0e) */
8715 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8716 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8717 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8718 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8719 /* Line in (is hp when jack connected)*/
8720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8727 /* Macbook Pro rev3 */
8728 static const struct hda_verb alc885_mbp3_init_verbs[] = {
8729 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8732 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8734 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8735 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8738 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8739 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8740 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8741 /* Front Pin: output 0 (0x0c) */
8742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8744 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8745 /* HP Pin: output 0 (0x0e) */
8746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8747 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8748 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8749 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8750 /* Mic (rear) pin: input vref at 80% */
8751 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8752 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8753 /* Front Mic pin: input vref at 80% */
8754 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8755 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8756 /* Line In pin: use output 1 when in LineOut mode */
8757 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8759 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8761 /* FIXME: use matrix-type input source selection */
8762 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8763 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8764 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8765 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8778 /* ADC1: mute amp left and right */
8779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8780 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8781 /* ADC2: mute amp left and right */
8782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8783 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8784 /* ADC3: mute amp left and right */
8785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8786 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8792 static const struct hda_verb alc885_imac91_init_verbs[] = {
8793 /* Internal Speaker Pin (0x0c) */
8794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8796 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8797 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8798 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8799 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8802 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8803 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8804 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8808 /* Front Mic pin: input vref at 80% */
8809 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8810 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8814 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8815 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8819 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8820 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8821 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8822 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8823 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8824 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8826 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8827 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8828 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8829 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8831 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8832 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8833 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8834 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8835 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8836 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8837 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8838 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8839 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8840 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8841 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8842 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8846 /* iMac 24 mixer. */
8847 static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
8848 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8849 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8853 /* iMac 24 init verbs. */
8854 static const struct hda_verb alc885_imac24_init_verbs[] = {
8855 /* Internal speakers: output 0 (0x0c) */
8856 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8857 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8858 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8859 /* Internal speakers: output 0 (0x0c) */
8860 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8861 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8862 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8863 /* Headphone: output 0 (0x0c) */
8864 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8865 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8866 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8867 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8868 /* Front Mic: input vref at 80% */
8869 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8870 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8874 /* Toggle speaker-output according to the hp-jack state */
8875 static void alc885_imac24_setup(struct hda_codec *codec)
8877 struct alc_spec *spec = codec->spec;
8879 spec->autocfg.hp_pins[0] = 0x14;
8880 spec->autocfg.speaker_pins[0] = 0x18;
8881 spec->autocfg.speaker_pins[1] = 0x1a;
8883 spec->automute_mode = ALC_AUTOMUTE_AMP;
8886 #define alc885_mb5_setup alc885_imac24_setup
8887 #define alc885_macmini3_setup alc885_imac24_setup
8889 /* Macbook Air 2,1 */
8890 static void alc885_mba21_setup(struct hda_codec *codec)
8892 struct alc_spec *spec = codec->spec;
8894 spec->autocfg.hp_pins[0] = 0x14;
8895 spec->autocfg.speaker_pins[0] = 0x18;
8897 spec->automute_mode = ALC_AUTOMUTE_AMP;
8902 static void alc885_mbp3_setup(struct hda_codec *codec)
8904 struct alc_spec *spec = codec->spec;
8906 spec->autocfg.hp_pins[0] = 0x15;
8907 spec->autocfg.speaker_pins[0] = 0x14;
8909 spec->automute_mode = ALC_AUTOMUTE_AMP;
8912 static void alc885_imac91_setup(struct hda_codec *codec)
8914 struct alc_spec *spec = codec->spec;
8916 spec->autocfg.hp_pins[0] = 0x14;
8917 spec->autocfg.speaker_pins[0] = 0x18;
8918 spec->autocfg.speaker_pins[1] = 0x1a;
8920 spec->automute_mode = ALC_AUTOMUTE_AMP;
8923 static const struct hda_verb alc882_targa_verbs[] = {
8924 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8927 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8928 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8930 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8931 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8932 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8934 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8938 /* toggle speaker-output according to the hp-jack state */
8939 static void alc882_targa_automute(struct hda_codec *codec)
8941 struct alc_spec *spec = codec->spec;
8942 alc_hp_automute(codec);
8943 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8944 spec->jack_present ? 1 : 3);
8947 static void alc882_targa_setup(struct hda_codec *codec)
8949 struct alc_spec *spec = codec->spec;
8951 spec->autocfg.hp_pins[0] = 0x14;
8952 spec->autocfg.speaker_pins[0] = 0x1b;
8954 spec->automute_mode = ALC_AUTOMUTE_AMP;
8957 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8959 if ((res >> 26) == ALC880_HP_EVENT)
8960 alc882_targa_automute(codec);
8963 static const struct hda_verb alc882_asus_a7j_verbs[] = {
8964 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8967 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8968 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8969 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8971 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8973 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8975 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8976 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8977 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8981 static const struct hda_verb alc882_asus_a7m_verbs[] = {
8982 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8983 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8985 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8987 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8989 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8990 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8991 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8993 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8994 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8995 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8999 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
9001 unsigned int gpiostate, gpiomask, gpiodir;
9003 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
9004 AC_VERB_GET_GPIO_DATA, 0);
9007 gpiostate |= (1 << pin);
9009 gpiostate &= ~(1 << pin);
9011 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
9012 AC_VERB_GET_GPIO_MASK, 0);
9013 gpiomask |= (1 << pin);
9015 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
9016 AC_VERB_GET_GPIO_DIRECTION, 0);
9017 gpiodir |= (1 << pin);
9020 snd_hda_codec_write(codec, codec->afg, 0,
9021 AC_VERB_SET_GPIO_MASK, gpiomask);
9022 snd_hda_codec_write(codec, codec->afg, 0,
9023 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
9027 snd_hda_codec_write(codec, codec->afg, 0,
9028 AC_VERB_SET_GPIO_DATA, gpiostate);
9031 /* set up GPIO at initialization */
9032 static void alc885_macpro_init_hook(struct hda_codec *codec)
9034 alc882_gpio_mute(codec, 0, 0);
9035 alc882_gpio_mute(codec, 1, 0);
9038 /* set up GPIO and update auto-muting at initialization */
9039 static void alc885_imac24_init_hook(struct hda_codec *codec)
9041 alc885_macpro_init_hook(codec);
9042 alc_hp_automute(codec);
9045 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
9046 static const struct hda_verb alc889A_mb31_ch2_init[] = {
9047 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
9050 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
9054 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
9055 static const struct hda_verb alc889A_mb31_ch4_init[] = {
9056 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9057 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9058 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
9059 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
9063 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
9064 static const struct hda_verb alc889A_mb31_ch5_init[] = {
9065 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
9066 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
9068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
9072 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
9073 static const struct hda_verb alc889A_mb31_ch6_init[] = {
9074 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
9075 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
9076 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
9077 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
9081 static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
9082 { 2, alc889A_mb31_ch2_init },
9083 { 4, alc889A_mb31_ch4_init },
9084 { 5, alc889A_mb31_ch5_init },
9085 { 6, alc889A_mb31_ch6_init },
9088 static const struct hda_verb alc883_medion_eapd_verbs[] = {
9089 /* eanable EAPD on medion laptop */
9090 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9091 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
9095 #define alc883_base_mixer alc882_base_mixer
9097 static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
9098 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9099 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9100 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9101 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9102 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9103 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9106 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9107 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9108 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9109 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9110 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9114 static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
9115 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9116 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9117 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9118 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9119 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9120 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9122 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9123 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9124 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9128 static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
9129 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9130 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9131 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9132 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9134 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9136 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9137 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9138 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9142 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
9143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9144 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9146 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9147 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9151 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9153 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9154 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9155 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9159 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
9160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9162 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9163 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9164 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9165 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9166 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9167 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9169 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9170 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9171 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9172 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9174 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9176 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9177 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9178 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9182 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
9183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9189 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9190 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9191 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9198 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9200 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9201 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9202 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9206 static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9209 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9210 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9211 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
9213 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9214 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9215 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9216 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9217 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
9218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9219 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9220 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
9222 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
9223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
9224 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9225 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
9226 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9230 static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9231 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9232 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9233 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9234 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9235 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9236 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9237 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9238 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9239 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9240 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9241 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9242 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9243 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9245 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9247 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9248 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9249 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9253 static const struct snd_kcontrol_new alc883_targa_mixer[] = {
9254 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9255 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9256 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9257 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9258 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9259 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
9260 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9261 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9262 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
9263 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
9264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9266 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9267 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9269 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9274 static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9275 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9276 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9277 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9278 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9279 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9280 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9282 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9284 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9285 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9286 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9290 static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9291 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9292 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9293 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9294 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9295 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9299 static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9300 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9301 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9302 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9303 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9304 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9306 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9311 static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9312 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9313 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9315 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9316 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9319 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9320 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9324 static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9325 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9326 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9327 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9329 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9330 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9334 static const struct hda_verb alc883_medion_wim2160_verbs[] = {
9335 /* Unmute front mixer */
9336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9339 /* Set speaker pin to front mixer */
9340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9342 /* Init headphone pin */
9343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9344 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9345 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9346 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9351 /* toggle speaker-output according to the hp-jack state */
9352 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9354 struct alc_spec *spec = codec->spec;
9356 spec->autocfg.hp_pins[0] = 0x1a;
9357 spec->autocfg.speaker_pins[0] = 0x15;
9359 spec->automute_mode = ALC_AUTOMUTE_AMP;
9362 static const struct snd_kcontrol_new alc883_acer_aspire_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("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9366 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9367 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9369 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9370 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9374 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9375 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9376 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9377 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9378 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9379 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9380 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9381 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9382 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9383 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9387 static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9388 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9389 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9390 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9391 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9392 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9393 0x0d, 1, 0x0, HDA_OUTPUT),
9394 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9395 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9396 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9397 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9398 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9400 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9401 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9402 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9403 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9404 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9406 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9407 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
9408 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9412 static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9415 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9416 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9417 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9418 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9420 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9421 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9422 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9423 /* Output switches */
9424 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9425 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9426 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9428 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
9429 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
9431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9438 static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9439 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9440 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9441 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9442 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9443 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
9444 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9448 static const struct hda_bind_ctls alc883_bind_cap_vol = {
9449 .ops = &snd_hda_bind_vol,
9451 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9452 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9457 static const struct hda_bind_ctls alc883_bind_cap_switch = {
9458 .ops = &snd_hda_bind_sw,
9460 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9461 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9466 static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9467 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9468 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9470 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9471 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9473 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9478 static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9479 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9480 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9482 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9483 /* .name = "Capture Source", */
9484 .name = "Input Source",
9486 .info = alc_mux_enum_info,
9487 .get = alc_mux_enum_get,
9488 .put = alc_mux_enum_put,
9493 static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
9495 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9496 .name = "Channel Mode",
9497 .info = alc_ch_mode_info,
9498 .get = alc_ch_mode_get,
9499 .put = alc_ch_mode_put,
9504 /* toggle speaker-output according to the hp-jack state */
9505 static void alc883_mitac_setup(struct hda_codec *codec)
9507 struct alc_spec *spec = codec->spec;
9509 spec->autocfg.hp_pins[0] = 0x15;
9510 spec->autocfg.speaker_pins[0] = 0x14;
9511 spec->autocfg.speaker_pins[1] = 0x17;
9513 spec->automute_mode = ALC_AUTOMUTE_AMP;
9516 static const struct hda_verb alc883_mitac_verbs[] = {
9518 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9521 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9522 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9524 /* enable unsolicited event */
9525 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9526 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9531 static const struct hda_verb alc883_clevo_m540r_verbs[] = {
9533 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9536 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9538 /* enable unsolicited event */
9540 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9541 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9547 static const struct hda_verb alc883_clevo_m720_verbs[] = {
9549 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9552 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9555 /* enable unsolicited event */
9556 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9557 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9562 static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9564 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9567 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9568 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9570 /* enable unsolicited event */
9571 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9576 static const struct hda_verb alc883_targa_verbs[] = {
9577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9581 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9583 /* Connect Line-Out side jack (SPDIF) to Side */
9584 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9585 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9586 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9587 /* Connect Mic jack to CLFE */
9588 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9590 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9591 /* Connect Line-in jack to Surround */
9592 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9593 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9594 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9595 /* Connect HP out jack to Front */
9596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9597 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9598 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9600 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9605 static const struct hda_verb alc883_lenovo_101e_verbs[] = {
9606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9607 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9608 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9612 static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9613 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9614 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9615 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9620 static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9624 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9625 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9629 static const struct hda_verb alc883_haier_w66_verbs[] = {
9630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9631 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9635 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9637 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9642 static const struct hda_verb alc888_lenovo_sky_verbs[] = {
9643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9649 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9650 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9654 static const struct hda_verb alc888_6st_dell_verbs[] = {
9655 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9659 static const struct hda_verb alc883_vaiott_verbs[] = {
9661 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9662 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9664 /* enable unsolicited event */
9665 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9670 static void alc888_3st_hp_setup(struct hda_codec *codec)
9672 struct alc_spec *spec = codec->spec;
9674 spec->autocfg.hp_pins[0] = 0x1b;
9675 spec->autocfg.speaker_pins[0] = 0x14;
9676 spec->autocfg.speaker_pins[1] = 0x16;
9677 spec->autocfg.speaker_pins[2] = 0x18;
9679 spec->automute_mode = ALC_AUTOMUTE_AMP;
9682 static const struct hda_verb alc888_3st_hp_verbs[] = {
9683 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9684 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9685 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9686 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9693 static const struct hda_verb alc888_3st_hp_2ch_init[] = {
9694 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9695 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9696 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9697 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9704 static const struct hda_verb alc888_3st_hp_4ch_init[] = {
9705 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9706 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9707 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9708 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9709 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9716 static const struct hda_verb alc888_3st_hp_6ch_init[] = {
9717 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9718 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9719 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9720 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9721 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9722 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9726 static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
9727 { 2, alc888_3st_hp_2ch_init },
9728 { 4, alc888_3st_hp_4ch_init },
9729 { 6, alc888_3st_hp_6ch_init },
9732 static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
9734 struct alc_spec *spec = codec->spec;
9736 spec->autocfg.hp_pins[0] = 0x1b;
9737 spec->autocfg.line_out_pins[0] = 0x14;
9738 spec->autocfg.speaker_pins[0] = 0x15;
9740 spec->automute_mode = ALC_AUTOMUTE_AMP;
9743 /* toggle speaker-output according to the hp-jack state */
9744 static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9746 struct alc_spec *spec = codec->spec;
9748 spec->autocfg.hp_pins[0] = 0x14;
9749 spec->autocfg.speaker_pins[0] = 0x15;
9751 spec->automute_mode = ALC_AUTOMUTE_AMP;
9754 /* toggle speaker-output according to the hp-jack state */
9755 #define alc883_targa_init_hook alc882_targa_init_hook
9756 #define alc883_targa_unsol_event alc882_targa_unsol_event
9758 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9760 struct alc_spec *spec = codec->spec;
9762 spec->autocfg.hp_pins[0] = 0x15;
9763 spec->autocfg.speaker_pins[0] = 0x14;
9765 spec->automute_mode = ALC_AUTOMUTE_AMP;
9768 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9770 alc_hp_automute(codec);
9771 alc88x_simple_mic_automute(codec);
9774 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9777 switch (res >> 26) {
9778 case ALC880_MIC_EVENT:
9779 alc88x_simple_mic_automute(codec);
9782 alc_sku_unsol_event(codec, res);
9787 /* toggle speaker-output according to the hp-jack state */
9788 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9790 struct alc_spec *spec = codec->spec;
9792 spec->autocfg.hp_pins[0] = 0x14;
9793 spec->autocfg.speaker_pins[0] = 0x15;
9795 spec->automute_mode = ALC_AUTOMUTE_AMP;
9798 static void alc883_haier_w66_setup(struct hda_codec *codec)
9800 struct alc_spec *spec = codec->spec;
9802 spec->autocfg.hp_pins[0] = 0x1b;
9803 spec->autocfg.speaker_pins[0] = 0x14;
9805 spec->automute_mode = ALC_AUTOMUTE_AMP;
9808 static void alc883_lenovo_101e_setup(struct hda_codec *codec)
9810 struct alc_spec *spec = codec->spec;
9812 spec->autocfg.hp_pins[0] = 0x1b;
9813 spec->autocfg.line_out_pins[0] = 0x14;
9814 spec->autocfg.speaker_pins[0] = 0x15;
9816 spec->detect_line = 1;
9817 spec->automute_lines = 1;
9818 spec->automute_mode = ALC_AUTOMUTE_AMP;
9821 /* toggle speaker-output according to the hp-jack state */
9822 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9824 struct alc_spec *spec = codec->spec;
9826 spec->autocfg.hp_pins[0] = 0x14;
9827 spec->autocfg.speaker_pins[0] = 0x15;
9828 spec->autocfg.speaker_pins[1] = 0x16;
9830 spec->automute_mode = ALC_AUTOMUTE_AMP;
9833 static const struct hda_verb alc883_acer_eapd_verbs[] = {
9834 /* HP Pin: output 0 (0x0c) */
9835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9837 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9838 /* Front Pin: output 0 (0x0c) */
9839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9841 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9842 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9843 /* eanable EAPD on medion laptop */
9844 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9845 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9846 /* enable unsolicited event */
9847 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9851 static void alc888_6st_dell_setup(struct hda_codec *codec)
9853 struct alc_spec *spec = codec->spec;
9855 spec->autocfg.hp_pins[0] = 0x1b;
9856 spec->autocfg.speaker_pins[0] = 0x14;
9857 spec->autocfg.speaker_pins[1] = 0x15;
9858 spec->autocfg.speaker_pins[2] = 0x16;
9859 spec->autocfg.speaker_pins[3] = 0x17;
9861 spec->automute_mode = ALC_AUTOMUTE_AMP;
9864 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9866 struct alc_spec *spec = codec->spec;
9868 spec->autocfg.hp_pins[0] = 0x1b;
9869 spec->autocfg.speaker_pins[0] = 0x14;
9870 spec->autocfg.speaker_pins[1] = 0x15;
9871 spec->autocfg.speaker_pins[2] = 0x16;
9872 spec->autocfg.speaker_pins[3] = 0x17;
9873 spec->autocfg.speaker_pins[4] = 0x1a;
9875 spec->automute_mode = ALC_AUTOMUTE_AMP;
9878 static void alc883_vaiott_setup(struct hda_codec *codec)
9880 struct alc_spec *spec = codec->spec;
9882 spec->autocfg.hp_pins[0] = 0x15;
9883 spec->autocfg.speaker_pins[0] = 0x14;
9884 spec->autocfg.speaker_pins[1] = 0x17;
9886 spec->automute_mode = ALC_AUTOMUTE_AMP;
9889 static const struct hda_verb alc888_asus_m90v_verbs[] = {
9890 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9892 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9893 /* enable unsolicited event */
9894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9895 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9899 static void alc883_mode2_setup(struct hda_codec *codec)
9901 struct alc_spec *spec = codec->spec;
9903 spec->autocfg.hp_pins[0] = 0x1b;
9904 spec->autocfg.speaker_pins[0] = 0x14;
9905 spec->autocfg.speaker_pins[1] = 0x15;
9906 spec->autocfg.speaker_pins[2] = 0x16;
9907 spec->ext_mic.pin = 0x18;
9908 spec->int_mic.pin = 0x19;
9909 spec->ext_mic.mux_idx = 0;
9910 spec->int_mic.mux_idx = 1;
9913 spec->automute_mode = ALC_AUTOMUTE_AMP;
9916 static const struct hda_verb alc888_asus_eee1601_verbs[] = {
9917 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9918 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9919 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9921 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9922 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9923 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9924 /* enable unsolicited event */
9925 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9929 static void alc883_eee1601_inithook(struct hda_codec *codec)
9931 struct alc_spec *spec = codec->spec;
9933 spec->autocfg.hp_pins[0] = 0x14;
9934 spec->autocfg.speaker_pins[0] = 0x1b;
9935 alc_hp_automute(codec);
9938 static const struct hda_verb alc889A_mb31_verbs[] = {
9939 /* Init rear pin (used as headphone output) */
9940 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9943 /* Init line pin (used as output in 4ch and 6ch mode) */
9944 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9945 /* Init line 2 pin (used as headphone out by default) */
9946 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9947 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9951 /* Mute speakers according to the headphone jack state */
9952 static void alc889A_mb31_automute(struct hda_codec *codec)
9954 unsigned int present;
9956 /* Mute only in 2ch or 4ch mode */
9957 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9959 present = snd_hda_jack_detect(codec, 0x15);
9960 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9961 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9962 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9963 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9967 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9969 if ((res >> 26) == ALC880_HP_EVENT)
9970 alc889A_mb31_automute(codec);
9974 #ifdef CONFIG_SND_HDA_POWER_SAVE
9975 #define alc882_loopbacks alc880_loopbacks
9978 /* pcm configuration: identical with ALC880 */
9979 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9980 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9981 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9982 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9984 static const hda_nid_t alc883_slave_dig_outs[] = {
9985 ALC1200_DIGOUT_NID, 0,
9988 static const hda_nid_t alc1200_slave_dig_outs[] = {
9989 ALC883_DIGOUT_NID, 0,
9993 * configuration and preset
9995 static const char * const alc882_models[ALC882_MODEL_LAST] = {
9996 [ALC882_3ST_DIG] = "3stack-dig",
9997 [ALC882_6ST_DIG] = "6stack-dig",
9998 [ALC882_ARIMA] = "arima",
9999 [ALC882_W2JC] = "w2jc",
10000 [ALC882_TARGA] = "targa",
10001 [ALC882_ASUS_A7J] = "asus-a7j",
10002 [ALC882_ASUS_A7M] = "asus-a7m",
10003 [ALC885_MACPRO] = "macpro",
10004 [ALC885_MB5] = "mb5",
10005 [ALC885_MACMINI3] = "macmini3",
10006 [ALC885_MBA21] = "mba21",
10007 [ALC885_MBP3] = "mbp3",
10008 [ALC885_IMAC24] = "imac24",
10009 [ALC885_IMAC91] = "imac91",
10010 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
10011 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
10012 [ALC883_3ST_6ch] = "3stack-6ch",
10013 [ALC883_6ST_DIG] = "alc883-6stack-dig",
10014 [ALC883_TARGA_DIG] = "targa-dig",
10015 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
10016 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
10017 [ALC883_ACER] = "acer",
10018 [ALC883_ACER_ASPIRE] = "acer-aspire",
10019 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
10020 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
10021 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
10022 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
10023 [ALC883_MEDION] = "medion",
10024 [ALC883_MEDION_WIM2160] = "medion-wim2160",
10025 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
10026 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
10027 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
10028 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
10029 [ALC888_LENOVO_SKY] = "lenovo-sky",
10030 [ALC883_HAIER_W66] = "haier-w66",
10031 [ALC888_3ST_HP] = "3stack-hp",
10032 [ALC888_6ST_DELL] = "6stack-dell",
10033 [ALC883_MITAC] = "mitac",
10034 [ALC883_CLEVO_M540R] = "clevo-m540r",
10035 [ALC883_CLEVO_M720] = "clevo-m720",
10036 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
10037 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
10038 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
10039 [ALC889A_INTEL] = "intel-alc889a",
10040 [ALC889_INTEL] = "intel-x58",
10041 [ALC1200_ASUS_P5Q] = "asus-p5q",
10042 [ALC889A_MB31] = "mb31",
10043 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
10044 [ALC882_AUTO] = "auto",
10047 static const struct snd_pci_quirk alc882_cfg_tbl[] = {
10048 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
10050 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
10051 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
10052 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
10053 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
10054 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
10055 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
10056 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
10057 ALC888_ACER_ASPIRE_4930G),
10058 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
10059 ALC888_ACER_ASPIRE_4930G),
10060 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
10061 ALC888_ACER_ASPIRE_8930G),
10062 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
10063 ALC888_ACER_ASPIRE_8930G),
10064 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
10065 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
10066 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
10067 ALC888_ACER_ASPIRE_6530G),
10068 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
10069 ALC888_ACER_ASPIRE_6530G),
10070 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
10071 ALC888_ACER_ASPIRE_7730G),
10072 /* default Acer -- disabled as it causes more problems.
10073 * model=auto should work fine now
10075 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
10077 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
10079 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
10080 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
10081 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
10082 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
10083 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
10084 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
10086 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
10087 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
10088 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
10089 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
10090 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
10091 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
10092 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
10093 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
10094 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
10095 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
10096 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
10098 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
10099 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
10100 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
10101 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
10102 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
10103 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
10104 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
10105 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
10106 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
10108 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
10109 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
10110 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
10111 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
10112 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
10113 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
10114 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
10115 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
10116 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
10117 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
10118 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
10119 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
10120 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
10121 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
10122 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
10123 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
10124 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
10125 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
10126 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
10127 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
10128 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
10129 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
10130 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
10131 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
10132 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
10133 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
10134 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
10135 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
10136 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
10137 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
10138 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
10140 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
10141 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
10142 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
10143 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
10144 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
10145 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
10146 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
10147 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
10148 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
10149 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
10150 ALC883_FUJITSU_PI2515),
10151 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
10152 ALC888_FUJITSU_XA3530),
10153 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
10154 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10155 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10156 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
10157 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
10158 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
10159 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
10160 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
10162 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
10163 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
10164 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
10165 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
10166 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
10167 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
10168 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
10173 /* codec SSID table for Intel Mac */
10174 static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
10175 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
10176 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
10177 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
10178 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
10179 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
10180 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
10181 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
10182 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
10183 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
10184 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
10185 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
10186 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
10187 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
10188 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
10189 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
10190 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
10191 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
10192 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
10193 * so apparently no perfect solution yet
10195 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
10196 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
10197 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
10198 {} /* terminator */
10201 static const struct alc_config_preset alc882_presets[] = {
10202 [ALC882_3ST_DIG] = {
10203 .mixers = { alc882_base_mixer },
10204 .init_verbs = { alc882_base_init_verbs,
10205 alc882_adc1_init_verbs },
10206 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10207 .dac_nids = alc882_dac_nids,
10208 .dig_out_nid = ALC882_DIGOUT_NID,
10209 .dig_in_nid = ALC882_DIGIN_NID,
10210 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10211 .channel_mode = alc882_ch_modes,
10213 .input_mux = &alc882_capture_source,
10215 [ALC882_6ST_DIG] = {
10216 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10217 .init_verbs = { alc882_base_init_verbs,
10218 alc882_adc1_init_verbs },
10219 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10220 .dac_nids = alc882_dac_nids,
10221 .dig_out_nid = ALC882_DIGOUT_NID,
10222 .dig_in_nid = ALC882_DIGIN_NID,
10223 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10224 .channel_mode = alc882_sixstack_modes,
10225 .input_mux = &alc882_capture_source,
10228 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
10229 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10230 alc882_eapd_verbs },
10231 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10232 .dac_nids = alc882_dac_nids,
10233 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
10234 .channel_mode = alc882_sixstack_modes,
10235 .input_mux = &alc882_capture_source,
10238 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
10239 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10240 alc882_eapd_verbs, alc880_gpio1_init_verbs },
10241 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10242 .dac_nids = alc882_dac_nids,
10243 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10244 .channel_mode = alc880_threestack_modes,
10246 .input_mux = &alc882_capture_source,
10247 .dig_out_nid = ALC882_DIGOUT_NID,
10250 .mixers = { alc885_mba21_mixer },
10251 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
10253 .dac_nids = alc882_dac_nids,
10254 .channel_mode = alc885_mba21_ch_modes,
10255 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10256 .input_mux = &alc882_capture_source,
10257 .unsol_event = alc_sku_unsol_event,
10258 .setup = alc885_mba21_setup,
10259 .init_hook = alc_hp_automute,
10262 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
10263 .init_verbs = { alc885_mbp3_init_verbs,
10264 alc880_gpio1_init_verbs },
10266 .dac_nids = alc882_dac_nids,
10268 .channel_mode = alc885_mbp_4ch_modes,
10269 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
10270 .input_mux = &alc882_capture_source,
10271 .dig_out_nid = ALC882_DIGOUT_NID,
10272 .dig_in_nid = ALC882_DIGIN_NID,
10273 .unsol_event = alc_sku_unsol_event,
10274 .setup = alc885_mbp3_setup,
10275 .init_hook = alc_hp_automute,
10278 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
10279 .init_verbs = { alc885_mb5_init_verbs,
10280 alc880_gpio1_init_verbs },
10281 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10282 .dac_nids = alc882_dac_nids,
10283 .channel_mode = alc885_mb5_6ch_modes,
10284 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10285 .input_mux = &mb5_capture_source,
10286 .dig_out_nid = ALC882_DIGOUT_NID,
10287 .dig_in_nid = ALC882_DIGIN_NID,
10288 .unsol_event = alc_sku_unsol_event,
10289 .setup = alc885_mb5_setup,
10290 .init_hook = alc_hp_automute,
10292 [ALC885_MACMINI3] = {
10293 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10294 .init_verbs = { alc885_macmini3_init_verbs,
10295 alc880_gpio1_init_verbs },
10296 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10297 .dac_nids = alc882_dac_nids,
10298 .channel_mode = alc885_macmini3_6ch_modes,
10299 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10300 .input_mux = &macmini3_capture_source,
10301 .dig_out_nid = ALC882_DIGOUT_NID,
10302 .dig_in_nid = ALC882_DIGIN_NID,
10303 .unsol_event = alc_sku_unsol_event,
10304 .setup = alc885_macmini3_setup,
10305 .init_hook = alc_hp_automute,
10307 [ALC885_MACPRO] = {
10308 .mixers = { alc882_macpro_mixer },
10309 .init_verbs = { alc882_macpro_init_verbs },
10310 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10311 .dac_nids = alc882_dac_nids,
10312 .dig_out_nid = ALC882_DIGOUT_NID,
10313 .dig_in_nid = ALC882_DIGIN_NID,
10314 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10315 .channel_mode = alc882_ch_modes,
10316 .input_mux = &alc882_capture_source,
10317 .init_hook = alc885_macpro_init_hook,
10319 [ALC885_IMAC24] = {
10320 .mixers = { alc885_imac24_mixer },
10321 .init_verbs = { alc885_imac24_init_verbs },
10322 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10323 .dac_nids = alc882_dac_nids,
10324 .dig_out_nid = ALC882_DIGOUT_NID,
10325 .dig_in_nid = ALC882_DIGIN_NID,
10326 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10327 .channel_mode = alc882_ch_modes,
10328 .input_mux = &alc882_capture_source,
10329 .unsol_event = alc_sku_unsol_event,
10330 .setup = alc885_imac24_setup,
10331 .init_hook = alc885_imac24_init_hook,
10333 [ALC885_IMAC91] = {
10334 .mixers = {alc885_imac91_mixer},
10335 .init_verbs = { alc885_imac91_init_verbs,
10336 alc880_gpio1_init_verbs },
10337 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10338 .dac_nids = alc882_dac_nids,
10339 .channel_mode = alc885_mba21_ch_modes,
10340 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10341 .input_mux = &alc889A_imac91_capture_source,
10342 .dig_out_nid = ALC882_DIGOUT_NID,
10343 .dig_in_nid = ALC882_DIGIN_NID,
10344 .unsol_event = alc_sku_unsol_event,
10345 .setup = alc885_imac91_setup,
10346 .init_hook = alc_hp_automute,
10349 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10350 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10351 alc880_gpio3_init_verbs, alc882_targa_verbs},
10352 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10353 .dac_nids = alc882_dac_nids,
10354 .dig_out_nid = ALC882_DIGOUT_NID,
10355 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10356 .adc_nids = alc882_adc_nids,
10357 .capsrc_nids = alc882_capsrc_nids,
10358 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10359 .channel_mode = alc882_3ST_6ch_modes,
10361 .input_mux = &alc882_capture_source,
10362 .unsol_event = alc_sku_unsol_event,
10363 .setup = alc882_targa_setup,
10364 .init_hook = alc882_targa_automute,
10366 [ALC882_ASUS_A7J] = {
10367 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10368 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10369 alc882_asus_a7j_verbs},
10370 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10371 .dac_nids = alc882_dac_nids,
10372 .dig_out_nid = ALC882_DIGOUT_NID,
10373 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10374 .adc_nids = alc882_adc_nids,
10375 .capsrc_nids = alc882_capsrc_nids,
10376 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10377 .channel_mode = alc882_3ST_6ch_modes,
10379 .input_mux = &alc882_capture_source,
10381 [ALC882_ASUS_A7M] = {
10382 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10383 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10384 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10385 alc882_asus_a7m_verbs },
10386 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10387 .dac_nids = alc882_dac_nids,
10388 .dig_out_nid = ALC882_DIGOUT_NID,
10389 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10390 .channel_mode = alc880_threestack_modes,
10392 .input_mux = &alc882_capture_source,
10394 [ALC883_3ST_2ch_DIG] = {
10395 .mixers = { alc883_3ST_2ch_mixer },
10396 .init_verbs = { alc883_init_verbs },
10397 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10398 .dac_nids = alc883_dac_nids,
10399 .dig_out_nid = ALC883_DIGOUT_NID,
10400 .dig_in_nid = ALC883_DIGIN_NID,
10401 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10402 .channel_mode = alc883_3ST_2ch_modes,
10403 .input_mux = &alc883_capture_source,
10405 [ALC883_3ST_6ch_DIG] = {
10406 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10407 .init_verbs = { alc883_init_verbs },
10408 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10409 .dac_nids = alc883_dac_nids,
10410 .dig_out_nid = ALC883_DIGOUT_NID,
10411 .dig_in_nid = ALC883_DIGIN_NID,
10412 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10413 .channel_mode = alc883_3ST_6ch_modes,
10415 .input_mux = &alc883_capture_source,
10417 [ALC883_3ST_6ch] = {
10418 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10419 .init_verbs = { alc883_init_verbs },
10420 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10421 .dac_nids = alc883_dac_nids,
10422 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10423 .channel_mode = alc883_3ST_6ch_modes,
10425 .input_mux = &alc883_capture_source,
10427 [ALC883_3ST_6ch_INTEL] = {
10428 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10429 .init_verbs = { alc883_init_verbs },
10430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10431 .dac_nids = alc883_dac_nids,
10432 .dig_out_nid = ALC883_DIGOUT_NID,
10433 .dig_in_nid = ALC883_DIGIN_NID,
10434 .slave_dig_outs = alc883_slave_dig_outs,
10435 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10436 .channel_mode = alc883_3ST_6ch_intel_modes,
10438 .input_mux = &alc883_3stack_6ch_intel,
10440 [ALC889A_INTEL] = {
10441 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10442 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10443 alc_hp15_unsol_verbs },
10444 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10445 .dac_nids = alc883_dac_nids,
10446 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10447 .adc_nids = alc889_adc_nids,
10448 .dig_out_nid = ALC883_DIGOUT_NID,
10449 .dig_in_nid = ALC883_DIGIN_NID,
10450 .slave_dig_outs = alc883_slave_dig_outs,
10451 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10452 .channel_mode = alc889_8ch_intel_modes,
10453 .capsrc_nids = alc889_capsrc_nids,
10454 .input_mux = &alc889_capture_source,
10455 .setup = alc889_automute_setup,
10456 .init_hook = alc_hp_automute,
10457 .unsol_event = alc_sku_unsol_event,
10461 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10462 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10463 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10464 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10465 .dac_nids = alc883_dac_nids,
10466 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10467 .adc_nids = alc889_adc_nids,
10468 .dig_out_nid = ALC883_DIGOUT_NID,
10469 .dig_in_nid = ALC883_DIGIN_NID,
10470 .slave_dig_outs = alc883_slave_dig_outs,
10471 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10472 .channel_mode = alc889_8ch_intel_modes,
10473 .capsrc_nids = alc889_capsrc_nids,
10474 .input_mux = &alc889_capture_source,
10475 .setup = alc889_automute_setup,
10476 .init_hook = alc889_intel_init_hook,
10477 .unsol_event = alc_sku_unsol_event,
10480 [ALC883_6ST_DIG] = {
10481 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10482 .init_verbs = { alc883_init_verbs },
10483 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10484 .dac_nids = alc883_dac_nids,
10485 .dig_out_nid = ALC883_DIGOUT_NID,
10486 .dig_in_nid = ALC883_DIGIN_NID,
10487 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10488 .channel_mode = alc883_sixstack_modes,
10489 .input_mux = &alc883_capture_source,
10491 [ALC883_TARGA_DIG] = {
10492 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10493 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10494 alc883_targa_verbs},
10495 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10496 .dac_nids = alc883_dac_nids,
10497 .dig_out_nid = ALC883_DIGOUT_NID,
10498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10499 .channel_mode = alc883_3ST_6ch_modes,
10501 .input_mux = &alc883_capture_source,
10502 .unsol_event = alc883_targa_unsol_event,
10503 .setup = alc882_targa_setup,
10504 .init_hook = alc882_targa_automute,
10506 [ALC883_TARGA_2ch_DIG] = {
10507 .mixers = { alc883_targa_2ch_mixer},
10508 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10509 alc883_targa_verbs},
10510 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10511 .dac_nids = alc883_dac_nids,
10512 .adc_nids = alc883_adc_nids_alt,
10513 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10514 .capsrc_nids = alc883_capsrc_nids,
10515 .dig_out_nid = ALC883_DIGOUT_NID,
10516 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10517 .channel_mode = alc883_3ST_2ch_modes,
10518 .input_mux = &alc883_capture_source,
10519 .unsol_event = alc883_targa_unsol_event,
10520 .setup = alc882_targa_setup,
10521 .init_hook = alc882_targa_automute,
10523 [ALC883_TARGA_8ch_DIG] = {
10524 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10525 alc883_chmode_mixer },
10526 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10527 alc883_targa_verbs },
10528 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10529 .dac_nids = alc883_dac_nids,
10530 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10531 .adc_nids = alc883_adc_nids_rev,
10532 .capsrc_nids = alc883_capsrc_nids_rev,
10533 .dig_out_nid = ALC883_DIGOUT_NID,
10534 .dig_in_nid = ALC883_DIGIN_NID,
10535 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10536 .channel_mode = alc883_4ST_8ch_modes,
10538 .input_mux = &alc883_capture_source,
10539 .unsol_event = alc883_targa_unsol_event,
10540 .setup = alc882_targa_setup,
10541 .init_hook = alc882_targa_automute,
10544 .mixers = { alc883_base_mixer },
10545 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10546 * and the headphone jack. Turn this on and rely on the
10547 * standard mute methods whenever the user wants to turn
10548 * these outputs off.
10550 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10552 .dac_nids = alc883_dac_nids,
10553 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10554 .channel_mode = alc883_3ST_2ch_modes,
10555 .input_mux = &alc883_capture_source,
10557 [ALC883_ACER_ASPIRE] = {
10558 .mixers = { alc883_acer_aspire_mixer },
10559 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10560 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10561 .dac_nids = alc883_dac_nids,
10562 .dig_out_nid = ALC883_DIGOUT_NID,
10563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10564 .channel_mode = alc883_3ST_2ch_modes,
10565 .input_mux = &alc883_capture_source,
10566 .unsol_event = alc_sku_unsol_event,
10567 .setup = alc883_acer_aspire_setup,
10568 .init_hook = alc_hp_automute,
10570 [ALC888_ACER_ASPIRE_4930G] = {
10571 .mixers = { alc888_acer_aspire_4930g_mixer,
10572 alc883_chmode_mixer },
10573 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10574 alc888_acer_aspire_4930g_verbs },
10575 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10576 .dac_nids = alc883_dac_nids,
10577 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10578 .adc_nids = alc883_adc_nids_rev,
10579 .capsrc_nids = alc883_capsrc_nids_rev,
10580 .dig_out_nid = ALC883_DIGOUT_NID,
10581 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10582 .channel_mode = alc883_3ST_6ch_modes,
10584 .const_channel_count = 6,
10586 ARRAY_SIZE(alc888_2_capture_sources),
10587 .input_mux = alc888_2_capture_sources,
10588 .unsol_event = alc_sku_unsol_event,
10589 .setup = alc888_acer_aspire_4930g_setup,
10590 .init_hook = alc_hp_automute,
10592 [ALC888_ACER_ASPIRE_6530G] = {
10593 .mixers = { alc888_acer_aspire_6530_mixer },
10594 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10595 alc888_acer_aspire_6530g_verbs },
10596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10597 .dac_nids = alc883_dac_nids,
10598 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10599 .adc_nids = alc883_adc_nids_rev,
10600 .capsrc_nids = alc883_capsrc_nids_rev,
10601 .dig_out_nid = ALC883_DIGOUT_NID,
10602 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10603 .channel_mode = alc883_3ST_2ch_modes,
10605 ARRAY_SIZE(alc888_2_capture_sources),
10606 .input_mux = alc888_acer_aspire_6530_sources,
10607 .unsol_event = alc_sku_unsol_event,
10608 .setup = alc888_acer_aspire_6530g_setup,
10609 .init_hook = alc_hp_automute,
10611 [ALC888_ACER_ASPIRE_8930G] = {
10612 .mixers = { alc889_acer_aspire_8930g_mixer,
10613 alc883_chmode_mixer },
10614 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10615 alc889_acer_aspire_8930g_verbs,
10616 alc889_eapd_verbs},
10617 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10618 .dac_nids = alc883_dac_nids,
10619 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10620 .adc_nids = alc889_adc_nids,
10621 .capsrc_nids = alc889_capsrc_nids,
10622 .dig_out_nid = ALC883_DIGOUT_NID,
10623 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10624 .channel_mode = alc883_3ST_6ch_modes,
10626 .const_channel_count = 6,
10628 ARRAY_SIZE(alc889_capture_sources),
10629 .input_mux = alc889_capture_sources,
10630 .unsol_event = alc_sku_unsol_event,
10631 .setup = alc889_acer_aspire_8930g_setup,
10632 .init_hook = alc_hp_automute,
10633 #ifdef CONFIG_SND_HDA_POWER_SAVE
10634 .power_hook = alc_power_eapd,
10637 [ALC888_ACER_ASPIRE_7730G] = {
10638 .mixers = { alc883_3ST_6ch_mixer,
10639 alc883_chmode_mixer },
10640 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10641 alc888_acer_aspire_7730G_verbs },
10642 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10643 .dac_nids = alc883_dac_nids,
10644 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10645 .adc_nids = alc883_adc_nids_rev,
10646 .capsrc_nids = alc883_capsrc_nids_rev,
10647 .dig_out_nid = ALC883_DIGOUT_NID,
10648 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10649 .channel_mode = alc883_3ST_6ch_modes,
10651 .const_channel_count = 6,
10652 .input_mux = &alc883_capture_source,
10653 .unsol_event = alc_sku_unsol_event,
10654 .setup = alc888_acer_aspire_7730g_setup,
10655 .init_hook = alc_hp_automute,
10657 [ALC883_MEDION] = {
10658 .mixers = { alc883_fivestack_mixer,
10659 alc883_chmode_mixer },
10660 .init_verbs = { alc883_init_verbs,
10661 alc883_medion_eapd_verbs },
10662 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10663 .dac_nids = alc883_dac_nids,
10664 .adc_nids = alc883_adc_nids_alt,
10665 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10666 .capsrc_nids = alc883_capsrc_nids,
10667 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10668 .channel_mode = alc883_sixstack_modes,
10669 .input_mux = &alc883_capture_source,
10671 [ALC883_MEDION_WIM2160] = {
10672 .mixers = { alc883_medion_wim2160_mixer },
10673 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10674 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10675 .dac_nids = alc883_dac_nids,
10676 .dig_out_nid = ALC883_DIGOUT_NID,
10677 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10678 .adc_nids = alc883_adc_nids,
10679 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10680 .channel_mode = alc883_3ST_2ch_modes,
10681 .input_mux = &alc883_capture_source,
10682 .unsol_event = alc_sku_unsol_event,
10683 .setup = alc883_medion_wim2160_setup,
10684 .init_hook = alc_hp_automute,
10686 [ALC883_LAPTOP_EAPD] = {
10687 .mixers = { alc883_base_mixer },
10688 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10690 .dac_nids = alc883_dac_nids,
10691 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10692 .channel_mode = alc883_3ST_2ch_modes,
10693 .input_mux = &alc883_capture_source,
10695 [ALC883_CLEVO_M540R] = {
10696 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10697 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10698 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10699 .dac_nids = alc883_dac_nids,
10700 .dig_out_nid = ALC883_DIGOUT_NID,
10701 .dig_in_nid = ALC883_DIGIN_NID,
10702 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10703 .channel_mode = alc883_3ST_6ch_clevo_modes,
10705 .input_mux = &alc883_capture_source,
10706 /* This machine has the hardware HP auto-muting, thus
10707 * we need no software mute via unsol event
10710 [ALC883_CLEVO_M720] = {
10711 .mixers = { alc883_clevo_m720_mixer },
10712 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10714 .dac_nids = alc883_dac_nids,
10715 .dig_out_nid = ALC883_DIGOUT_NID,
10716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10717 .channel_mode = alc883_3ST_2ch_modes,
10718 .input_mux = &alc883_capture_source,
10719 .unsol_event = alc883_clevo_m720_unsol_event,
10720 .setup = alc883_clevo_m720_setup,
10721 .init_hook = alc883_clevo_m720_init_hook,
10723 [ALC883_LENOVO_101E_2ch] = {
10724 .mixers = { alc883_lenovo_101e_2ch_mixer},
10725 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10726 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10727 .dac_nids = alc883_dac_nids,
10728 .adc_nids = alc883_adc_nids_alt,
10729 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10730 .capsrc_nids = alc883_capsrc_nids,
10731 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10732 .channel_mode = alc883_3ST_2ch_modes,
10733 .input_mux = &alc883_lenovo_101e_capture_source,
10734 .setup = alc883_lenovo_101e_setup,
10735 .unsol_event = alc_sku_unsol_event,
10736 .init_hook = alc_inithook,
10738 [ALC883_LENOVO_NB0763] = {
10739 .mixers = { alc883_lenovo_nb0763_mixer },
10740 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10741 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10742 .dac_nids = alc883_dac_nids,
10743 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10744 .channel_mode = alc883_3ST_2ch_modes,
10746 .input_mux = &alc883_lenovo_nb0763_capture_source,
10747 .unsol_event = alc_sku_unsol_event,
10748 .setup = alc883_lenovo_nb0763_setup,
10749 .init_hook = alc_hp_automute,
10751 [ALC888_LENOVO_MS7195_DIG] = {
10752 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10753 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10754 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10755 .dac_nids = alc883_dac_nids,
10756 .dig_out_nid = ALC883_DIGOUT_NID,
10757 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10758 .channel_mode = alc883_3ST_6ch_modes,
10760 .input_mux = &alc883_capture_source,
10761 .unsol_event = alc_sku_unsol_event,
10762 .setup = alc888_lenovo_ms7195_setup,
10763 .init_hook = alc_inithook,
10765 [ALC883_HAIER_W66] = {
10766 .mixers = { alc883_targa_2ch_mixer},
10767 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10768 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10769 .dac_nids = alc883_dac_nids,
10770 .dig_out_nid = ALC883_DIGOUT_NID,
10771 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10772 .channel_mode = alc883_3ST_2ch_modes,
10773 .input_mux = &alc883_capture_source,
10774 .unsol_event = alc_sku_unsol_event,
10775 .setup = alc883_haier_w66_setup,
10776 .init_hook = alc_hp_automute,
10778 [ALC888_3ST_HP] = {
10779 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10780 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10781 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10782 .dac_nids = alc883_dac_nids,
10783 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10784 .channel_mode = alc888_3st_hp_modes,
10786 .input_mux = &alc883_capture_source,
10787 .unsol_event = alc_sku_unsol_event,
10788 .setup = alc888_3st_hp_setup,
10789 .init_hook = alc_hp_automute,
10791 [ALC888_6ST_DELL] = {
10792 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10793 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10794 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10795 .dac_nids = alc883_dac_nids,
10796 .dig_out_nid = ALC883_DIGOUT_NID,
10797 .dig_in_nid = ALC883_DIGIN_NID,
10798 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10799 .channel_mode = alc883_sixstack_modes,
10800 .input_mux = &alc883_capture_source,
10801 .unsol_event = alc_sku_unsol_event,
10802 .setup = alc888_6st_dell_setup,
10803 .init_hook = alc_hp_automute,
10806 .mixers = { alc883_mitac_mixer },
10807 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10808 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10809 .dac_nids = alc883_dac_nids,
10810 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10811 .channel_mode = alc883_3ST_2ch_modes,
10812 .input_mux = &alc883_capture_source,
10813 .unsol_event = alc_sku_unsol_event,
10814 .setup = alc883_mitac_setup,
10815 .init_hook = alc_hp_automute,
10817 [ALC883_FUJITSU_PI2515] = {
10818 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10819 .init_verbs = { alc883_init_verbs,
10820 alc883_2ch_fujitsu_pi2515_verbs},
10821 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10822 .dac_nids = alc883_dac_nids,
10823 .dig_out_nid = ALC883_DIGOUT_NID,
10824 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10825 .channel_mode = alc883_3ST_2ch_modes,
10826 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10827 .unsol_event = alc_sku_unsol_event,
10828 .setup = alc883_2ch_fujitsu_pi2515_setup,
10829 .init_hook = alc_hp_automute,
10831 [ALC888_FUJITSU_XA3530] = {
10832 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10833 .init_verbs = { alc883_init_verbs,
10834 alc888_fujitsu_xa3530_verbs },
10835 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10836 .dac_nids = alc883_dac_nids,
10837 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10838 .adc_nids = alc883_adc_nids_rev,
10839 .capsrc_nids = alc883_capsrc_nids_rev,
10840 .dig_out_nid = ALC883_DIGOUT_NID,
10841 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10842 .channel_mode = alc888_4ST_8ch_intel_modes,
10844 ARRAY_SIZE(alc888_2_capture_sources),
10845 .input_mux = alc888_2_capture_sources,
10846 .unsol_event = alc_sku_unsol_event,
10847 .setup = alc888_fujitsu_xa3530_setup,
10848 .init_hook = alc_hp_automute,
10850 [ALC888_LENOVO_SKY] = {
10851 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10852 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10853 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10854 .dac_nids = alc883_dac_nids,
10855 .dig_out_nid = ALC883_DIGOUT_NID,
10856 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10857 .channel_mode = alc883_sixstack_modes,
10859 .input_mux = &alc883_lenovo_sky_capture_source,
10860 .unsol_event = alc_sku_unsol_event,
10861 .setup = alc888_lenovo_sky_setup,
10862 .init_hook = alc_hp_automute,
10864 [ALC888_ASUS_M90V] = {
10865 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10866 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10867 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10868 .dac_nids = alc883_dac_nids,
10869 .dig_out_nid = ALC883_DIGOUT_NID,
10870 .dig_in_nid = ALC883_DIGIN_NID,
10871 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10872 .channel_mode = alc883_3ST_6ch_modes,
10874 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10875 .unsol_event = alc_sku_unsol_event,
10876 .setup = alc883_mode2_setup,
10877 .init_hook = alc_inithook,
10879 [ALC888_ASUS_EEE1601] = {
10880 .mixers = { alc883_asus_eee1601_mixer },
10881 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10882 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10883 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10884 .dac_nids = alc883_dac_nids,
10885 .dig_out_nid = ALC883_DIGOUT_NID,
10886 .dig_in_nid = ALC883_DIGIN_NID,
10887 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10888 .channel_mode = alc883_3ST_2ch_modes,
10890 .input_mux = &alc883_asus_eee1601_capture_source,
10891 .unsol_event = alc_sku_unsol_event,
10892 .init_hook = alc883_eee1601_inithook,
10894 [ALC1200_ASUS_P5Q] = {
10895 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10896 .init_verbs = { alc883_init_verbs },
10897 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10898 .dac_nids = alc883_dac_nids,
10899 .dig_out_nid = ALC1200_DIGOUT_NID,
10900 .dig_in_nid = ALC883_DIGIN_NID,
10901 .slave_dig_outs = alc1200_slave_dig_outs,
10902 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10903 .channel_mode = alc883_sixstack_modes,
10904 .input_mux = &alc883_capture_source,
10907 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10908 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10909 alc880_gpio1_init_verbs },
10910 .adc_nids = alc883_adc_nids,
10911 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10912 .capsrc_nids = alc883_capsrc_nids,
10913 .dac_nids = alc883_dac_nids,
10914 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10915 .channel_mode = alc889A_mb31_6ch_modes,
10916 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10917 .input_mux = &alc889A_mb31_capture_source,
10918 .dig_out_nid = ALC883_DIGOUT_NID,
10919 .unsol_event = alc889A_mb31_unsol_event,
10920 .init_hook = alc889A_mb31_automute,
10922 [ALC883_SONY_VAIO_TT] = {
10923 .mixers = { alc883_vaiott_mixer },
10924 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10925 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10926 .dac_nids = alc883_dac_nids,
10927 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10928 .channel_mode = alc883_3ST_2ch_modes,
10929 .input_mux = &alc883_capture_source,
10930 .unsol_event = alc_sku_unsol_event,
10931 .setup = alc883_vaiott_setup,
10932 .init_hook = alc_hp_automute,
10941 PINFIX_ABIT_AW9D_MAX,
10942 PINFIX_LENOVO_Y530,
10944 PINFIX_ACER_ASPIRE_7736,
10947 static const struct alc_fixup alc882_fixups[] = {
10948 [PINFIX_ABIT_AW9D_MAX] = {
10949 .type = ALC_FIXUP_PINS,
10950 .v.pins = (const struct alc_pincfg[]) {
10951 { 0x15, 0x01080104 }, /* side */
10952 { 0x16, 0x01011012 }, /* rear */
10953 { 0x17, 0x01016011 }, /* clfe */
10957 [PINFIX_LENOVO_Y530] = {
10958 .type = ALC_FIXUP_PINS,
10959 .v.pins = (const struct alc_pincfg[]) {
10960 { 0x15, 0x99130112 }, /* rear int speakers */
10961 { 0x16, 0x99130111 }, /* subwoofer */
10965 [PINFIX_PB_M5210] = {
10966 .type = ALC_FIXUP_VERBS,
10967 .v.verbs = (const struct hda_verb[]) {
10968 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10972 [PINFIX_ACER_ASPIRE_7736] = {
10973 .type = ALC_FIXUP_SKU,
10974 .v.sku = ALC_FIXUP_SKU_IGNORE,
10978 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
10979 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10980 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10981 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10982 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10987 * BIOS auto configuration
10989 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10990 const struct auto_pin_cfg *cfg)
10992 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10995 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10996 hda_nid_t nid, int pin_type,
11001 /* set as output */
11002 alc_set_pin_output(codec, nid, pin_type);
11004 if (snd_hda_get_conn_list(codec, nid, NULL) < 2)
11009 else if (dac >= 0x02 && dac <= 0x05)
11013 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
11016 #define alc882_auto_init_dac alc880_auto_init_dac
11018 static void alc882_auto_init_multi_out(struct hda_codec *codec)
11020 struct alc_spec *spec = codec->spec;
11023 for (i = 0; i <= HDA_SIDE; i++) {
11024 hda_nid_t nid = spec->autocfg.line_out_pins[i];
11025 int pin_type = get_pin_type(spec->autocfg.line_out_type);
11027 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
11028 spec->multiout.dac_nids[i]);
11031 for (i = 0; i < spec->multiout.num_dacs; i++)
11032 alc882_auto_init_dac(codec, spec->multiout.dac_nids[i]);
11035 static void alc882_auto_init_hp_out(struct hda_codec *codec)
11037 struct alc_spec *spec = codec->spec;
11038 hda_nid_t pin, dac;
11041 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) {
11042 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
11043 pin = spec->autocfg.hp_pins[i];
11046 dac = spec->multiout.hp_nid;
11048 dac = spec->multiout.dac_nids[0]; /* to front */
11049 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
11053 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) {
11054 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
11055 pin = spec->autocfg.speaker_pins[i];
11058 dac = spec->multiout.extra_out_nid[0];
11060 dac = spec->multiout.dac_nids[0]; /* to front */
11061 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
11066 alc882_auto_init_dac(codec, spec->multiout.hp_nid);
11067 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
11068 alc882_auto_init_dac(codec, spec->multiout.extra_out_nid[i]);
11071 #define alc882_auto_init_analog_input alc880_auto_init_analog_input
11073 static void alc882_auto_init_input_src(struct hda_codec *codec)
11075 struct alc_spec *spec = codec->spec;
11078 for (c = 0; c < spec->num_adc_nids; c++) {
11079 hda_nid_t nid = spec->capsrc_nids[c];
11080 unsigned int mux_idx;
11081 const struct hda_input_mux *imux;
11082 int conns, mute, idx, item;
11085 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
11086 AC_VERB_SET_AMP_GAIN_MUTE,
11089 conns = snd_hda_get_conn_list(codec, nid, NULL);
11092 mux_idx = c >= spec->num_mux_defs ? 0 : c;
11093 imux = &spec->input_mux[mux_idx];
11094 if (!imux->num_items && mux_idx > 0)
11095 imux = &spec->input_mux[0];
11096 for (idx = 0; idx < conns; idx++) {
11097 /* if the current connection is the selected one,
11098 * unmute it as default - otherwise mute it
11100 mute = AMP_IN_MUTE(idx);
11101 for (item = 0; item < imux->num_items; item++) {
11102 if (imux->items[item].index == idx) {
11103 if (spec->cur_mux[c] == item)
11104 mute = AMP_IN_UNMUTE(idx);
11108 /* check if we have a selector or mixer
11109 * we could check for the widget type instead, but
11110 * just check for Amp-In presence (in case of mixer
11111 * without amp-in there is something wrong, this
11112 * function shouldn't be used or capsrc nid is wrong)
11114 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
11115 snd_hda_codec_write(codec, nid, 0,
11116 AC_VERB_SET_AMP_GAIN_MUTE,
11118 else if (mute != AMP_IN_MUTE(idx))
11119 snd_hda_codec_write(codec, nid, 0,
11120 AC_VERB_SET_CONNECT_SEL,
11126 /* add mic boosts if needed */
11127 static int alc_auto_add_mic_boost(struct hda_codec *codec)
11129 struct alc_spec *spec = codec->spec;
11130 struct auto_pin_cfg *cfg = &spec->autocfg;
11134 const char *prev_label = NULL;
11136 for (i = 0; i < cfg->num_inputs; i++) {
11137 if (cfg->inputs[i].type > AUTO_PIN_MIC)
11139 nid = cfg->inputs[i].pin;
11140 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
11142 char boost_label[32];
11144 label = hda_get_autocfg_input_label(codec, cfg, i);
11145 if (prev_label && !strcmp(label, prev_label))
11149 prev_label = label;
11151 snprintf(boost_label, sizeof(boost_label),
11152 "%s Boost Volume", label);
11153 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11154 boost_label, type_idx,
11155 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11163 /* almost identical with ALC880 parser... */
11164 static int alc882_parse_auto_config(struct hda_codec *codec)
11166 struct alc_spec *spec = codec->spec;
11167 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
11170 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11174 if (!spec->autocfg.line_outs)
11175 return 0; /* can't find valid BIOS pin config */
11177 err = alc880_auto_fill_dac_nids(codec);
11180 err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids);
11183 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
11186 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
11190 err = alc880_auto_create_extra_out(spec,
11191 spec->autocfg.speaker_pins[0],
11195 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
11199 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11201 alc_auto_parse_digital(codec);
11203 if (spec->kctls.list)
11204 add_mixer(spec, spec->kctls.list);
11206 /* if ADC 0x07 is available, initialize it, too */
11207 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
11208 add_verb(spec, alc882_adc1_init_verbs);
11210 spec->num_mux_defs = 1;
11211 spec->input_mux = &spec->private_imux[0];
11213 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11215 err = alc_auto_add_mic_boost(codec);
11219 return 1; /* config found */
11222 /* additional initialization for auto-configuration model */
11223 static void alc882_auto_init(struct hda_codec *codec)
11225 struct alc_spec *spec = codec->spec;
11226 alc882_auto_init_multi_out(codec);
11227 alc882_auto_init_hp_out(codec);
11228 alc882_auto_init_analog_input(codec);
11229 alc882_auto_init_input_src(codec);
11230 alc_auto_init_digital(codec);
11231 if (spec->unsol_event)
11232 alc_inithook(codec);
11235 static int patch_alc882(struct hda_codec *codec)
11237 struct alc_spec *spec;
11238 int err, board_config;
11240 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11244 codec->spec = spec;
11246 spec->mixer_nid = 0x0b;
11248 switch (codec->vendor_id) {
11253 /* ALC883 and variants */
11254 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11258 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
11262 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
11263 board_config = snd_hda_check_board_codec_sid_config(codec,
11264 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
11266 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
11267 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11269 board_config = ALC882_AUTO;
11272 if (board_config == ALC882_AUTO) {
11273 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11274 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11277 alc_auto_parse_customize_define(codec);
11279 if (board_config == ALC882_AUTO) {
11280 /* automatic parse from the BIOS config */
11281 err = alc882_parse_auto_config(codec);
11287 "hda_codec: Cannot set up configuration "
11288 "from BIOS. Using base mode...\n");
11289 board_config = ALC882_3ST_DIG;
11293 if (has_cdefine_beep(codec)) {
11294 err = snd_hda_attach_beep_device(codec, 0x1);
11301 if (board_config != ALC882_AUTO)
11302 setup_preset(codec, &alc882_presets[board_config]);
11304 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11305 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11306 /* FIXME: setup DAC5 */
11307 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11308 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11310 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11311 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11313 if (!spec->adc_nids && spec->input_mux) {
11315 spec->num_adc_nids = 0;
11316 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11317 const struct hda_input_mux *imux = spec->input_mux;
11319 hda_nid_t nid = alc882_adc_nids[i];
11320 unsigned int wcap = get_wcaps(codec, nid);
11322 wcap = get_wcaps_type(wcap);
11323 if (wcap != AC_WID_AUD_IN)
11325 spec->private_adc_nids[spec->num_adc_nids] = nid;
11326 err = snd_hda_get_connections(codec, nid, &cap, 1);
11329 err = snd_hda_get_conn_list(codec, cap, NULL);
11332 for (j = 0; j < imux->num_items; j++)
11333 if (imux->items[j].index >= err)
11335 if (j < imux->num_items)
11337 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11338 spec->num_adc_nids++;
11340 spec->adc_nids = spec->private_adc_nids;
11341 spec->capsrc_nids = spec->private_capsrc_nids;
11344 set_capture_mixer(codec);
11346 if (has_cdefine_beep(codec))
11347 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11349 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11351 spec->vmaster_nid = 0x0c;
11353 codec->patch_ops = alc_patch_ops;
11354 if (board_config == ALC882_AUTO)
11355 spec->init_hook = alc882_auto_init;
11357 alc_init_jacks(codec);
11358 #ifdef CONFIG_SND_HDA_POWER_SAVE
11359 if (!spec->loopback.amplist)
11360 spec->loopback.amplist = alc882_loopbacks;
11371 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11372 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11374 #define alc262_dac_nids alc260_dac_nids
11375 #define alc262_adc_nids alc882_adc_nids
11376 #define alc262_adc_nids_alt alc882_adc_nids_alt
11377 #define alc262_capsrc_nids alc882_capsrc_nids
11378 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11380 #define alc262_modes alc260_modes
11381 #define alc262_capture_source alc882_capture_source
11383 static const hda_nid_t alc262_dmic_adc_nids[1] = {
11388 static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11390 static const struct snd_kcontrol_new alc262_base_mixer[] = {
11391 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11392 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11393 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11394 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11395 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11396 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11397 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11399 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11400 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11401 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11402 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11403 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11405 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11406 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11410 /* update HP, line and mono-out pins according to the master switch */
11411 #define alc262_hp_master_update alc260_hp_master_update
11413 static void alc262_hp_bpc_setup(struct hda_codec *codec)
11415 struct alc_spec *spec = codec->spec;
11417 spec->autocfg.hp_pins[0] = 0x1b;
11418 spec->autocfg.speaker_pins[0] = 0x16;
11419 spec->automute = 1;
11420 spec->automute_mode = ALC_AUTOMUTE_PIN;
11423 static void alc262_hp_wildwest_setup(struct hda_codec *codec)
11425 struct alc_spec *spec = codec->spec;
11427 spec->autocfg.hp_pins[0] = 0x15;
11428 spec->autocfg.speaker_pins[0] = 0x16;
11429 spec->automute = 1;
11430 spec->automute_mode = ALC_AUTOMUTE_PIN;
11433 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11434 #define alc262_hp_master_sw_put alc260_hp_master_sw_put
11436 #define ALC262_HP_MASTER_SWITCH \
11438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11439 .name = "Master Playback Switch", \
11440 .info = snd_ctl_boolean_mono_info, \
11441 .get = alc262_hp_master_sw_get, \
11442 .put = alc262_hp_master_sw_put, \
11445 .iface = NID_MAPPING, \
11446 .name = "Master Playback Switch", \
11447 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11451 static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11452 ALC262_HP_MASTER_SWITCH,
11453 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11454 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11455 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11456 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11458 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11460 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11461 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11462 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11463 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11464 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11465 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11466 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11467 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11468 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11469 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11470 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11471 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11475 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11476 ALC262_HP_MASTER_SWITCH,
11477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11478 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11479 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11480 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11481 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11483 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11485 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11486 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11487 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT),
11488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11490 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11491 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11495 static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11496 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11497 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11498 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
11502 /* mute/unmute internal speaker according to the hp jack and mute state */
11503 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11505 struct alc_spec *spec = codec->spec;
11507 spec->autocfg.hp_pins[0] = 0x15;
11508 spec->autocfg.speaker_pins[0] = 0x14;
11509 spec->automute = 1;
11510 spec->automute_mode = ALC_AUTOMUTE_PIN;
11513 static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11514 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11515 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11516 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11520 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11524 static const struct hda_verb alc262_hp_t5735_verbs[] = {
11525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11528 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11532 static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11533 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11535 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11536 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11537 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11538 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11542 static const struct hda_verb alc262_hp_rp5700_verbs[] = {
11543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11544 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11545 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11547 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11548 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11556 static const struct hda_input_mux alc262_hp_rp5700_capture_source = {
11563 /* bind hp and internal speaker mute (with plug check) as master switch */
11564 #define alc262_hippo_master_update alc262_hp_master_update
11565 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11566 #define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11568 #define ALC262_HIPPO_MASTER_SWITCH \
11570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11571 .name = "Master Playback Switch", \
11572 .info = snd_ctl_boolean_mono_info, \
11573 .get = alc262_hippo_master_sw_get, \
11574 .put = alc262_hippo_master_sw_put, \
11577 .iface = NID_MAPPING, \
11578 .name = "Master Playback Switch", \
11579 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11580 (SUBDEV_SPEAKER(0) << 16), \
11583 static const struct snd_kcontrol_new alc262_hippo_mixer[] = {
11584 ALC262_HIPPO_MASTER_SWITCH,
11585 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11586 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11587 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11588 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11589 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11590 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11591 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11592 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11593 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11594 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11595 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11596 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11600 static const struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11601 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11602 ALC262_HIPPO_MASTER_SWITCH,
11603 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11604 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11605 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11606 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11609 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11610 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11611 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11612 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11616 /* mute/unmute internal speaker according to the hp jack and mute state */
11617 static void alc262_hippo_setup(struct hda_codec *codec)
11619 struct alc_spec *spec = codec->spec;
11621 spec->autocfg.hp_pins[0] = 0x15;
11622 spec->autocfg.speaker_pins[0] = 0x14;
11623 spec->automute = 1;
11624 spec->automute_mode = ALC_AUTOMUTE_AMP;
11627 static void alc262_hippo1_setup(struct hda_codec *codec)
11629 struct alc_spec *spec = codec->spec;
11631 spec->autocfg.hp_pins[0] = 0x1b;
11632 spec->autocfg.speaker_pins[0] = 0x14;
11633 spec->automute = 1;
11634 spec->automute_mode = ALC_AUTOMUTE_AMP;
11638 static const struct snd_kcontrol_new alc262_sony_mixer[] = {
11639 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11640 ALC262_HIPPO_MASTER_SWITCH,
11641 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11642 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11643 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11644 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11648 static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11649 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11650 ALC262_HIPPO_MASTER_SWITCH,
11651 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11652 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11653 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11654 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11655 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11659 static const struct snd_kcontrol_new alc262_tyan_mixer[] = {
11660 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11661 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11662 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11663 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11664 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11665 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11668 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11669 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11670 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11671 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
11675 static const struct hda_verb alc262_tyan_verbs[] = {
11676 /* Headphone automute */
11677 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11678 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11679 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11681 /* P11 AUX_IN, white 4-pin connector */
11682 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11683 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11684 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11685 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11690 /* unsolicited event for HP jack sensing */
11691 static void alc262_tyan_setup(struct hda_codec *codec)
11693 struct alc_spec *spec = codec->spec;
11695 spec->autocfg.hp_pins[0] = 0x1b;
11696 spec->autocfg.speaker_pins[0] = 0x15;
11697 spec->automute = 1;
11698 spec->automute_mode = ALC_AUTOMUTE_AMP;
11702 #define alc262_capture_mixer alc882_capture_mixer
11703 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11706 * generic initialization of ADC, input mixers and output mixers
11708 static const struct hda_verb alc262_init_verbs[] = {
11710 * Unmute ADC0-2 and set the default input to mic-in
11712 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11714 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11716 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11719 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11721 * Note: PASD motherboards uses the Line In 2 as the input for
11722 * front panel mic (mic 2)
11724 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11732 * Set up output mixers (0x0c - 0x0e)
11734 /* set vol=0 to output mixers */
11735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11736 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11737 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11738 /* set up input amps for analog loopback */
11739 /* Amp Indices: DAC = 0, mixer = 1 */
11740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11741 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11744 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11747 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11748 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11749 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11752 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11755 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11756 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11757 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11760 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11761 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11763 /* FIXME: use matrix-type input source selection */
11764 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11765 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11766 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11767 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11772 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11784 static const struct hda_verb alc262_eapd_verbs[] = {
11785 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11786 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11790 static const struct hda_verb alc262_hippo1_unsol_verbs[] = {
11791 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11792 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11793 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11795 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11800 static const struct hda_verb alc262_sony_unsol_verbs[] = {
11801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11803 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11805 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11810 static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11811 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11812 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11819 static const struct hda_verb alc262_toshiba_s06_verbs[] = {
11820 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11823 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11824 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11826 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11831 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11833 struct alc_spec *spec = codec->spec;
11835 spec->autocfg.hp_pins[0] = 0x15;
11836 spec->autocfg.speaker_pins[0] = 0x14;
11837 spec->ext_mic.pin = 0x18;
11838 spec->ext_mic.mux_idx = 0;
11839 spec->int_mic.pin = 0x12;
11840 spec->int_mic.mux_idx = 9;
11841 spec->auto_mic = 1;
11842 spec->automute = 1;
11843 spec->automute_mode = ALC_AUTOMUTE_PIN;
11849 * 0x16 = internal speaker
11850 * 0x18 = external mic
11853 static const struct snd_kcontrol_new alc262_nec_mixer[] = {
11854 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11855 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11857 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11858 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11859 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11861 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11862 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11866 static const struct hda_verb alc262_nec_verbs[] = {
11867 /* Unmute Speaker */
11868 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11871 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11874 /* External mic to headphone */
11875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11876 /* External mic to speaker */
11877 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11883 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11884 * 0x1b = port replicator headphone out
11887 #define ALC_HP_EVENT ALC880_HP_EVENT
11889 static const struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11890 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11892 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11893 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11897 static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11898 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11899 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11903 static const struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11904 /* Front Mic pin: input vref at 50% */
11905 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11906 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11910 static const struct hda_input_mux alc262_fujitsu_capture_source = {
11914 { "Internal Mic", 0x1 },
11919 static const struct hda_input_mux alc262_HP_capture_source = {
11923 { "Front Mic", 0x1 },
11930 static const struct hda_input_mux alc262_HP_D7000_capture_source = {
11934 { "Front Mic", 0x2 },
11940 static void alc262_fujitsu_setup(struct hda_codec *codec)
11942 struct alc_spec *spec = codec->spec;
11944 spec->autocfg.hp_pins[0] = 0x14;
11945 spec->autocfg.hp_pins[1] = 0x1b;
11946 spec->autocfg.speaker_pins[0] = 0x15;
11947 spec->automute = 1;
11948 spec->automute_mode = ALC_AUTOMUTE_AMP;
11951 /* bind volumes of both NID 0x0c and 0x0d */
11952 static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11953 .ops = &snd_hda_bind_vol,
11955 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11956 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11961 static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11962 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11965 .name = "Master Playback Switch",
11966 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
11967 .info = snd_ctl_boolean_mono_info,
11968 .get = alc262_hp_master_sw_get,
11969 .put = alc262_hp_master_sw_put,
11972 .iface = NID_MAPPING,
11973 .name = "Master Playback Switch",
11974 .private_value = 0x1b,
11976 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11977 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11978 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
11979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11981 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
11982 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11983 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11987 static void alc262_lenovo_3000_setup(struct hda_codec *codec)
11989 struct alc_spec *spec = codec->spec;
11991 spec->autocfg.hp_pins[0] = 0x1b;
11992 spec->autocfg.speaker_pins[0] = 0x14;
11993 spec->autocfg.speaker_pins[1] = 0x16;
11994 spec->automute = 1;
11995 spec->automute_mode = ALC_AUTOMUTE_AMP;
11998 static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11999 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12001 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12002 .name = "Master Playback Switch",
12003 .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
12004 .info = snd_ctl_boolean_mono_info,
12005 .get = alc262_hp_master_sw_get,
12006 .put = alc262_hp_master_sw_put,
12008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
12010 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12013 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
12014 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
12015 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
12019 static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12020 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12021 ALC262_HIPPO_MASTER_SWITCH,
12022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12024 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
12025 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12026 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12027 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
12031 /* additional init verbs for Benq laptops */
12032 static const struct hda_verb alc262_EAPD_verbs[] = {
12033 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12034 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12038 static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12039 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12040 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12042 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12043 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
12047 /* Samsung Q1 Ultra Vista model setup */
12048 static const struct snd_kcontrol_new alc262_ultra_mixer[] = {
12049 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12050 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12053 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
12054 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
12058 static const struct hda_verb alc262_ultra_verbs[] = {
12060 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12066 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12067 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12071 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12073 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12075 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12077 /* ADC, choose mic */
12078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12086 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
12091 /* mute/unmute internal speaker according to the hp jack and mute state */
12092 static void alc262_ultra_automute(struct hda_codec *codec)
12094 struct alc_spec *spec = codec->spec;
12098 /* auto-mute only when HP is used as HP */
12099 if (!spec->cur_mux[0]) {
12100 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
12101 if (spec->jack_present)
12102 mute = HDA_AMP_MUTE;
12104 /* mute/unmute internal speaker */
12105 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12106 HDA_AMP_MUTE, mute);
12107 /* mute/unmute HP */
12108 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12109 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
12112 /* unsolicited event for HP jack sensing */
12113 static void alc262_ultra_unsol_event(struct hda_codec *codec,
12116 if ((res >> 26) != ALC880_HP_EVENT)
12118 alc262_ultra_automute(codec);
12121 static const struct hda_input_mux alc262_ultra_capture_source = {
12125 { "Headphone", 0x7 },
12129 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12130 struct snd_ctl_elem_value *ucontrol)
12132 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12133 struct alc_spec *spec = codec->spec;
12136 ret = alc_mux_enum_put(kcontrol, ucontrol);
12139 /* reprogram the HP pin as mic or HP according to the input source */
12140 snd_hda_codec_write_cache(codec, 0x15, 0,
12141 AC_VERB_SET_PIN_WIDGET_CONTROL,
12142 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12143 alc262_ultra_automute(codec); /* mute/unmute HP */
12147 static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12148 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12149 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12152 .name = "Capture Source",
12153 .info = alc_mux_enum_info,
12154 .get = alc_mux_enum_get,
12155 .put = alc262_ultra_mux_enum_put,
12158 .iface = NID_MAPPING,
12159 .name = "Capture Source",
12160 .private_value = 0x15,
12165 /* We use two mixers depending on the output pin; 0x16 is a mono output
12166 * and thus it's bound with a different mixer.
12167 * This function returns which mixer amp should be used.
12169 static int alc262_check_volbit(hda_nid_t nid)
12173 else if (nid == 0x16)
12179 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12180 const char *pfx, int *vbits, int idx)
12185 vbit = alc262_check_volbit(nid);
12188 if (*vbits & vbit) /* a volume control for this mixer already there */
12192 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12194 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12195 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12198 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12199 const char *pfx, int idx)
12206 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12208 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12209 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12212 /* add playback controls from the parsed DAC table */
12213 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12214 const struct auto_pin_cfg *cfg)
12220 spec->multiout.num_dacs = 1; /* only use one dac */
12221 spec->multiout.dac_nids = spec->private_dac_nids;
12222 spec->private_dac_nids[0] = 2;
12224 for (i = 0; i < 2; i++) {
12225 pfx = alc_get_line_out_pfx(spec, i, true, &index);
12228 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx,
12232 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12233 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12238 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12239 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12246 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12247 alc262_check_volbit(cfg->speaker_pins[0]) |
12248 alc262_check_volbit(cfg->hp_pins[0]);
12250 for (i = 0; i < 2; i++) {
12251 pfx = alc_get_line_out_pfx(spec, i, true, &index);
12254 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12258 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12259 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12260 "Speaker", &vbits, i);
12264 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12265 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12266 "Headphone", &vbits, i);
12274 #define alc262_auto_create_input_ctls \
12275 alc882_auto_create_input_ctls
12277 static const struct hda_verb alc262_HP_BPC_init_verbs[] = {
12279 * Unmute ADC0-2 and set the default input to mic-in
12281 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12282 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12283 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12285 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12286 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12288 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12290 * Note: PASD motherboards uses the Line In 2 as the input for
12291 * front panel mic (mic 2)
12293 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12303 * Set up output mixers (0x0c - 0x0e)
12305 /* set vol=0 to output mixers */
12306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12308 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12310 /* set up input amps for analog loopback */
12311 /* Amp Indices: DAC = 0, mixer = 1 */
12312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12319 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12321 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12324 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12326 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12327 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12331 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12332 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12333 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12335 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12336 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12337 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12338 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12339 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12340 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12343 /* FIXME: use matrix-type input source selection */
12344 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12345 /* Input mixer1: only unmute Mic */
12346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12348 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12349 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12376 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12381 static const struct hda_verb alc262_HP_BPC_WildWest_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 front
12395 * 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)},
12405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
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)},
12424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12425 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12426 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12428 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12429 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12430 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12432 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12435 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12436 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12438 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12439 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12440 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12442 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12443 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12445 /* FIXME: use matrix-type input source selection */
12446 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12447 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12453 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12461 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12469 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12472 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12477 static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12481 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12483 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12484 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12489 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12490 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12502 static const struct alc_fixup alc262_fixups[] = {
12503 [PINFIX_FSC_H270] = {
12504 .type = ALC_FIXUP_PINS,
12505 .v.pins = (const struct alc_pincfg[]) {
12506 { 0x14, 0x99130110 }, /* speaker */
12507 { 0x15, 0x0221142f }, /* front HP */
12508 { 0x1b, 0x0121141f }, /* rear HP */
12512 [PINFIX_HP_Z200] = {
12513 .type = ALC_FIXUP_PINS,
12514 .v.pins = (const struct alc_pincfg[]) {
12515 { 0x16, 0x99130120 }, /* internal speaker */
12521 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
12522 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200),
12523 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12528 #ifdef CONFIG_SND_HDA_POWER_SAVE
12529 #define alc262_loopbacks alc880_loopbacks
12532 /* pcm configuration: identical with ALC880 */
12533 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12534 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12535 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12536 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12539 * BIOS auto configuration
12541 static int alc262_parse_auto_config(struct hda_codec *codec)
12543 struct alc_spec *spec = codec->spec;
12545 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12547 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12551 if (!spec->autocfg.line_outs) {
12552 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12553 spec->multiout.max_channels = 2;
12554 spec->no_analog = 1;
12557 return 0; /* can't find valid BIOS pin config */
12559 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12562 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12566 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12569 alc_auto_parse_digital(codec);
12571 if (spec->kctls.list)
12572 add_mixer(spec, spec->kctls.list);
12574 spec->num_mux_defs = 1;
12575 spec->input_mux = &spec->private_imux[0];
12577 err = alc_auto_add_mic_boost(codec);
12581 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12586 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12587 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12588 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12589 #define alc262_auto_init_input_src alc882_auto_init_input_src
12592 /* init callback for auto-configuration model -- overriding the default init */
12593 static void alc262_auto_init(struct hda_codec *codec)
12595 struct alc_spec *spec = codec->spec;
12596 alc262_auto_init_multi_out(codec);
12597 alc262_auto_init_hp_out(codec);
12598 alc262_auto_init_analog_input(codec);
12599 alc262_auto_init_input_src(codec);
12600 alc_auto_init_digital(codec);
12601 if (spec->unsol_event)
12602 alc_inithook(codec);
12606 * configuration and preset
12608 static const char * const alc262_models[ALC262_MODEL_LAST] = {
12609 [ALC262_BASIC] = "basic",
12610 [ALC262_HIPPO] = "hippo",
12611 [ALC262_HIPPO_1] = "hippo_1",
12612 [ALC262_FUJITSU] = "fujitsu",
12613 [ALC262_HP_BPC] = "hp-bpc",
12614 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12615 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12616 [ALC262_HP_RP5700] = "hp-rp5700",
12617 [ALC262_BENQ_ED8] = "benq",
12618 [ALC262_BENQ_T31] = "benq-t31",
12619 [ALC262_SONY_ASSAMD] = "sony-assamd",
12620 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12621 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12622 [ALC262_ULTRA] = "ultra",
12623 [ALC262_LENOVO_3000] = "lenovo-3000",
12624 [ALC262_NEC] = "nec",
12625 [ALC262_TYAN] = "tyan",
12626 [ALC262_AUTO] = "auto",
12629 static const struct snd_pci_quirk alc262_cfg_tbl[] = {
12630 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12631 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12632 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12634 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12636 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12638 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200",
12640 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12642 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12643 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12644 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12645 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12646 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12647 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12648 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12649 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12650 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12651 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12652 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12653 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12654 ALC262_HP_TC_T5735),
12655 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12656 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12657 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12658 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12659 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12660 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12661 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12662 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12663 #if 0 /* disable the quirk since model=auto works better in recent versions */
12664 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12665 ALC262_SONY_ASSAMD),
12667 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12668 ALC262_TOSHIBA_RX1),
12669 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12670 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12671 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12672 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12673 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12675 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12676 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12677 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12678 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12679 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12683 static const struct alc_config_preset alc262_presets[] = {
12685 .mixers = { alc262_base_mixer },
12686 .init_verbs = { alc262_init_verbs },
12687 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12688 .dac_nids = alc262_dac_nids,
12690 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12691 .channel_mode = alc262_modes,
12692 .input_mux = &alc262_capture_source,
12695 .mixers = { alc262_hippo_mixer },
12696 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12697 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12698 .dac_nids = alc262_dac_nids,
12700 .dig_out_nid = ALC262_DIGOUT_NID,
12701 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12702 .channel_mode = alc262_modes,
12703 .input_mux = &alc262_capture_source,
12704 .unsol_event = alc_sku_unsol_event,
12705 .setup = alc262_hippo_setup,
12706 .init_hook = alc_inithook,
12708 [ALC262_HIPPO_1] = {
12709 .mixers = { alc262_hippo1_mixer },
12710 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12711 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12712 .dac_nids = alc262_dac_nids,
12714 .dig_out_nid = ALC262_DIGOUT_NID,
12715 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12716 .channel_mode = alc262_modes,
12717 .input_mux = &alc262_capture_source,
12718 .unsol_event = alc_sku_unsol_event,
12719 .setup = alc262_hippo1_setup,
12720 .init_hook = alc_inithook,
12722 [ALC262_FUJITSU] = {
12723 .mixers = { alc262_fujitsu_mixer },
12724 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12725 alc262_fujitsu_unsol_verbs },
12726 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12727 .dac_nids = alc262_dac_nids,
12729 .dig_out_nid = ALC262_DIGOUT_NID,
12730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12731 .channel_mode = alc262_modes,
12732 .input_mux = &alc262_fujitsu_capture_source,
12733 .unsol_event = alc_sku_unsol_event,
12734 .setup = alc262_fujitsu_setup,
12735 .init_hook = alc_inithook,
12737 [ALC262_HP_BPC] = {
12738 .mixers = { alc262_HP_BPC_mixer },
12739 .init_verbs = { alc262_HP_BPC_init_verbs },
12740 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12741 .dac_nids = alc262_dac_nids,
12743 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12744 .channel_mode = alc262_modes,
12745 .input_mux = &alc262_HP_capture_source,
12746 .unsol_event = alc_sku_unsol_event,
12747 .setup = alc262_hp_bpc_setup,
12748 .init_hook = alc_inithook,
12750 [ALC262_HP_BPC_D7000_WF] = {
12751 .mixers = { alc262_HP_BPC_WildWest_mixer },
12752 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12753 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12754 .dac_nids = alc262_dac_nids,
12756 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12757 .channel_mode = alc262_modes,
12758 .input_mux = &alc262_HP_D7000_capture_source,
12759 .unsol_event = alc_sku_unsol_event,
12760 .setup = alc262_hp_wildwest_setup,
12761 .init_hook = alc_inithook,
12763 [ALC262_HP_BPC_D7000_WL] = {
12764 .mixers = { alc262_HP_BPC_WildWest_mixer,
12765 alc262_HP_BPC_WildWest_option_mixer },
12766 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12767 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12768 .dac_nids = alc262_dac_nids,
12770 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12771 .channel_mode = alc262_modes,
12772 .input_mux = &alc262_HP_D7000_capture_source,
12773 .unsol_event = alc_sku_unsol_event,
12774 .setup = alc262_hp_wildwest_setup,
12775 .init_hook = alc_inithook,
12777 [ALC262_HP_TC_T5735] = {
12778 .mixers = { alc262_hp_t5735_mixer },
12779 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12780 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12781 .dac_nids = alc262_dac_nids,
12783 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12784 .channel_mode = alc262_modes,
12785 .input_mux = &alc262_capture_source,
12786 .unsol_event = alc_sku_unsol_event,
12787 .setup = alc262_hp_t5735_setup,
12788 .init_hook = alc_inithook,
12790 [ALC262_HP_RP5700] = {
12791 .mixers = { alc262_hp_rp5700_mixer },
12792 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12794 .dac_nids = alc262_dac_nids,
12795 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12796 .channel_mode = alc262_modes,
12797 .input_mux = &alc262_hp_rp5700_capture_source,
12799 [ALC262_BENQ_ED8] = {
12800 .mixers = { alc262_base_mixer },
12801 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12802 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12803 .dac_nids = alc262_dac_nids,
12805 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12806 .channel_mode = alc262_modes,
12807 .input_mux = &alc262_capture_source,
12809 [ALC262_SONY_ASSAMD] = {
12810 .mixers = { alc262_sony_mixer },
12811 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12812 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12813 .dac_nids = alc262_dac_nids,
12815 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12816 .channel_mode = alc262_modes,
12817 .input_mux = &alc262_capture_source,
12818 .unsol_event = alc_sku_unsol_event,
12819 .setup = alc262_hippo_setup,
12820 .init_hook = alc_inithook,
12822 [ALC262_BENQ_T31] = {
12823 .mixers = { alc262_benq_t31_mixer },
12824 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12825 alc_hp15_unsol_verbs },
12826 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12827 .dac_nids = alc262_dac_nids,
12829 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12830 .channel_mode = alc262_modes,
12831 .input_mux = &alc262_capture_source,
12832 .unsol_event = alc_sku_unsol_event,
12833 .setup = alc262_hippo_setup,
12834 .init_hook = alc_inithook,
12837 .mixers = { alc262_ultra_mixer },
12838 .cap_mixer = alc262_ultra_capture_mixer,
12839 .init_verbs = { alc262_ultra_verbs },
12840 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12841 .dac_nids = alc262_dac_nids,
12842 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12843 .channel_mode = alc262_modes,
12844 .input_mux = &alc262_ultra_capture_source,
12845 .adc_nids = alc262_adc_nids, /* ADC0 */
12846 .capsrc_nids = alc262_capsrc_nids,
12847 .num_adc_nids = 1, /* single ADC */
12848 .unsol_event = alc262_ultra_unsol_event,
12849 .init_hook = alc262_ultra_automute,
12851 [ALC262_LENOVO_3000] = {
12852 .mixers = { alc262_lenovo_3000_mixer },
12853 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12854 alc262_lenovo_3000_unsol_verbs,
12855 alc262_lenovo_3000_init_verbs },
12856 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12857 .dac_nids = alc262_dac_nids,
12859 .dig_out_nid = ALC262_DIGOUT_NID,
12860 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12861 .channel_mode = alc262_modes,
12862 .input_mux = &alc262_fujitsu_capture_source,
12863 .unsol_event = alc_sku_unsol_event,
12864 .setup = alc262_lenovo_3000_setup,
12865 .init_hook = alc_inithook,
12868 .mixers = { alc262_nec_mixer },
12869 .init_verbs = { alc262_nec_verbs },
12870 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12871 .dac_nids = alc262_dac_nids,
12873 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12874 .channel_mode = alc262_modes,
12875 .input_mux = &alc262_capture_source,
12877 [ALC262_TOSHIBA_S06] = {
12878 .mixers = { alc262_toshiba_s06_mixer },
12879 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12880 alc262_eapd_verbs },
12881 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12882 .capsrc_nids = alc262_dmic_capsrc_nids,
12883 .dac_nids = alc262_dac_nids,
12884 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12885 .num_adc_nids = 1, /* single ADC */
12886 .dig_out_nid = ALC262_DIGOUT_NID,
12887 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12888 .channel_mode = alc262_modes,
12889 .unsol_event = alc_sku_unsol_event,
12890 .setup = alc262_toshiba_s06_setup,
12891 .init_hook = alc_inithook,
12893 [ALC262_TOSHIBA_RX1] = {
12894 .mixers = { alc262_toshiba_rx1_mixer },
12895 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_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,
12902 .unsol_event = alc_sku_unsol_event,
12903 .setup = alc262_hippo_setup,
12904 .init_hook = alc_inithook,
12907 .mixers = { alc262_tyan_mixer },
12908 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12909 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12910 .dac_nids = alc262_dac_nids,
12912 .dig_out_nid = ALC262_DIGOUT_NID,
12913 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12914 .channel_mode = alc262_modes,
12915 .input_mux = &alc262_capture_source,
12916 .unsol_event = alc_sku_unsol_event,
12917 .setup = alc262_tyan_setup,
12918 .init_hook = alc_hp_automute,
12922 static int patch_alc262(struct hda_codec *codec)
12924 struct alc_spec *spec;
12928 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12932 codec->spec = spec;
12934 spec->mixer_nid = 0x0b;
12937 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12942 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12943 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12944 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12945 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12948 alc_auto_parse_customize_define(codec);
12950 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12952 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12956 if (board_config < 0) {
12957 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12959 board_config = ALC262_AUTO;
12962 if (board_config == ALC262_AUTO) {
12963 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12964 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12967 if (board_config == ALC262_AUTO) {
12968 /* automatic parse from the BIOS config */
12969 err = alc262_parse_auto_config(codec);
12975 "hda_codec: Cannot set up configuration "
12976 "from BIOS. Using base mode...\n");
12977 board_config = ALC262_BASIC;
12981 if (!spec->no_analog && has_cdefine_beep(codec)) {
12982 err = snd_hda_attach_beep_device(codec, 0x1);
12989 if (board_config != ALC262_AUTO)
12990 setup_preset(codec, &alc262_presets[board_config]);
12992 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12993 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12995 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12996 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12998 if (!spec->adc_nids && spec->input_mux) {
13000 /* check whether the digital-mic has to be supported */
13001 for (i = 0; i < spec->input_mux->num_items; i++) {
13002 if (spec->input_mux->items[i].index >= 9)
13005 if (i < spec->input_mux->num_items) {
13006 /* use only ADC0 */
13007 spec->adc_nids = alc262_dmic_adc_nids;
13008 spec->num_adc_nids = 1;
13009 spec->capsrc_nids = alc262_dmic_capsrc_nids;
13011 /* all analog inputs */
13012 /* check whether NID 0x07 is valid */
13013 unsigned int wcap = get_wcaps(codec, 0x07);
13016 wcap = get_wcaps_type(wcap);
13017 if (wcap != AC_WID_AUD_IN) {
13018 spec->adc_nids = alc262_adc_nids_alt;
13019 spec->num_adc_nids =
13020 ARRAY_SIZE(alc262_adc_nids_alt);
13021 spec->capsrc_nids = alc262_capsrc_nids_alt;
13023 spec->adc_nids = alc262_adc_nids;
13024 spec->num_adc_nids =
13025 ARRAY_SIZE(alc262_adc_nids);
13026 spec->capsrc_nids = alc262_capsrc_nids;
13030 if (!spec->cap_mixer && !spec->no_analog)
13031 set_capture_mixer(codec);
13032 if (!spec->no_analog && has_cdefine_beep(codec))
13033 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13035 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
13037 spec->vmaster_nid = 0x0c;
13039 codec->patch_ops = alc_patch_ops;
13040 if (board_config == ALC262_AUTO)
13041 spec->init_hook = alc262_auto_init;
13042 spec->shutup = alc_eapd_shutup;
13044 alc_init_jacks(codec);
13045 #ifdef CONFIG_SND_HDA_POWER_SAVE
13046 if (!spec->loopback.amplist)
13047 spec->loopback.amplist = alc262_loopbacks;
13054 * ALC268 channel source setting (2 channel)
13056 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13057 #define alc268_modes alc260_modes
13059 static const hda_nid_t alc268_dac_nids[2] = {
13064 static const hda_nid_t alc268_adc_nids[2] = {
13069 static const hda_nid_t alc268_adc_nids_alt[1] = {
13074 static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13076 static const struct snd_kcontrol_new alc268_base_mixer[] = {
13077 /* output mixer control */
13078 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13079 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13080 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13081 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13082 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13083 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13084 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13088 static const struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13089 /* output mixer control */
13090 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13091 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13092 ALC262_HIPPO_MASTER_SWITCH,
13093 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13094 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
13095 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13099 /* bind Beep switches of both NID 0x0f and 0x10 */
13100 static const struct hda_bind_ctls alc268_bind_beep_sw = {
13101 .ops = &snd_hda_bind_sw,
13103 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13104 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13109 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
13110 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13111 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13115 static const struct hda_verb alc268_eapd_verbs[] = {
13116 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13117 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13121 /* Toshiba specific */
13122 static const struct hda_verb alc268_toshiba_verbs[] = {
13123 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13127 /* Acer specific */
13128 /* bind volumes of both NID 0x02 and 0x03 */
13129 static const struct hda_bind_ctls alc268_acer_bind_master_vol = {
13130 .ops = &snd_hda_bind_vol,
13132 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13133 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13138 static void alc268_acer_setup(struct hda_codec *codec)
13140 struct alc_spec *spec = codec->spec;
13142 spec->autocfg.hp_pins[0] = 0x14;
13143 spec->autocfg.speaker_pins[0] = 0x15;
13144 spec->automute = 1;
13145 spec->automute_mode = ALC_AUTOMUTE_AMP;
13148 #define alc268_acer_master_sw_get alc262_hp_master_sw_get
13149 #define alc268_acer_master_sw_put alc262_hp_master_sw_put
13151 static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13152 /* output mixer control */
13153 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13155 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13156 .name = "Master Playback Switch",
13157 .subdevice = HDA_SUBDEV_NID_FLAG | 0x15,
13158 .info = snd_ctl_boolean_mono_info,
13159 .get = alc268_acer_master_sw_get,
13160 .put = alc268_acer_master_sw_put,
13162 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13166 static const struct snd_kcontrol_new alc268_acer_mixer[] = {
13167 /* output mixer control */
13168 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13170 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13171 .name = "Master Playback Switch",
13172 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13173 .info = snd_ctl_boolean_mono_info,
13174 .get = alc268_acer_master_sw_get,
13175 .put = alc268_acer_master_sw_put,
13177 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13178 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13179 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13183 static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13184 /* output mixer control */
13185 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13187 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13188 .name = "Master Playback Switch",
13189 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13190 .info = snd_ctl_boolean_mono_info,
13191 .get = alc268_acer_master_sw_get,
13192 .put = alc268_acer_master_sw_put,
13194 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13195 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13199 static const struct hda_verb alc268_acer_aspire_one_verbs[] = {
13200 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13202 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13203 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13204 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13205 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13209 static const struct hda_verb alc268_acer_verbs[] = {
13210 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13211 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13212 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13213 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13214 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13215 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13216 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13220 /* unsolicited event for HP jack sensing */
13221 #define alc268_toshiba_setup alc262_hippo_setup
13223 static void alc268_acer_lc_setup(struct hda_codec *codec)
13225 struct alc_spec *spec = codec->spec;
13226 spec->autocfg.hp_pins[0] = 0x15;
13227 spec->autocfg.speaker_pins[0] = 0x14;
13228 spec->automute = 1;
13229 spec->automute_mode = ALC_AUTOMUTE_AMP;
13230 spec->ext_mic.pin = 0x18;
13231 spec->ext_mic.mux_idx = 0;
13232 spec->int_mic.pin = 0x12;
13233 spec->int_mic.mux_idx = 6;
13234 spec->auto_mic = 1;
13237 static const struct snd_kcontrol_new alc268_dell_mixer[] = {
13238 /* output mixer control */
13239 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13240 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13241 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13243 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13244 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13248 static const struct hda_verb alc268_dell_verbs[] = {
13249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13250 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13252 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13256 /* mute/unmute internal speaker according to the hp jack and mute state */
13257 static void alc268_dell_setup(struct hda_codec *codec)
13259 struct alc_spec *spec = codec->spec;
13261 spec->autocfg.hp_pins[0] = 0x15;
13262 spec->autocfg.speaker_pins[0] = 0x14;
13263 spec->ext_mic.pin = 0x18;
13264 spec->ext_mic.mux_idx = 0;
13265 spec->int_mic.pin = 0x19;
13266 spec->int_mic.mux_idx = 1;
13267 spec->auto_mic = 1;
13268 spec->automute = 1;
13269 spec->automute_mode = ALC_AUTOMUTE_PIN;
13272 static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13273 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13274 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13275 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13276 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13277 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13278 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13279 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13280 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13284 static const struct hda_verb alc267_quanta_il1_verbs[] = {
13285 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13286 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13290 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13292 struct alc_spec *spec = codec->spec;
13293 spec->autocfg.hp_pins[0] = 0x15;
13294 spec->autocfg.speaker_pins[0] = 0x14;
13295 spec->ext_mic.pin = 0x18;
13296 spec->ext_mic.mux_idx = 0;
13297 spec->int_mic.pin = 0x19;
13298 spec->int_mic.mux_idx = 1;
13299 spec->auto_mic = 1;
13300 spec->automute = 1;
13301 spec->automute_mode = ALC_AUTOMUTE_PIN;
13305 * generic initialization of ADC, input mixers and output mixers
13307 static const struct hda_verb alc268_base_init_verbs[] = {
13308 /* Unmute DAC0-1 and set vol = 0 */
13309 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13310 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13313 * Set up output mixers (0x0c - 0x0e)
13315 /* set vol=0 to output mixers */
13316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13317 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13319 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13320 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13323 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13324 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13326 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13328 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13329 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13331 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13332 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13333 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13334 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13335 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13337 /* set PCBEEP vol = 0, mute connections */
13338 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13339 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13340 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13342 /* Unmute Selector 23h,24h and set the default input to mic-in */
13344 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13346 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13347 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13352 /* only for model=test */
13353 #ifdef CONFIG_SND_DEBUG
13355 * generic initialization of ADC, input mixers and output mixers
13357 static const struct hda_verb alc268_volume_init_verbs[] = {
13358 /* set output DAC */
13359 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13360 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13365 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13366 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13369 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13370 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13373 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13376 #endif /* CONFIG_SND_DEBUG */
13378 /* set PCBEEP vol = 0, mute connections */
13379 static const struct hda_verb alc268_beep_init_verbs[] = {
13380 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13381 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13382 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13386 static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13387 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13388 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13392 static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13393 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13394 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13399 static const struct snd_kcontrol_new alc268_capture_mixer[] = {
13400 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13401 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13402 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13403 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13408 static const struct hda_input_mux alc268_capture_source = {
13412 { "Front Mic", 0x1 },
13418 static const struct hda_input_mux alc268_acer_capture_source = {
13422 { "Internal Mic", 0x1 },
13427 static const struct hda_input_mux alc268_acer_dmic_capture_source = {
13431 { "Internal Mic", 0x6 },
13436 #ifdef CONFIG_SND_DEBUG
13437 static const struct snd_kcontrol_new alc268_test_mixer[] = {
13438 /* Volume widgets */
13439 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13440 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13441 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13442 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13443 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13444 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13445 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13446 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13447 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13448 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13449 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13450 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13451 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13452 /* The below appears problematic on some hardwares */
13453 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13454 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13455 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13456 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13457 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13459 /* Modes for retasking pin widgets */
13460 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13461 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13462 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13463 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13465 /* Controls for GPIO pins, assuming they are configured as outputs */
13466 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13467 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13468 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13469 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13471 /* Switches to allow the digital SPDIF output pin to be enabled.
13472 * The ALC268 does not have an SPDIF input.
13474 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13476 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13477 * this output to turn on an external amplifier.
13479 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13480 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13486 /* create input playback/capture controls for the given pin */
13487 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13488 const char *ctlname, int idx)
13499 case 0x1a: /* ALC259/269 only */
13500 case 0x1b: /* ALC259/269 only */
13501 case 0x21: /* ALC269vb has this pin, too */
13505 snd_printd(KERN_WARNING "hda_codec: "
13506 "ignoring pin 0x%x as unknown\n", nid);
13509 if (spec->multiout.dac_nids[0] != dac &&
13510 spec->multiout.dac_nids[1] != dac) {
13511 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13512 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13516 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
13520 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13521 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13523 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13524 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13530 /* add playback controls from the parsed DAC table */
13531 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13532 const struct auto_pin_cfg *cfg)
13537 spec->multiout.dac_nids = spec->private_dac_nids;
13539 nid = cfg->line_out_pins[0];
13543 name = alc_get_line_out_pfx(spec, 0, true, &index);
13544 err = alc268_new_analog_output(spec, nid, name, 0);
13549 nid = cfg->speaker_pins[0];
13551 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13552 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13556 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13560 nid = cfg->hp_pins[0];
13562 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13567 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13569 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13570 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13577 /* create playback/capture controls for input pins */
13578 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13579 const struct auto_pin_cfg *cfg)
13581 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13584 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13585 hda_nid_t nid, int pin_type)
13589 alc_set_pin_output(codec, nid, pin_type);
13590 if (nid == 0x14 || nid == 0x16)
13594 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13597 static void alc268_auto_init_dac(struct hda_codec *codec, hda_nid_t nid)
13601 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13605 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13607 struct alc_spec *spec = codec->spec;
13610 for (i = 0; i < spec->autocfg.line_outs; i++) {
13611 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13612 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13613 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13616 for (i = 0; i < spec->multiout.num_dacs; i++)
13617 alc268_auto_init_dac(codec, spec->multiout.dac_nids[i]);
13620 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13622 struct alc_spec *spec = codec->spec;
13626 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13627 pin = spec->autocfg.hp_pins[i];
13628 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13630 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13631 pin = spec->autocfg.speaker_pins[i];
13632 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13634 if (spec->autocfg.mono_out_pin)
13635 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13636 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13638 alc268_auto_init_dac(codec, spec->multiout.hp_nid);
13639 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
13640 alc268_auto_init_dac(codec, spec->multiout.extra_out_nid[i]);
13643 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13645 struct alc_spec *spec = codec->spec;
13646 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13647 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13648 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13649 unsigned int dac_vol1, dac_vol2;
13651 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13652 snd_hda_codec_write(codec, speaker_nid, 0,
13653 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13654 /* mute mixer inputs from 0x1d */
13655 snd_hda_codec_write(codec, 0x0f, 0,
13656 AC_VERB_SET_AMP_GAIN_MUTE,
13658 snd_hda_codec_write(codec, 0x10, 0,
13659 AC_VERB_SET_AMP_GAIN_MUTE,
13662 /* unmute mixer inputs from 0x1d */
13663 snd_hda_codec_write(codec, 0x0f, 0,
13664 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13665 snd_hda_codec_write(codec, 0x10, 0,
13666 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13669 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13670 if (line_nid == 0x14)
13671 dac_vol2 = AMP_OUT_ZERO;
13672 else if (line_nid == 0x15)
13673 dac_vol1 = AMP_OUT_ZERO;
13674 if (hp_nid == 0x14)
13675 dac_vol2 = AMP_OUT_ZERO;
13676 else if (hp_nid == 0x15)
13677 dac_vol1 = AMP_OUT_ZERO;
13678 if (line_nid != 0x16 || hp_nid != 0x16 ||
13679 spec->autocfg.line_out_pins[1] != 0x16 ||
13680 spec->autocfg.line_out_pins[2] != 0x16)
13681 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13683 snd_hda_codec_write(codec, 0x02, 0,
13684 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13685 snd_hda_codec_write(codec, 0x03, 0,
13686 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13689 /* pcm configuration: identical with ALC880 */
13690 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13691 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13692 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13693 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13696 * BIOS auto configuration
13698 static int alc268_parse_auto_config(struct hda_codec *codec)
13700 struct alc_spec *spec = codec->spec;
13702 static const hda_nid_t alc268_ignore[] = { 0 };
13704 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13708 if (!spec->autocfg.line_outs) {
13709 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13710 spec->multiout.max_channels = 2;
13711 spec->no_analog = 1;
13714 return 0; /* can't find valid BIOS pin config */
13716 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13719 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13723 spec->multiout.max_channels = 2;
13726 /* digital only support output */
13727 alc_auto_parse_digital(codec);
13728 if (spec->kctls.list)
13729 add_mixer(spec, spec->kctls.list);
13731 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13732 add_mixer(spec, alc268_beep_mixer);
13734 add_verb(spec, alc268_beep_init_verbs);
13735 spec->num_mux_defs = 2;
13736 spec->input_mux = &spec->private_imux[0];
13738 err = alc_auto_add_mic_boost(codec);
13742 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13747 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13748 #define alc268_auto_init_input_src alc882_auto_init_input_src
13750 /* init callback for auto-configuration model -- overriding the default init */
13751 static void alc268_auto_init(struct hda_codec *codec)
13753 struct alc_spec *spec = codec->spec;
13754 alc268_auto_init_multi_out(codec);
13755 alc268_auto_init_hp_out(codec);
13756 alc268_auto_init_mono_speaker_out(codec);
13757 alc268_auto_init_analog_input(codec);
13758 alc268_auto_init_input_src(codec);
13759 alc_auto_init_digital(codec);
13760 if (spec->unsol_event)
13761 alc_inithook(codec);
13765 * configuration and preset
13767 static const char * const alc268_models[ALC268_MODEL_LAST] = {
13768 [ALC267_QUANTA_IL1] = "quanta-il1",
13769 [ALC268_3ST] = "3stack",
13770 [ALC268_TOSHIBA] = "toshiba",
13771 [ALC268_ACER] = "acer",
13772 [ALC268_ACER_DMIC] = "acer-dmic",
13773 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13774 [ALC268_DELL] = "dell",
13775 [ALC268_ZEPTO] = "zepto",
13776 #ifdef CONFIG_SND_DEBUG
13777 [ALC268_TEST] = "test",
13779 [ALC268_AUTO] = "auto",
13782 static const struct snd_pci_quirk alc268_cfg_tbl[] = {
13783 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13784 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13785 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13786 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13787 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13788 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13789 ALC268_ACER_ASPIRE_ONE),
13790 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13791 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO),
13792 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13793 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13794 /* almost compatible with toshiba but with optional digital outs;
13795 * auto-probing seems working fine
13797 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13799 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13800 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13801 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13802 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13806 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13807 static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13808 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13809 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13810 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13815 static const struct alc_config_preset alc268_presets[] = {
13816 [ALC267_QUANTA_IL1] = {
13817 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13818 alc268_capture_nosrc_mixer },
13819 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13820 alc267_quanta_il1_verbs },
13821 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13822 .dac_nids = alc268_dac_nids,
13823 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13824 .adc_nids = alc268_adc_nids_alt,
13826 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13827 .channel_mode = alc268_modes,
13828 .unsol_event = alc_sku_unsol_event,
13829 .setup = alc267_quanta_il1_setup,
13830 .init_hook = alc_inithook,
13833 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13834 alc268_beep_mixer },
13835 .init_verbs = { alc268_base_init_verbs },
13836 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13837 .dac_nids = alc268_dac_nids,
13838 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13839 .adc_nids = alc268_adc_nids_alt,
13840 .capsrc_nids = alc268_capsrc_nids,
13842 .dig_out_nid = ALC268_DIGOUT_NID,
13843 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13844 .channel_mode = alc268_modes,
13845 .input_mux = &alc268_capture_source,
13847 [ALC268_TOSHIBA] = {
13848 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13849 alc268_beep_mixer },
13850 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13851 alc268_toshiba_verbs },
13852 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13853 .dac_nids = alc268_dac_nids,
13854 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13855 .adc_nids = alc268_adc_nids_alt,
13856 .capsrc_nids = alc268_capsrc_nids,
13858 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13859 .channel_mode = alc268_modes,
13860 .input_mux = &alc268_capture_source,
13861 .unsol_event = alc_sku_unsol_event,
13862 .setup = alc268_toshiba_setup,
13863 .init_hook = alc_inithook,
13866 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13867 alc268_beep_mixer },
13868 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13869 alc268_acer_verbs },
13870 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13871 .dac_nids = alc268_dac_nids,
13872 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13873 .adc_nids = alc268_adc_nids_alt,
13874 .capsrc_nids = alc268_capsrc_nids,
13876 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13877 .channel_mode = alc268_modes,
13878 .input_mux = &alc268_acer_capture_source,
13879 .unsol_event = alc_sku_unsol_event,
13880 .setup = alc268_acer_setup,
13881 .init_hook = alc_inithook,
13883 [ALC268_ACER_DMIC] = {
13884 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13885 alc268_beep_mixer },
13886 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13887 alc268_acer_verbs },
13888 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13889 .dac_nids = alc268_dac_nids,
13890 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13891 .adc_nids = alc268_adc_nids_alt,
13892 .capsrc_nids = alc268_capsrc_nids,
13894 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13895 .channel_mode = alc268_modes,
13896 .input_mux = &alc268_acer_dmic_capture_source,
13897 .unsol_event = alc_sku_unsol_event,
13898 .setup = alc268_acer_setup,
13899 .init_hook = alc_inithook,
13901 [ALC268_ACER_ASPIRE_ONE] = {
13902 .mixers = { alc268_acer_aspire_one_mixer,
13904 alc268_capture_nosrc_mixer },
13905 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13906 alc268_acer_aspire_one_verbs },
13907 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13908 .dac_nids = alc268_dac_nids,
13909 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13910 .adc_nids = alc268_adc_nids_alt,
13911 .capsrc_nids = alc268_capsrc_nids,
13913 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13914 .channel_mode = alc268_modes,
13915 .unsol_event = alc_sku_unsol_event,
13916 .setup = alc268_acer_lc_setup,
13917 .init_hook = alc_inithook,
13920 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13921 alc268_capture_nosrc_mixer },
13922 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13923 alc268_dell_verbs },
13924 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13925 .dac_nids = alc268_dac_nids,
13926 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13927 .adc_nids = alc268_adc_nids_alt,
13928 .capsrc_nids = alc268_capsrc_nids,
13930 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13931 .channel_mode = alc268_modes,
13932 .unsol_event = alc_sku_unsol_event,
13933 .setup = alc268_dell_setup,
13934 .init_hook = alc_inithook,
13937 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13938 alc268_beep_mixer },
13939 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13940 alc268_toshiba_verbs },
13941 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13942 .dac_nids = alc268_dac_nids,
13943 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13944 .adc_nids = alc268_adc_nids_alt,
13945 .capsrc_nids = alc268_capsrc_nids,
13947 .dig_out_nid = ALC268_DIGOUT_NID,
13948 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13949 .channel_mode = alc268_modes,
13950 .input_mux = &alc268_capture_source,
13951 .unsol_event = alc_sku_unsol_event,
13952 .setup = alc268_toshiba_setup,
13953 .init_hook = alc_inithook,
13955 #ifdef CONFIG_SND_DEBUG
13957 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13958 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13959 alc268_volume_init_verbs,
13960 alc268_beep_init_verbs },
13961 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13962 .dac_nids = alc268_dac_nids,
13963 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13964 .adc_nids = alc268_adc_nids_alt,
13965 .capsrc_nids = alc268_capsrc_nids,
13967 .dig_out_nid = ALC268_DIGOUT_NID,
13968 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13969 .channel_mode = alc268_modes,
13970 .input_mux = &alc268_capture_source,
13975 static int patch_alc268(struct hda_codec *codec)
13977 struct alc_spec *spec;
13979 int i, has_beep, err;
13981 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13985 codec->spec = spec;
13987 /* ALC268 has no aa-loopback mixer */
13989 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13993 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13994 board_config = snd_hda_check_board_codec_sid_config(codec,
13995 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13997 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13998 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14000 board_config = ALC268_AUTO;
14003 if (board_config == ALC268_AUTO) {
14004 /* automatic parse from the BIOS config */
14005 err = alc268_parse_auto_config(codec);
14011 "hda_codec: Cannot set up configuration "
14012 "from BIOS. Using base mode...\n");
14013 board_config = ALC268_3ST;
14017 if (board_config != ALC268_AUTO)
14018 setup_preset(codec, &alc268_presets[board_config]);
14020 spec->stream_analog_playback = &alc268_pcm_analog_playback;
14021 spec->stream_analog_capture = &alc268_pcm_analog_capture;
14022 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
14024 spec->stream_digital_playback = &alc268_pcm_digital_playback;
14027 for (i = 0; i < spec->num_mixers; i++) {
14028 if (spec->mixers[i] == alc268_beep_mixer) {
14035 err = snd_hda_attach_beep_device(codec, 0x1);
14040 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
14041 /* override the amp caps for beep generator */
14042 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
14043 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
14044 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14045 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14046 (0 << AC_AMPCAP_MUTE_SHIFT));
14049 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14050 /* check whether NID 0x07 is valid */
14051 unsigned int wcap = get_wcaps(codec, 0x07);
14053 spec->capsrc_nids = alc268_capsrc_nids;
14055 wcap = get_wcaps_type(wcap);
14056 if (spec->auto_mic ||
14057 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14058 spec->adc_nids = alc268_adc_nids_alt;
14059 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14060 if (spec->auto_mic)
14061 fixup_automic_adc(codec);
14062 if (spec->auto_mic || spec->input_mux->num_items == 1)
14063 add_mixer(spec, alc268_capture_nosrc_mixer);
14065 add_mixer(spec, alc268_capture_alt_mixer);
14067 spec->adc_nids = alc268_adc_nids;
14068 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14069 add_mixer(spec, alc268_capture_mixer);
14073 spec->vmaster_nid = 0x02;
14075 codec->patch_ops = alc_patch_ops;
14076 if (board_config == ALC268_AUTO)
14077 spec->init_hook = alc268_auto_init;
14078 spec->shutup = alc_eapd_shutup;
14080 alc_init_jacks(codec);
14086 * ALC269 channel source setting (2 channel)
14088 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14090 #define alc269_dac_nids alc260_dac_nids
14092 static const hda_nid_t alc269_adc_nids[1] = {
14097 static const hda_nid_t alc269_capsrc_nids[1] = {
14101 static const hda_nid_t alc269vb_adc_nids[1] = {
14106 static const hda_nid_t alc269vb_capsrc_nids[1] = {
14110 static const hda_nid_t alc269_adc_candidates[] = {
14111 0x08, 0x09, 0x07, 0x11,
14114 #define alc269_modes alc260_modes
14115 #define alc269_capture_source alc880_lg_lw_capture_source
14117 static const struct snd_kcontrol_new alc269_base_mixer[] = {
14118 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14119 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14120 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14121 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14122 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14124 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14127 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
14128 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14129 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14133 static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14134 /* output mixer control */
14135 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14137 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14138 .name = "Master Playback Switch",
14139 .subdevice = HDA_SUBDEV_AMP_FLAG,
14140 .info = snd_hda_mixer_amp_switch_info,
14141 .get = snd_hda_mixer_amp_switch_get,
14142 .put = alc268_acer_master_sw_put,
14143 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14147 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14148 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14149 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14150 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14154 static const struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14155 /* output mixer control */
14156 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14159 .name = "Master Playback Switch",
14160 .subdevice = HDA_SUBDEV_AMP_FLAG,
14161 .info = snd_hda_mixer_amp_switch_info,
14162 .get = snd_hda_mixer_amp_switch_get,
14163 .put = alc268_acer_master_sw_put,
14164 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14168 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14169 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14170 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14171 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14172 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14173 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT),
14178 static const struct snd_kcontrol_new alc269_laptop_mixer[] = {
14179 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14180 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14186 static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14187 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14188 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14190 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14194 static const struct snd_kcontrol_new alc269_asus_mixer[] = {
14195 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14196 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14200 /* capture mixer elements */
14201 static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14202 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14203 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14204 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14205 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14209 static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14210 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14211 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14212 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14216 static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14217 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14218 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14219 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14220 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
14224 static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14225 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14226 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14227 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14232 #define alc269_fujitsu_mixer alc269_laptop_mixer
14234 static const struct hda_verb alc269_quanta_fl1_verbs[] = {
14235 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14236 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14238 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14239 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14240 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14244 static const struct hda_verb alc269_lifebook_verbs[] = {
14245 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14246 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14247 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14249 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14250 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14251 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14252 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14253 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14254 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14258 /* toggle speaker-output according to the hp-jack state */
14259 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14261 alc_hp_automute(codec);
14263 snd_hda_codec_write(codec, 0x20, 0,
14264 AC_VERB_SET_COEF_INDEX, 0x0c);
14265 snd_hda_codec_write(codec, 0x20, 0,
14266 AC_VERB_SET_PROC_COEF, 0x680);
14268 snd_hda_codec_write(codec, 0x20, 0,
14269 AC_VERB_SET_COEF_INDEX, 0x0c);
14270 snd_hda_codec_write(codec, 0x20, 0,
14271 AC_VERB_SET_PROC_COEF, 0x480);
14274 #define alc269_lifebook_speaker_automute \
14275 alc269_quanta_fl1_speaker_automute
14277 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14279 unsigned int present_laptop;
14280 unsigned int present_dock;
14282 present_laptop = snd_hda_jack_detect(codec, 0x18);
14283 present_dock = snd_hda_jack_detect(codec, 0x1b);
14285 /* Laptop mic port overrides dock mic port, design decision */
14287 snd_hda_codec_write(codec, 0x23, 0,
14288 AC_VERB_SET_CONNECT_SEL, 0x3);
14289 if (present_laptop)
14290 snd_hda_codec_write(codec, 0x23, 0,
14291 AC_VERB_SET_CONNECT_SEL, 0x0);
14292 if (!present_dock && !present_laptop)
14293 snd_hda_codec_write(codec, 0x23, 0,
14294 AC_VERB_SET_CONNECT_SEL, 0x1);
14297 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14300 switch (res >> 26) {
14301 case ALC880_HP_EVENT:
14302 alc269_quanta_fl1_speaker_automute(codec);
14304 case ALC880_MIC_EVENT:
14305 alc_mic_automute(codec);
14310 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14313 if ((res >> 26) == ALC880_HP_EVENT)
14314 alc269_lifebook_speaker_automute(codec);
14315 if ((res >> 26) == ALC880_MIC_EVENT)
14316 alc269_lifebook_mic_autoswitch(codec);
14319 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14321 struct alc_spec *spec = codec->spec;
14322 spec->autocfg.hp_pins[0] = 0x15;
14323 spec->autocfg.speaker_pins[0] = 0x14;
14324 spec->automute_mixer_nid[0] = 0x0c;
14325 spec->automute = 1;
14326 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14327 spec->ext_mic.pin = 0x18;
14328 spec->ext_mic.mux_idx = 0;
14329 spec->int_mic.pin = 0x19;
14330 spec->int_mic.mux_idx = 1;
14331 spec->auto_mic = 1;
14334 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14336 alc269_quanta_fl1_speaker_automute(codec);
14337 alc_mic_automute(codec);
14340 static void alc269_lifebook_setup(struct hda_codec *codec)
14342 struct alc_spec *spec = codec->spec;
14343 spec->autocfg.hp_pins[0] = 0x15;
14344 spec->autocfg.hp_pins[1] = 0x1a;
14345 spec->autocfg.speaker_pins[0] = 0x14;
14346 spec->automute_mixer_nid[0] = 0x0c;
14347 spec->automute = 1;
14348 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14351 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14353 alc269_lifebook_speaker_automute(codec);
14354 alc269_lifebook_mic_autoswitch(codec);
14357 static const struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14358 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14359 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14360 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14362 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14363 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14364 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14368 static const struct hda_verb alc269_laptop_amic_init_verbs[] = {
14369 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14370 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14371 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14373 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14374 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14378 static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14379 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14380 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14381 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14382 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14383 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14384 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14385 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14389 static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14390 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14391 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14392 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14394 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14395 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14396 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14400 static const struct hda_verb alc271_acer_dmic_verbs[] = {
14401 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14402 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14403 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14405 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14406 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14407 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14408 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14409 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14410 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14414 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14416 struct alc_spec *spec = codec->spec;
14417 spec->autocfg.hp_pins[0] = 0x15;
14418 spec->autocfg.speaker_pins[0] = 0x14;
14419 spec->automute_mixer_nid[0] = 0x0c;
14420 spec->automute = 1;
14421 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14422 spec->ext_mic.pin = 0x18;
14423 spec->ext_mic.mux_idx = 0;
14424 spec->int_mic.pin = 0x19;
14425 spec->int_mic.mux_idx = 1;
14426 spec->auto_mic = 1;
14429 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14431 struct alc_spec *spec = codec->spec;
14432 spec->autocfg.hp_pins[0] = 0x15;
14433 spec->autocfg.speaker_pins[0] = 0x14;
14434 spec->automute_mixer_nid[0] = 0x0c;
14435 spec->automute = 1;
14436 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14437 spec->ext_mic.pin = 0x18;
14438 spec->ext_mic.mux_idx = 0;
14439 spec->int_mic.pin = 0x12;
14440 spec->int_mic.mux_idx = 5;
14441 spec->auto_mic = 1;
14444 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14446 struct alc_spec *spec = codec->spec;
14447 spec->autocfg.hp_pins[0] = 0x21;
14448 spec->autocfg.speaker_pins[0] = 0x14;
14449 spec->automute_mixer_nid[0] = 0x0c;
14450 spec->automute = 1;
14451 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14452 spec->ext_mic.pin = 0x18;
14453 spec->ext_mic.mux_idx = 0;
14454 spec->int_mic.pin = 0x19;
14455 spec->int_mic.mux_idx = 1;
14456 spec->auto_mic = 1;
14459 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14461 struct alc_spec *spec = codec->spec;
14462 spec->autocfg.hp_pins[0] = 0x21;
14463 spec->autocfg.speaker_pins[0] = 0x14;
14464 spec->automute_mixer_nid[0] = 0x0c;
14465 spec->automute = 1;
14466 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14467 spec->ext_mic.pin = 0x18;
14468 spec->ext_mic.mux_idx = 0;
14469 spec->int_mic.pin = 0x12;
14470 spec->int_mic.mux_idx = 6;
14471 spec->auto_mic = 1;
14475 * generic initialization of ADC, input mixers and output mixers
14477 static const struct hda_verb alc269_init_verbs[] = {
14479 * Unmute ADC0 and set the default input to mic-in
14481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14484 * Set up output mixers (0x02 - 0x03)
14486 /* set vol=0 to output mixers */
14487 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14488 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14490 /* set up input amps for analog loopback */
14491 /* Amp Indices: DAC = 0, mixer = 1 */
14492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14496 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14497 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14499 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14501 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14505 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14510 /* FIXME: use Mux-type input source selection */
14511 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14512 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14513 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14516 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14520 static const struct hda_verb alc269vb_init_verbs[] = {
14522 * Unmute ADC0 and set the default input to mic-in
14524 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14527 * Set up output mixers (0x02 - 0x03)
14529 /* set vol=0 to output mixers */
14530 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14531 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14533 /* set up input amps for analog loopback */
14534 /* Amp Indices: DAC = 0, mixer = 1 */
14535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14537 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14539 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14543 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14544 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14545 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14547 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14548 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14551 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14553 /* FIXME: use Mux-type input source selection */
14554 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14555 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14556 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14559 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14563 #define alc269_auto_create_multi_out_ctls \
14564 alc268_auto_create_multi_out_ctls
14565 #define alc269_auto_create_input_ctls \
14566 alc268_auto_create_input_ctls
14568 #ifdef CONFIG_SND_HDA_POWER_SAVE
14569 #define alc269_loopbacks alc880_loopbacks
14572 /* pcm configuration: identical with ALC880 */
14573 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14574 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14575 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14576 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14578 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14582 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14583 /* NID is set in alc_build_pcms */
14585 .open = alc880_playback_pcm_open,
14586 .prepare = alc880_playback_pcm_prepare,
14587 .cleanup = alc880_playback_pcm_cleanup
14591 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14595 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14596 /* NID is set in alc_build_pcms */
14599 #ifdef CONFIG_SND_HDA_POWER_SAVE
14600 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14602 switch (codec->subsystem_id) {
14609 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14611 /* update mute-LED according to the speaker mute state */
14612 if (nid == 0x01 || nid == 0x14) {
14614 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14619 /* mic2 vref pin is used for mute LED control */
14620 snd_hda_codec_update_cache(codec, 0x19, 0,
14621 AC_VERB_SET_PIN_WIDGET_CONTROL,
14624 return alc_check_power_status(codec, nid);
14626 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14628 static int alc275_setup_dual_adc(struct hda_codec *codec)
14630 struct alc_spec *spec = codec->spec;
14632 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14634 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14635 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14636 if (spec->ext_mic.pin <= 0x12) {
14637 spec->private_adc_nids[0] = 0x08;
14638 spec->private_adc_nids[1] = 0x11;
14639 spec->private_capsrc_nids[0] = 0x23;
14640 spec->private_capsrc_nids[1] = 0x22;
14642 spec->private_adc_nids[0] = 0x11;
14643 spec->private_adc_nids[1] = 0x08;
14644 spec->private_capsrc_nids[0] = 0x22;
14645 spec->private_capsrc_nids[1] = 0x23;
14647 spec->adc_nids = spec->private_adc_nids;
14648 spec->capsrc_nids = spec->private_capsrc_nids;
14649 spec->num_adc_nids = 2;
14650 spec->dual_adc_switch = 1;
14651 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14652 spec->adc_nids[0], spec->adc_nids[1]);
14658 /* different alc269-variants */
14660 ALC269_TYPE_NORMAL,
14661 ALC269_TYPE_ALC258,
14662 ALC269_TYPE_ALC259,
14663 ALC269_TYPE_ALC269VB,
14664 ALC269_TYPE_ALC270,
14665 ALC269_TYPE_ALC271X,
14669 * BIOS auto configuration
14671 static int alc269_parse_auto_config(struct hda_codec *codec)
14673 struct alc_spec *spec = codec->spec;
14675 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14677 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14682 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14685 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14686 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14688 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14693 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14695 alc_auto_parse_digital(codec);
14697 if (spec->kctls.list)
14698 add_mixer(spec, spec->kctls.list);
14700 if (spec->codec_variant != ALC269_TYPE_NORMAL)
14701 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14703 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14705 spec->num_mux_defs = 1;
14706 spec->input_mux = &spec->private_imux[0];
14708 if (!alc275_setup_dual_adc(codec))
14709 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14710 sizeof(alc269_adc_candidates));
14712 err = alc_auto_add_mic_boost(codec);
14716 if (!spec->cap_mixer && !spec->no_analog)
14717 set_capture_mixer(codec);
14722 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14723 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14724 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14725 #define alc269_auto_init_input_src alc882_auto_init_input_src
14728 /* init callback for auto-configuration model -- overriding the default init */
14729 static void alc269_auto_init(struct hda_codec *codec)
14731 struct alc_spec *spec = codec->spec;
14732 alc269_auto_init_multi_out(codec);
14733 alc269_auto_init_hp_out(codec);
14734 alc269_auto_init_analog_input(codec);
14735 if (!spec->dual_adc_switch)
14736 alc269_auto_init_input_src(codec);
14737 alc_auto_init_digital(codec);
14738 if (spec->unsol_event)
14739 alc_inithook(codec);
14742 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14744 int val = alc_read_coef_idx(codec, 0x04);
14749 alc_write_coef_idx(codec, 0x04, val);
14752 static void alc269_shutup(struct hda_codec *codec)
14754 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14755 alc269_toggle_power_output(codec, 0);
14756 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14757 alc269_toggle_power_output(codec, 0);
14762 #ifdef SND_HDA_NEEDS_RESUME
14763 static int alc269_resume(struct hda_codec *codec)
14765 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14766 alc269_toggle_power_output(codec, 0);
14770 codec->patch_ops.init(codec);
14772 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14773 alc269_toggle_power_output(codec, 1);
14777 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14778 alc269_toggle_power_output(codec, 1);
14780 snd_hda_codec_resume_amp(codec);
14781 snd_hda_codec_resume_cache(codec);
14782 hda_call_check_power_status(codec, 0x01);
14785 #endif /* SND_HDA_NEEDS_RESUME */
14787 static void alc269_fixup_hweq(struct hda_codec *codec,
14788 const struct alc_fixup *fix, int action)
14792 if (action != ALC_FIXUP_ACT_INIT)
14794 coef = alc_read_coef_idx(codec, 0x1e);
14795 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14798 static void alc271_fixup_dmic(struct hda_codec *codec,
14799 const struct alc_fixup *fix, int action)
14801 static const struct hda_verb verbs[] = {
14802 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14803 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14808 if (strcmp(codec->chip_name, "ALC271X"))
14810 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
14811 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
14812 snd_hda_sequence_write(codec, verbs);
14816 ALC269_FIXUP_SONY_VAIO,
14817 ALC275_FIXUP_SONY_VAIO_GPIO2,
14818 ALC269_FIXUP_DELL_M101Z,
14819 ALC269_FIXUP_SKU_IGNORE,
14820 ALC269_FIXUP_ASUS_G73JW,
14821 ALC269_FIXUP_LENOVO_EAPD,
14822 ALC275_FIXUP_SONY_HWEQ,
14826 static const struct alc_fixup alc269_fixups[] = {
14827 [ALC269_FIXUP_SONY_VAIO] = {
14828 .type = ALC_FIXUP_VERBS,
14829 .v.verbs = (const struct hda_verb[]) {
14830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14834 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14835 .type = ALC_FIXUP_VERBS,
14836 .v.verbs = (const struct hda_verb[]) {
14837 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14838 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14839 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14843 .chain_id = ALC269_FIXUP_SONY_VAIO
14845 [ALC269_FIXUP_DELL_M101Z] = {
14846 .type = ALC_FIXUP_VERBS,
14847 .v.verbs = (const struct hda_verb[]) {
14848 /* Enables internal speaker */
14849 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14850 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14854 [ALC269_FIXUP_SKU_IGNORE] = {
14855 .type = ALC_FIXUP_SKU,
14856 .v.sku = ALC_FIXUP_SKU_IGNORE,
14858 [ALC269_FIXUP_ASUS_G73JW] = {
14859 .type = ALC_FIXUP_PINS,
14860 .v.pins = (const struct alc_pincfg[]) {
14861 { 0x17, 0x99130111 }, /* subwoofer */
14865 [ALC269_FIXUP_LENOVO_EAPD] = {
14866 .type = ALC_FIXUP_VERBS,
14867 .v.verbs = (const struct hda_verb[]) {
14868 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14872 [ALC275_FIXUP_SONY_HWEQ] = {
14873 .type = ALC_FIXUP_FUNC,
14874 .v.func = alc269_fixup_hweq,
14876 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14878 [ALC271_FIXUP_DMIC] = {
14879 .type = ALC_FIXUP_FUNC,
14880 .v.func = alc271_fixup_dmic,
14884 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
14885 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14886 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14887 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14888 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14889 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14890 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
14891 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14892 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
14893 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14894 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
14895 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
14896 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14897 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
14903 * configuration and preset
14905 static const char * const alc269_models[ALC269_MODEL_LAST] = {
14906 [ALC269_BASIC] = "basic",
14907 [ALC269_QUANTA_FL1] = "quanta",
14908 [ALC269_AMIC] = "laptop-amic",
14909 [ALC269_DMIC] = "laptop-dmic",
14910 [ALC269_FUJITSU] = "fujitsu",
14911 [ALC269_LIFEBOOK] = "lifebook",
14912 [ALC269_AUTO] = "auto",
14915 static const struct snd_pci_quirk alc269_cfg_tbl[] = {
14916 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14917 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14918 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14920 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14921 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14922 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14923 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14924 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14925 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14926 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14927 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14928 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14929 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC),
14930 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14931 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14932 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14933 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14934 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14935 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14936 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14937 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14938 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14939 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14940 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14941 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14942 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14943 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14944 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14945 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14946 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14947 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14948 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14949 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14950 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14951 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14952 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14953 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14954 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14955 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14956 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14958 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14960 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14961 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14962 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14963 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14964 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14965 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14966 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14967 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14968 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14969 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14973 static const struct alc_config_preset alc269_presets[] = {
14975 .mixers = { alc269_base_mixer },
14976 .init_verbs = { alc269_init_verbs },
14977 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14978 .dac_nids = alc269_dac_nids,
14980 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14981 .channel_mode = alc269_modes,
14982 .input_mux = &alc269_capture_source,
14984 [ALC269_QUANTA_FL1] = {
14985 .mixers = { alc269_quanta_fl1_mixer },
14986 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14987 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14988 .dac_nids = alc269_dac_nids,
14990 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14991 .channel_mode = alc269_modes,
14992 .input_mux = &alc269_capture_source,
14993 .unsol_event = alc269_quanta_fl1_unsol_event,
14994 .setup = alc269_quanta_fl1_setup,
14995 .init_hook = alc269_quanta_fl1_init_hook,
14998 .mixers = { alc269_laptop_mixer },
14999 .cap_mixer = alc269_laptop_analog_capture_mixer,
15000 .init_verbs = { alc269_init_verbs,
15001 alc269_laptop_amic_init_verbs },
15002 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15003 .dac_nids = alc269_dac_nids,
15005 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15006 .channel_mode = alc269_modes,
15007 .unsol_event = alc_sku_unsol_event,
15008 .setup = alc269_laptop_amic_setup,
15009 .init_hook = alc_inithook,
15012 .mixers = { alc269_laptop_mixer },
15013 .cap_mixer = alc269_laptop_digital_capture_mixer,
15014 .init_verbs = { alc269_init_verbs,
15015 alc269_laptop_dmic_init_verbs },
15016 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15017 .dac_nids = alc269_dac_nids,
15019 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15020 .channel_mode = alc269_modes,
15021 .unsol_event = alc_sku_unsol_event,
15022 .setup = alc269_laptop_dmic_setup,
15023 .init_hook = alc_inithook,
15025 [ALC269VB_AMIC] = {
15026 .mixers = { alc269vb_laptop_mixer },
15027 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
15028 .init_verbs = { alc269vb_init_verbs,
15029 alc269vb_laptop_amic_init_verbs },
15030 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15031 .dac_nids = alc269_dac_nids,
15033 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15034 .channel_mode = alc269_modes,
15035 .unsol_event = alc_sku_unsol_event,
15036 .setup = alc269vb_laptop_amic_setup,
15037 .init_hook = alc_inithook,
15039 [ALC269VB_DMIC] = {
15040 .mixers = { alc269vb_laptop_mixer },
15041 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15042 .init_verbs = { alc269vb_init_verbs,
15043 alc269vb_laptop_dmic_init_verbs },
15044 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15045 .dac_nids = alc269_dac_nids,
15047 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15048 .channel_mode = alc269_modes,
15049 .unsol_event = alc_sku_unsol_event,
15050 .setup = alc269vb_laptop_dmic_setup,
15051 .init_hook = alc_inithook,
15053 [ALC269_FUJITSU] = {
15054 .mixers = { alc269_fujitsu_mixer },
15055 .cap_mixer = alc269_laptop_digital_capture_mixer,
15056 .init_verbs = { alc269_init_verbs,
15057 alc269_laptop_dmic_init_verbs },
15058 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15059 .dac_nids = alc269_dac_nids,
15061 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15062 .channel_mode = alc269_modes,
15063 .unsol_event = alc_sku_unsol_event,
15064 .setup = alc269_laptop_dmic_setup,
15065 .init_hook = alc_inithook,
15067 [ALC269_LIFEBOOK] = {
15068 .mixers = { alc269_lifebook_mixer },
15069 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15070 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15071 .dac_nids = alc269_dac_nids,
15073 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15074 .channel_mode = alc269_modes,
15075 .input_mux = &alc269_capture_source,
15076 .unsol_event = alc269_lifebook_unsol_event,
15077 .setup = alc269_lifebook_setup,
15078 .init_hook = alc269_lifebook_init_hook,
15081 .mixers = { alc269_asus_mixer },
15082 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15083 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15084 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15085 .dac_nids = alc269_dac_nids,
15086 .adc_nids = alc262_dmic_adc_nids,
15087 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15088 .capsrc_nids = alc262_dmic_capsrc_nids,
15089 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15090 .channel_mode = alc269_modes,
15091 .input_mux = &alc269_capture_source,
15092 .dig_out_nid = ALC880_DIGOUT_NID,
15093 .unsol_event = alc_sku_unsol_event,
15094 .setup = alc269vb_laptop_dmic_setup,
15095 .init_hook = alc_inithook,
15099 static int alc269_fill_coef(struct hda_codec *codec)
15103 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15104 alc_write_coef_idx(codec, 0xf, 0x960b);
15105 alc_write_coef_idx(codec, 0xe, 0x8817);
15108 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15109 alc_write_coef_idx(codec, 0xf, 0x960b);
15110 alc_write_coef_idx(codec, 0xe, 0x8814);
15113 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15114 val = alc_read_coef_idx(codec, 0x04);
15115 /* Power up output pin */
15116 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15119 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15120 val = alc_read_coef_idx(codec, 0xd);
15121 if ((val & 0x0c00) >> 10 != 0x1) {
15122 /* Capless ramp up clock control */
15123 alc_write_coef_idx(codec, 0xd, val | (1<<10));
15125 val = alc_read_coef_idx(codec, 0x17);
15126 if ((val & 0x01c0) >> 6 != 0x4) {
15127 /* Class D power on reset */
15128 alc_write_coef_idx(codec, 0x17, val | (1<<7));
15132 val = alc_read_coef_idx(codec, 0xd); /* Class D */
15133 alc_write_coef_idx(codec, 0xd, val | (1<<14));
15135 val = alc_read_coef_idx(codec, 0x4); /* HP */
15136 alc_write_coef_idx(codec, 0x4, val | (1<<11));
15141 static int patch_alc269(struct hda_codec *codec)
15143 struct alc_spec *spec;
15144 int board_config, coef;
15147 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15151 codec->spec = spec;
15153 spec->mixer_nid = 0x0b;
15155 alc_auto_parse_customize_define(codec);
15157 if (codec->vendor_id == 0x10ec0269) {
15158 coef = alc_read_coef_idx(codec, 0);
15159 if ((coef & 0x00f0) == 0x0010) {
15160 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15161 spec->cdefine.platform_type == 1) {
15162 alc_codec_rename(codec, "ALC271X");
15163 spec->codec_variant = ALC269_TYPE_ALC271X;
15164 } else if ((coef & 0xf000) == 0x1000) {
15165 spec->codec_variant = ALC269_TYPE_ALC270;
15166 } else if ((coef & 0xf000) == 0x2000) {
15167 alc_codec_rename(codec, "ALC259");
15168 spec->codec_variant = ALC269_TYPE_ALC259;
15169 } else if ((coef & 0xf000) == 0x3000) {
15170 alc_codec_rename(codec, "ALC258");
15171 spec->codec_variant = ALC269_TYPE_ALC258;
15173 alc_codec_rename(codec, "ALC269VB");
15174 spec->codec_variant = ALC269_TYPE_ALC269VB;
15177 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15178 alc269_fill_coef(codec);
15181 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15185 if (board_config < 0) {
15186 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15188 board_config = ALC269_AUTO;
15191 if (board_config == ALC269_AUTO) {
15192 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15193 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15196 if (board_config == ALC269_AUTO) {
15197 /* automatic parse from the BIOS config */
15198 err = alc269_parse_auto_config(codec);
15204 "hda_codec: Cannot set up configuration "
15205 "from BIOS. Using base mode...\n");
15206 board_config = ALC269_BASIC;
15210 if (has_cdefine_beep(codec)) {
15211 err = snd_hda_attach_beep_device(codec, 0x1);
15218 if (board_config != ALC269_AUTO)
15219 setup_preset(codec, &alc269_presets[board_config]);
15221 if (board_config == ALC269_QUANTA_FL1) {
15222 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15223 * fix the sample rate of analog I/O to 44.1kHz
15225 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15226 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15227 } else if (spec->dual_adc_switch) {
15228 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15229 /* switch ADC dynamically */
15230 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15232 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15233 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15235 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15236 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15238 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15239 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15240 spec->adc_nids = alc269_adc_nids;
15241 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15242 spec->capsrc_nids = alc269_capsrc_nids;
15244 spec->adc_nids = alc269vb_adc_nids;
15245 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15246 spec->capsrc_nids = alc269vb_capsrc_nids;
15250 if (!spec->cap_mixer)
15251 set_capture_mixer(codec);
15252 if (has_cdefine_beep(codec))
15253 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15255 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15257 spec->vmaster_nid = 0x02;
15259 codec->patch_ops = alc_patch_ops;
15260 #ifdef SND_HDA_NEEDS_RESUME
15261 codec->patch_ops.resume = alc269_resume;
15263 if (board_config == ALC269_AUTO)
15264 spec->init_hook = alc269_auto_init;
15265 spec->shutup = alc269_shutup;
15267 alc_init_jacks(codec);
15268 #ifdef CONFIG_SND_HDA_POWER_SAVE
15269 if (!spec->loopback.amplist)
15270 spec->loopback.amplist = alc269_loopbacks;
15271 if (alc269_mic2_for_mute_led(codec))
15272 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15279 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15283 * set the path ways for 2 channel output
15284 * need to set the codec line out and mic 1 pin widgets to inputs
15286 static const struct hda_verb alc861_threestack_ch2_init[] = {
15287 /* set pin widget 1Ah (line in) for input */
15288 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15289 /* set pin widget 18h (mic1/2) for input, for mic also enable
15292 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15294 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15296 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15297 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15303 * need to set the codec line out and mic 1 pin widgets to outputs
15305 static const struct hda_verb alc861_threestack_ch6_init[] = {
15306 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15307 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15308 /* set pin widget 18h (mic1) for output (CLFE)*/
15309 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15311 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15312 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15314 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15316 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15317 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15322 static const struct hda_channel_mode alc861_threestack_modes[2] = {
15323 { 2, alc861_threestack_ch2_init },
15324 { 6, alc861_threestack_ch6_init },
15326 /* Set mic1 as input and unmute the mixer */
15327 static const struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15328 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15329 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15332 /* Set mic1 as output and mute mixer */
15333 static const struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15334 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15335 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15339 static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15340 { 2, alc861_uniwill_m31_ch2_init },
15341 { 4, alc861_uniwill_m31_ch4_init },
15344 /* Set mic1 and line-in as input and unmute the mixer */
15345 static const struct hda_verb alc861_asus_ch2_init[] = {
15346 /* set pin widget 1Ah (line in) for input */
15347 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15348 /* set pin widget 18h (mic1/2) for input, for mic also enable
15351 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15353 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15355 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15356 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15360 /* Set mic1 nad line-in as output and mute mixer */
15361 static const struct hda_verb alc861_asus_ch6_init[] = {
15362 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15363 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15364 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15365 /* set pin widget 18h (mic1) for output (CLFE)*/
15366 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15367 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15368 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15369 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15371 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15373 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15374 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15379 static const struct hda_channel_mode alc861_asus_modes[2] = {
15380 { 2, alc861_asus_ch2_init },
15381 { 6, alc861_asus_ch6_init },
15386 static const struct snd_kcontrol_new alc861_base_mixer[] = {
15387 /* output mixer control */
15388 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15389 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15390 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15391 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15392 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15394 /*Input mixer control */
15395 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15396 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15397 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15398 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15399 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15400 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15402 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15403 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15409 static const struct snd_kcontrol_new alc861_3ST_mixer[] = {
15410 /* output mixer control */
15411 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15412 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15413 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15414 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15415 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15417 /* Input mixer control */
15418 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15419 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15420 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15421 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15422 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15423 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15425 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15426 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15431 .name = "Channel Mode",
15432 .info = alc_ch_mode_info,
15433 .get = alc_ch_mode_get,
15434 .put = alc_ch_mode_put,
15435 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15440 static const struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15441 /* output mixer control */
15442 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15444 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15449 static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15450 /* output mixer control */
15451 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15452 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15453 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15454 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15455 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15457 /* Input mixer control */
15458 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15459 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15460 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15461 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15462 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15463 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15464 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15465 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15466 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15467 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15471 .name = "Channel Mode",
15472 .info = alc_ch_mode_info,
15473 .get = alc_ch_mode_get,
15474 .put = alc_ch_mode_put,
15475 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15480 static const struct snd_kcontrol_new alc861_asus_mixer[] = {
15481 /* output mixer control */
15482 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15483 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15484 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15485 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15486 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15488 /* Input mixer control */
15489 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15490 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15491 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15492 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15493 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15494 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15496 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15497 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15501 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15502 .name = "Channel Mode",
15503 .info = alc_ch_mode_info,
15504 .get = alc_ch_mode_get,
15505 .put = alc_ch_mode_put,
15506 .private_value = ARRAY_SIZE(alc861_asus_modes),
15511 /* additional mixer */
15512 static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15513 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15514 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15519 * generic initialization of ADC, input mixers and output mixers
15521 static const struct hda_verb alc861_base_init_verbs[] = {
15523 * Unmute ADC0 and set the default input to mic-in
15525 /* port-A for surround (rear panel) */
15526 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15527 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15528 /* port-B for mic-in (rear panel) with vref */
15529 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15530 /* port-C for line-in (rear panel) */
15531 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15532 /* port-D for Front */
15533 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15534 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15535 /* port-E for HP out (front panel) */
15536 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15537 /* route front PCM to HP */
15538 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15539 /* port-F for mic-in (front panel) with vref */
15540 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15541 /* port-G for CLFE (rear panel) */
15542 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15543 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15544 /* port-H for side (rear panel) */
15545 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15546 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15548 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15549 /* route front mic to ADC1*/
15550 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15553 /* Unmute DAC0~3 & spdif out*/
15554 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15555 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15556 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15557 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15558 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15560 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15561 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15564 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15566 /* Unmute Stereo Mixer 15 */
15567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15569 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15570 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15572 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15573 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15574 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15575 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15576 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15577 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15578 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15579 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15580 /* hp used DAC 3 (Front) */
15581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15582 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15587 static const struct hda_verb alc861_threestack_init_verbs[] = {
15589 * Unmute ADC0 and set the default input to mic-in
15591 /* port-A for surround (rear panel) */
15592 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15593 /* port-B for mic-in (rear panel) with vref */
15594 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15595 /* port-C for line-in (rear panel) */
15596 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15597 /* port-D for Front */
15598 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15599 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15600 /* port-E for HP out (front panel) */
15601 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15602 /* route front PCM to HP */
15603 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15604 /* port-F for mic-in (front panel) with vref */
15605 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15606 /* port-G for CLFE (rear panel) */
15607 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15608 /* port-H for side (rear panel) */
15609 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15611 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15612 /* route front mic to ADC1*/
15613 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15615 /* Unmute DAC0~3 & spdif out*/
15616 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15617 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15618 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15619 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15622 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15623 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15624 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15625 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15626 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15628 /* Unmute Stereo Mixer 15 */
15629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15631 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15634 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15635 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15636 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15637 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15638 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15639 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15641 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15642 /* hp used DAC 3 (Front) */
15643 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15644 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15648 static const struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15650 * Unmute ADC0 and set the default input to mic-in
15652 /* port-A for surround (rear panel) */
15653 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15654 /* port-B for mic-in (rear panel) with vref */
15655 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15656 /* port-C for line-in (rear panel) */
15657 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15658 /* port-D for Front */
15659 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15660 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15661 /* port-E for HP out (front panel) */
15662 /* this has to be set to VREF80 */
15663 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15664 /* route front PCM to HP */
15665 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15666 /* port-F for mic-in (front panel) with vref */
15667 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15668 /* port-G for CLFE (rear panel) */
15669 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15670 /* port-H for side (rear panel) */
15671 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15673 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15674 /* route front mic to ADC1*/
15675 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15676 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15677 /* Unmute DAC0~3 & spdif out*/
15678 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15679 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15680 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15681 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15682 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15684 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15685 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15686 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15687 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15688 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15690 /* Unmute Stereo Mixer 15 */
15691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15693 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15696 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15697 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15698 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15699 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15700 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15701 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15703 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15704 /* hp used DAC 3 (Front) */
15705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15706 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15710 static const struct hda_verb alc861_asus_init_verbs[] = {
15712 * Unmute ADC0 and set the default input to mic-in
15714 /* port-A for surround (rear panel)
15715 * according to codec#0 this is the HP jack
15717 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15718 /* route front PCM to HP */
15719 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15720 /* port-B for mic-in (rear panel) with vref */
15721 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15722 /* port-C for line-in (rear panel) */
15723 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15724 /* port-D for Front */
15725 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15726 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15727 /* port-E for HP out (front panel) */
15728 /* this has to be set to VREF80 */
15729 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15730 /* route front PCM to HP */
15731 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15732 /* port-F for mic-in (front panel) with vref */
15733 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15734 /* port-G for CLFE (rear panel) */
15735 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15736 /* port-H for side (rear panel) */
15737 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15739 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15740 /* route front mic to ADC1*/
15741 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15742 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15743 /* Unmute DAC0~3 & spdif out*/
15744 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15745 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15746 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15747 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15749 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15750 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15751 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15752 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15753 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15755 /* Unmute Stereo Mixer 15 */
15756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15757 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15758 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15759 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15761 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15762 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15763 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15766 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15769 /* hp used DAC 3 (Front) */
15770 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15771 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15775 /* additional init verbs for ASUS laptops */
15776 static const struct hda_verb alc861_asus_laptop_init_verbs[] = {
15777 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15778 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15782 static const struct hda_verb alc861_toshiba_init_verbs[] = {
15783 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15788 /* toggle speaker-output according to the hp-jack state */
15789 static void alc861_toshiba_automute(struct hda_codec *codec)
15791 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15793 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15794 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15795 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15796 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15799 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15802 if ((res >> 26) == ALC880_HP_EVENT)
15803 alc861_toshiba_automute(codec);
15806 /* pcm configuration: identical with ALC880 */
15807 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15808 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15809 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15810 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15813 #define ALC861_DIGOUT_NID 0x07
15815 static const struct hda_channel_mode alc861_8ch_modes[1] = {
15819 static const hda_nid_t alc861_dac_nids[4] = {
15820 /* front, surround, clfe, side */
15821 0x03, 0x06, 0x05, 0x04
15824 static const hda_nid_t alc660_dac_nids[3] = {
15825 /* front, clfe, surround */
15829 static const hda_nid_t alc861_adc_nids[1] = {
15834 static const struct hda_input_mux alc861_capture_source = {
15838 { "Front Mic", 0x3 },
15845 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15847 struct alc_spec *spec = codec->spec;
15848 hda_nid_t mix, srcs[5];
15851 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15853 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15856 for (i = 0; i < num; i++) {
15858 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15859 if (type != AC_WID_AUD_OUT)
15861 if (!found_in_nid_list(srcs[i], spec->multiout.dac_nids,
15862 spec->multiout.num_dacs))
15868 /* fill in the dac_nids table from the parsed pin configuration */
15869 static int alc861_auto_fill_dac_nids(struct hda_codec *codec)
15871 struct alc_spec *spec = codec->spec;
15872 const struct auto_pin_cfg *cfg = &spec->autocfg;
15874 hda_nid_t nid, dac;
15876 spec->multiout.dac_nids = spec->private_dac_nids;
15877 for (i = 0; i < cfg->line_outs; i++) {
15878 nid = cfg->line_out_pins[i];
15879 dac = alc861_look_for_dac(codec, nid);
15882 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
15887 static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15888 hda_nid_t nid, int idx, unsigned int chs)
15890 return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
15891 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15894 #define alc861_create_out_sw(codec, pfx, nid, chs) \
15895 __alc861_create_out_sw(codec, pfx, nid, 0, chs)
15897 /* add playback controls from the parsed DAC table */
15898 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15899 const struct auto_pin_cfg *cfg)
15901 struct alc_spec *spec = codec->spec;
15903 int i, err, noutputs;
15905 noutputs = cfg->line_outs;
15906 if (spec->multi_ios > 0)
15907 noutputs += spec->multi_ios;
15909 for (i = 0; i < noutputs; i++) {
15912 nid = spec->multiout.dac_nids[i];
15915 name = alc_get_line_out_pfx(spec, i, true, &index);
15918 err = alc861_create_out_sw(codec, "Center", nid, 1);
15921 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15925 err = __alc861_create_out_sw(codec, name, nid, index, 3);
15933 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15935 struct alc_spec *spec = codec->spec;
15942 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15943 nid = alc861_look_for_dac(codec, pin);
15945 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15948 spec->multiout.hp_nid = nid;
15954 /* create playback/capture controls for input pins */
15955 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15956 const struct auto_pin_cfg *cfg)
15958 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15961 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15963 int pin_type, hda_nid_t dac)
15965 hda_nid_t mix, srcs[5];
15968 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15970 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15972 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15974 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15977 for (i = 0; i < num; i++) {
15979 if (srcs[i] == dac || srcs[i] == 0x15)
15980 mute = AMP_IN_UNMUTE(i);
15982 mute = AMP_IN_MUTE(i);
15983 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15988 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15990 struct alc_spec *spec = codec->spec;
15993 for (i = 0; i < spec->autocfg.line_outs + spec->multi_ios; i++) {
15994 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15995 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15997 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15998 spec->multiout.dac_nids[i]);
16002 static void alc861_auto_init_hp_out(struct hda_codec *codec)
16004 struct alc_spec *spec = codec->spec;
16006 if (spec->autocfg.hp_outs)
16007 alc861_auto_set_output_and_unmute(codec,
16008 spec->autocfg.hp_pins[0],
16010 spec->multiout.hp_nid);
16011 if (spec->autocfg.speaker_outs)
16012 alc861_auto_set_output_and_unmute(codec,
16013 spec->autocfg.speaker_pins[0],
16015 spec->multiout.dac_nids[0]);
16018 #define alc861_auto_init_analog_input alc880_auto_init_analog_input
16020 /* parse the BIOS configuration and set up the alc_spec */
16021 /* return 1 if successful, 0 if the proper config is not found,
16022 * or a negative error code
16024 static int alc861_parse_auto_config(struct hda_codec *codec)
16026 struct alc_spec *spec = codec->spec;
16028 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16030 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16034 if (!spec->autocfg.line_outs)
16035 return 0; /* can't find valid BIOS pin config */
16037 err = alc861_auto_fill_dac_nids(codec);
16040 err = alc_auto_add_multi_channel_mode(codec, alc861_auto_fill_dac_nids);
16043 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16046 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16049 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16053 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16055 alc_auto_parse_digital(codec);
16057 if (spec->kctls.list)
16058 add_mixer(spec, spec->kctls.list);
16060 spec->num_mux_defs = 1;
16061 spec->input_mux = &spec->private_imux[0];
16063 spec->adc_nids = alc861_adc_nids;
16064 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16065 set_capture_mixer(codec);
16067 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16072 /* additional initialization for auto-configuration model */
16073 static void alc861_auto_init(struct hda_codec *codec)
16075 struct alc_spec *spec = codec->spec;
16076 alc861_auto_init_multi_out(codec);
16077 alc861_auto_init_hp_out(codec);
16078 alc861_auto_init_analog_input(codec);
16079 alc_auto_init_digital(codec);
16080 if (spec->unsol_event)
16081 alc_inithook(codec);
16084 #ifdef CONFIG_SND_HDA_POWER_SAVE
16085 static const struct hda_amp_list alc861_loopbacks[] = {
16086 { 0x15, HDA_INPUT, 0 },
16087 { 0x15, HDA_INPUT, 1 },
16088 { 0x15, HDA_INPUT, 2 },
16089 { 0x15, HDA_INPUT, 3 },
16096 * configuration and preset
16098 static const char * const alc861_models[ALC861_MODEL_LAST] = {
16099 [ALC861_3ST] = "3stack",
16100 [ALC660_3ST] = "3stack-660",
16101 [ALC861_3ST_DIG] = "3stack-dig",
16102 [ALC861_6ST_DIG] = "6stack-dig",
16103 [ALC861_UNIWILL_M31] = "uniwill-m31",
16104 [ALC861_TOSHIBA] = "toshiba",
16105 [ALC861_ASUS] = "asus",
16106 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16107 [ALC861_AUTO] = "auto",
16110 static const struct snd_pci_quirk alc861_cfg_tbl[] = {
16111 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16112 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16113 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16114 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16115 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16116 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16117 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16118 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16119 * Any other models that need this preset?
16121 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16122 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16123 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16124 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16125 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16126 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16127 /* FIXME: the below seems conflict */
16128 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16129 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16130 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16134 static const struct alc_config_preset alc861_presets[] = {
16136 .mixers = { alc861_3ST_mixer },
16137 .init_verbs = { alc861_threestack_init_verbs },
16138 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16139 .dac_nids = alc861_dac_nids,
16140 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16141 .channel_mode = alc861_threestack_modes,
16143 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16144 .adc_nids = alc861_adc_nids,
16145 .input_mux = &alc861_capture_source,
16147 [ALC861_3ST_DIG] = {
16148 .mixers = { alc861_base_mixer },
16149 .init_verbs = { alc861_threestack_init_verbs },
16150 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16151 .dac_nids = alc861_dac_nids,
16152 .dig_out_nid = ALC861_DIGOUT_NID,
16153 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16154 .channel_mode = alc861_threestack_modes,
16156 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16157 .adc_nids = alc861_adc_nids,
16158 .input_mux = &alc861_capture_source,
16160 [ALC861_6ST_DIG] = {
16161 .mixers = { alc861_base_mixer },
16162 .init_verbs = { alc861_base_init_verbs },
16163 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16164 .dac_nids = alc861_dac_nids,
16165 .dig_out_nid = ALC861_DIGOUT_NID,
16166 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16167 .channel_mode = alc861_8ch_modes,
16168 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16169 .adc_nids = alc861_adc_nids,
16170 .input_mux = &alc861_capture_source,
16173 .mixers = { alc861_3ST_mixer },
16174 .init_verbs = { alc861_threestack_init_verbs },
16175 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16176 .dac_nids = alc660_dac_nids,
16177 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16178 .channel_mode = alc861_threestack_modes,
16180 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16181 .adc_nids = alc861_adc_nids,
16182 .input_mux = &alc861_capture_source,
16184 [ALC861_UNIWILL_M31] = {
16185 .mixers = { alc861_uniwill_m31_mixer },
16186 .init_verbs = { alc861_uniwill_m31_init_verbs },
16187 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16188 .dac_nids = alc861_dac_nids,
16189 .dig_out_nid = ALC861_DIGOUT_NID,
16190 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16191 .channel_mode = alc861_uniwill_m31_modes,
16193 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16194 .adc_nids = alc861_adc_nids,
16195 .input_mux = &alc861_capture_source,
16197 [ALC861_TOSHIBA] = {
16198 .mixers = { alc861_toshiba_mixer },
16199 .init_verbs = { alc861_base_init_verbs,
16200 alc861_toshiba_init_verbs },
16201 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16202 .dac_nids = alc861_dac_nids,
16203 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16204 .channel_mode = alc883_3ST_2ch_modes,
16205 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16206 .adc_nids = alc861_adc_nids,
16207 .input_mux = &alc861_capture_source,
16208 .unsol_event = alc861_toshiba_unsol_event,
16209 .init_hook = alc861_toshiba_automute,
16212 .mixers = { alc861_asus_mixer },
16213 .init_verbs = { alc861_asus_init_verbs },
16214 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16215 .dac_nids = alc861_dac_nids,
16216 .dig_out_nid = ALC861_DIGOUT_NID,
16217 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16218 .channel_mode = alc861_asus_modes,
16221 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16222 .adc_nids = alc861_adc_nids,
16223 .input_mux = &alc861_capture_source,
16225 [ALC861_ASUS_LAPTOP] = {
16226 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16227 .init_verbs = { alc861_asus_init_verbs,
16228 alc861_asus_laptop_init_verbs },
16229 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16230 .dac_nids = alc861_dac_nids,
16231 .dig_out_nid = ALC861_DIGOUT_NID,
16232 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16233 .channel_mode = alc883_3ST_2ch_modes,
16235 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16236 .adc_nids = alc861_adc_nids,
16237 .input_mux = &alc861_capture_source,
16241 /* Pin config fixes */
16243 PINFIX_FSC_AMILO_PI1505,
16246 static const struct alc_fixup alc861_fixups[] = {
16247 [PINFIX_FSC_AMILO_PI1505] = {
16248 .type = ALC_FIXUP_PINS,
16249 .v.pins = (const struct alc_pincfg[]) {
16250 { 0x0b, 0x0221101f }, /* HP */
16251 { 0x0f, 0x90170310 }, /* speaker */
16257 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
16258 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16262 static int patch_alc861(struct hda_codec *codec)
16264 struct alc_spec *spec;
16268 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16272 codec->spec = spec;
16274 spec->mixer_nid = 0x15;
16276 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16280 if (board_config < 0) {
16281 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16283 board_config = ALC861_AUTO;
16286 if (board_config == ALC861_AUTO) {
16287 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16288 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16291 if (board_config == ALC861_AUTO) {
16292 /* automatic parse from the BIOS config */
16293 err = alc861_parse_auto_config(codec);
16299 "hda_codec: Cannot set up configuration "
16300 "from BIOS. Using base mode...\n");
16301 board_config = ALC861_3ST_DIG;
16305 err = snd_hda_attach_beep_device(codec, 0x23);
16311 if (board_config != ALC861_AUTO)
16312 setup_preset(codec, &alc861_presets[board_config]);
16314 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16315 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16317 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16318 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16320 if (!spec->cap_mixer)
16321 set_capture_mixer(codec);
16322 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16324 spec->vmaster_nid = 0x03;
16326 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16328 codec->patch_ops = alc_patch_ops;
16329 if (board_config == ALC861_AUTO) {
16330 spec->init_hook = alc861_auto_init;
16331 #ifdef CONFIG_SND_HDA_POWER_SAVE
16332 spec->power_hook = alc_power_eapd;
16335 #ifdef CONFIG_SND_HDA_POWER_SAVE
16336 if (!spec->loopback.amplist)
16337 spec->loopback.amplist = alc861_loopbacks;
16344 * ALC861-VD support
16348 * In addition, an independent DAC
16350 #define ALC861VD_DIGOUT_NID 0x06
16352 static const hda_nid_t alc861vd_dac_nids[4] = {
16353 /* front, surr, clfe, side surr */
16354 0x02, 0x03, 0x04, 0x05
16357 /* dac_nids for ALC660vd are in a different order - according to
16358 * Realtek's driver.
16359 * This should probably result in a different mixer for 6stack models
16360 * of ALC660vd codecs, but for now there is only 3stack mixer
16361 * - and it is the same as in 861vd.
16362 * adc_nids in ALC660vd are (is) the same as in 861vd
16364 static const hda_nid_t alc660vd_dac_nids[3] = {
16365 /* front, rear, clfe, rear_surr */
16369 static const hda_nid_t alc861vd_adc_nids[1] = {
16374 static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16377 /* FIXME: should be a matrix-type input source selection */
16378 static const struct hda_input_mux alc861vd_capture_source = {
16382 { "Front Mic", 0x1 },
16388 static const struct hda_input_mux alc861vd_dallas_capture_source = {
16392 { "Internal Mic", 0x1 },
16396 static const struct hda_input_mux alc861vd_hp_capture_source = {
16399 { "Front Mic", 0x0 },
16400 { "ATAPI Mic", 0x1 },
16407 static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16414 static const struct hda_verb alc861vd_6stack_ch6_init[] = {
16415 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16416 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16417 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16418 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16425 static const struct hda_verb alc861vd_6stack_ch8_init[] = {
16426 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16427 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16428 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16429 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16433 static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
16434 { 6, alc861vd_6stack_ch6_init },
16435 { 8, alc861vd_6stack_ch8_init },
16438 static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16440 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16441 .name = "Channel Mode",
16442 .info = alc_ch_mode_info,
16443 .get = alc_ch_mode_get,
16444 .put = alc_ch_mode_put,
16449 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16450 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16452 static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16453 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16454 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16456 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16457 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16459 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16461 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16463 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16464 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16466 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16467 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16471 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16475 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16476 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16477 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16479 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16480 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16482 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16483 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16488 static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16489 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16494 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16495 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16498 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16499 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16500 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16502 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16503 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16505 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16506 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16511 static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16512 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16513 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16514 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16518 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16520 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16522 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
16523 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16526 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16527 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16532 /* Pin assignment: Speaker=0x14, HP = 0x15,
16533 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16535 static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16536 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16537 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16538 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16539 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16540 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
16541 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16543 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
16544 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16545 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16549 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16550 * Front Mic=0x18, ATAPI Mic = 0x19,
16552 static const struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16553 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16554 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16555 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16556 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16557 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16559 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16560 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16566 * generic initialization of ADC, input mixers and output mixers
16568 static const struct hda_verb alc861vd_volume_init_verbs[] = {
16570 * Unmute ADC0 and set the default input to mic-in
16572 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16575 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16576 * the analog-loopback mixer widget
16578 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16585 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16587 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16589 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16592 * Set up output mixers (0x02 - 0x05)
16594 /* set vol=0 to output mixers */
16595 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16596 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16597 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16598 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16600 /* set up input amps for analog loopback */
16601 /* Amp Indices: DAC = 0, mixer = 1 */
16602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16608 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16609 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16615 * 3-stack pin configuration:
16616 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16618 static const struct hda_verb alc861vd_3stack_init_verbs[] = {
16620 * Set pin mode and muting
16622 /* set front pin widgets 0x14 for output */
16623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16624 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16625 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16627 /* Mic (rear) pin: input vref at 80% */
16628 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16629 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16630 /* Front Mic pin: input vref at 80% */
16631 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16632 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16633 /* Line In pin: input */
16634 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16636 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16637 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16638 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16639 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16640 /* CD pin widget for input */
16641 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16647 * 6-stack pin configuration:
16649 static const struct hda_verb alc861vd_6stack_init_verbs[] = {
16651 * Set pin mode and muting
16653 /* set front pin widgets 0x14 for output */
16654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16655 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16656 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16658 /* Rear Pin: output 1 (0x0d) */
16659 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16661 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16662 /* CLFE Pin: output 2 (0x0e) */
16663 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16664 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16665 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16666 /* Side Pin: output 3 (0x0f) */
16667 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16668 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16669 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16671 /* Mic (rear) pin: input vref at 80% */
16672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16674 /* Front Mic pin: input vref at 80% */
16675 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16677 /* Line In pin: input */
16678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16680 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16683 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16684 /* CD pin widget for input */
16685 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16690 static const struct hda_verb alc861vd_eapd_verbs[] = {
16691 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16695 static const struct hda_verb alc660vd_eapd_verbs[] = {
16696 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16697 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16701 static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16703 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16705 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16706 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16710 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16712 struct alc_spec *spec = codec->spec;
16713 spec->autocfg.hp_pins[0] = 0x1b;
16714 spec->autocfg.speaker_pins[0] = 0x14;
16715 spec->automute = 1;
16716 spec->automute_mode = ALC_AUTOMUTE_AMP;
16719 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16721 alc_hp_automute(codec);
16722 alc88x_simple_mic_automute(codec);
16725 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16728 switch (res >> 26) {
16729 case ALC880_MIC_EVENT:
16730 alc88x_simple_mic_automute(codec);
16733 alc_sku_unsol_event(codec, res);
16738 static const struct hda_verb alc861vd_dallas_verbs[] = {
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 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16759 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16760 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16769 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16776 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16777 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16778 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16783 /* toggle speaker-output according to the hp-jack state */
16784 static void alc861vd_dallas_setup(struct hda_codec *codec)
16786 struct alc_spec *spec = codec->spec;
16788 spec->autocfg.hp_pins[0] = 0x15;
16789 spec->autocfg.speaker_pins[0] = 0x14;
16790 spec->automute = 1;
16791 spec->automute_mode = ALC_AUTOMUTE_AMP;
16794 #ifdef CONFIG_SND_HDA_POWER_SAVE
16795 #define alc861vd_loopbacks alc880_loopbacks
16798 /* pcm configuration: identical with ALC880 */
16799 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16800 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16801 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16802 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16805 * configuration and preset
16807 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16808 [ALC660VD_3ST] = "3stack-660",
16809 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16810 [ALC660VD_ASUS_V1S] = "asus-v1s",
16811 [ALC861VD_3ST] = "3stack",
16812 [ALC861VD_3ST_DIG] = "3stack-digout",
16813 [ALC861VD_6ST_DIG] = "6stack-digout",
16814 [ALC861VD_LENOVO] = "lenovo",
16815 [ALC861VD_DALLAS] = "dallas",
16816 [ALC861VD_HP] = "hp",
16817 [ALC861VD_AUTO] = "auto",
16820 static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16821 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16822 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16823 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16824 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16825 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16826 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16827 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16828 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16829 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16830 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16831 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16832 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16833 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16834 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16835 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16839 static const struct alc_config_preset alc861vd_presets[] = {
16841 .mixers = { alc861vd_3st_mixer },
16842 .init_verbs = { alc861vd_volume_init_verbs,
16843 alc861vd_3stack_init_verbs },
16844 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16845 .dac_nids = alc660vd_dac_nids,
16846 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16847 .channel_mode = alc861vd_3stack_2ch_modes,
16848 .input_mux = &alc861vd_capture_source,
16850 [ALC660VD_3ST_DIG] = {
16851 .mixers = { alc861vd_3st_mixer },
16852 .init_verbs = { alc861vd_volume_init_verbs,
16853 alc861vd_3stack_init_verbs },
16854 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16855 .dac_nids = alc660vd_dac_nids,
16856 .dig_out_nid = ALC861VD_DIGOUT_NID,
16857 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16858 .channel_mode = alc861vd_3stack_2ch_modes,
16859 .input_mux = &alc861vd_capture_source,
16862 .mixers = { alc861vd_3st_mixer },
16863 .init_verbs = { alc861vd_volume_init_verbs,
16864 alc861vd_3stack_init_verbs },
16865 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16866 .dac_nids = alc861vd_dac_nids,
16867 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16868 .channel_mode = alc861vd_3stack_2ch_modes,
16869 .input_mux = &alc861vd_capture_source,
16871 [ALC861VD_3ST_DIG] = {
16872 .mixers = { alc861vd_3st_mixer },
16873 .init_verbs = { alc861vd_volume_init_verbs,
16874 alc861vd_3stack_init_verbs },
16875 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16876 .dac_nids = alc861vd_dac_nids,
16877 .dig_out_nid = ALC861VD_DIGOUT_NID,
16878 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16879 .channel_mode = alc861vd_3stack_2ch_modes,
16880 .input_mux = &alc861vd_capture_source,
16882 [ALC861VD_6ST_DIG] = {
16883 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16884 .init_verbs = { alc861vd_volume_init_verbs,
16885 alc861vd_6stack_init_verbs },
16886 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16887 .dac_nids = alc861vd_dac_nids,
16888 .dig_out_nid = ALC861VD_DIGOUT_NID,
16889 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16890 .channel_mode = alc861vd_6stack_modes,
16891 .input_mux = &alc861vd_capture_source,
16893 [ALC861VD_LENOVO] = {
16894 .mixers = { alc861vd_lenovo_mixer },
16895 .init_verbs = { alc861vd_volume_init_verbs,
16896 alc861vd_3stack_init_verbs,
16897 alc861vd_eapd_verbs,
16898 alc861vd_lenovo_unsol_verbs },
16899 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16900 .dac_nids = alc660vd_dac_nids,
16901 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16902 .channel_mode = alc861vd_3stack_2ch_modes,
16903 .input_mux = &alc861vd_capture_source,
16904 .unsol_event = alc861vd_lenovo_unsol_event,
16905 .setup = alc861vd_lenovo_setup,
16906 .init_hook = alc861vd_lenovo_init_hook,
16908 [ALC861VD_DALLAS] = {
16909 .mixers = { alc861vd_dallas_mixer },
16910 .init_verbs = { alc861vd_dallas_verbs },
16911 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16912 .dac_nids = alc861vd_dac_nids,
16913 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16914 .channel_mode = alc861vd_3stack_2ch_modes,
16915 .input_mux = &alc861vd_dallas_capture_source,
16916 .unsol_event = alc_sku_unsol_event,
16917 .setup = alc861vd_dallas_setup,
16918 .init_hook = alc_hp_automute,
16921 .mixers = { alc861vd_hp_mixer },
16922 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16923 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16924 .dac_nids = alc861vd_dac_nids,
16925 .dig_out_nid = ALC861VD_DIGOUT_NID,
16926 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16927 .channel_mode = alc861vd_3stack_2ch_modes,
16928 .input_mux = &alc861vd_hp_capture_source,
16929 .unsol_event = alc_sku_unsol_event,
16930 .setup = alc861vd_dallas_setup,
16931 .init_hook = alc_hp_automute,
16933 [ALC660VD_ASUS_V1S] = {
16934 .mixers = { alc861vd_lenovo_mixer },
16935 .init_verbs = { alc861vd_volume_init_verbs,
16936 alc861vd_3stack_init_verbs,
16937 alc861vd_eapd_verbs,
16938 alc861vd_lenovo_unsol_verbs },
16939 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16940 .dac_nids = alc660vd_dac_nids,
16941 .dig_out_nid = ALC861VD_DIGOUT_NID,
16942 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16943 .channel_mode = alc861vd_3stack_2ch_modes,
16944 .input_mux = &alc861vd_capture_source,
16945 .unsol_event = alc861vd_lenovo_unsol_event,
16946 .setup = alc861vd_lenovo_setup,
16947 .init_hook = alc861vd_lenovo_init_hook,
16952 * BIOS auto configuration
16954 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16955 const struct auto_pin_cfg *cfg)
16957 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
16961 #define alc861vd_auto_init_multi_out alc882_auto_init_multi_out
16962 #define alc861vd_auto_init_hp_out alc882_auto_init_hp_out
16963 #define alc861vd_auto_init_analog_input alc882_auto_init_analog_input
16964 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16966 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16967 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16969 /* add playback controls from the parsed DAC table */
16970 /* Based on ALC880 version. But ALC861VD has separate,
16971 * different NIDs for mute/unmute switch and volume control */
16972 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16973 const struct auto_pin_cfg *cfg)
16975 hda_nid_t nid_v, nid_s;
16976 int i, err, noutputs;
16978 noutputs = cfg->line_outs;
16979 if (spec->multi_ios > 0)
16980 noutputs += spec->multi_ios;
16982 for (i = 0; i < noutputs; i++) {
16985 if (!spec->multiout.dac_nids[i])
16987 nid_v = alc861vd_idx_to_mixer_vol(
16989 spec->multiout.dac_nids[i]));
16990 nid_s = alc861vd_idx_to_mixer_switch(
16992 spec->multiout.dac_nids[i]));
16994 name = alc_get_line_out_pfx(spec, i, true, &index);
16997 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16999 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17003 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17005 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17009 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17011 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17015 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17017 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17022 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17024 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17028 err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17030 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17039 /* add playback controls for speaker and HP outputs */
17040 /* Based on ALC880 version. But ALC861VD has separate,
17041 * different NIDs for mute/unmute switch and volume control */
17042 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17043 hda_nid_t pin, const char *pfx)
17045 hda_nid_t nid_v, nid_s;
17051 if (alc880_is_fixed_pin(pin)) {
17052 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17053 /* specify the DAC as the extra output */
17054 if (!spec->multiout.hp_nid)
17055 spec->multiout.hp_nid = nid_v;
17057 spec->multiout.extra_out_nid[0] = nid_v;
17058 /* control HP volume/switch on the output mixer amp */
17059 nid_v = alc861vd_idx_to_mixer_vol(
17060 alc880_fixed_pin_idx(pin));
17061 nid_s = alc861vd_idx_to_mixer_switch(
17062 alc880_fixed_pin_idx(pin));
17064 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17065 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17068 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17069 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17072 } else if (alc880_is_multi_pin(pin)) {
17073 /* set manual connection */
17074 /* we have only a switch on HP-out PIN */
17075 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17076 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17083 /* parse the BIOS configuration and set up the alc_spec
17084 * return 1 if successful, 0 if the proper config is not found,
17085 * or a negative error code
17086 * Based on ALC880 version - had to change it to override
17087 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17088 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17090 struct alc_spec *spec = codec->spec;
17092 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17094 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17098 if (!spec->autocfg.line_outs)
17099 return 0; /* can't find valid BIOS pin config */
17101 err = alc880_auto_fill_dac_nids(codec);
17104 err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids);
17107 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17110 err = alc861vd_auto_create_extra_out(spec,
17111 spec->autocfg.speaker_pins[0],
17115 err = alc861vd_auto_create_extra_out(spec,
17116 spec->autocfg.hp_pins[0],
17120 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17124 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17126 alc_auto_parse_digital(codec);
17128 if (spec->kctls.list)
17129 add_mixer(spec, spec->kctls.list);
17131 spec->num_mux_defs = 1;
17132 spec->input_mux = &spec->private_imux[0];
17134 err = alc_auto_add_mic_boost(codec);
17138 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17143 /* additional initialization for auto-configuration model */
17144 static void alc861vd_auto_init(struct hda_codec *codec)
17146 struct alc_spec *spec = codec->spec;
17147 alc861vd_auto_init_multi_out(codec);
17148 alc861vd_auto_init_hp_out(codec);
17149 alc861vd_auto_init_analog_input(codec);
17150 alc861vd_auto_init_input_src(codec);
17151 alc_auto_init_digital(codec);
17152 if (spec->unsol_event)
17153 alc_inithook(codec);
17157 ALC660VD_FIX_ASUS_GPIO1
17161 static const struct alc_fixup alc861vd_fixups[] = {
17162 [ALC660VD_FIX_ASUS_GPIO1] = {
17163 .type = ALC_FIXUP_VERBS,
17164 .v.verbs = (const struct hda_verb[]) {
17165 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17166 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17167 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17173 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17174 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17178 static int patch_alc861vd(struct hda_codec *codec)
17180 struct alc_spec *spec;
17181 int err, board_config;
17183 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17187 codec->spec = spec;
17189 spec->mixer_nid = 0x0b;
17191 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17195 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17196 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17198 board_config = ALC861VD_AUTO;
17201 if (board_config == ALC861VD_AUTO) {
17202 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17203 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17206 if (board_config == ALC861VD_AUTO) {
17207 /* automatic parse from the BIOS config */
17208 err = alc861vd_parse_auto_config(codec);
17214 "hda_codec: Cannot set up configuration "
17215 "from BIOS. Using base mode...\n");
17216 board_config = ALC861VD_3ST;
17220 err = snd_hda_attach_beep_device(codec, 0x23);
17226 if (board_config != ALC861VD_AUTO)
17227 setup_preset(codec, &alc861vd_presets[board_config]);
17229 if (codec->vendor_id == 0x10ec0660) {
17230 /* always turn on EAPD */
17231 add_verb(spec, alc660vd_eapd_verbs);
17234 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17235 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17237 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17238 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17240 if (!spec->adc_nids) {
17241 spec->adc_nids = alc861vd_adc_nids;
17242 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17244 if (!spec->capsrc_nids)
17245 spec->capsrc_nids = alc861vd_capsrc_nids;
17247 set_capture_mixer(codec);
17248 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17250 spec->vmaster_nid = 0x02;
17252 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17254 codec->patch_ops = alc_patch_ops;
17256 if (board_config == ALC861VD_AUTO)
17257 spec->init_hook = alc861vd_auto_init;
17258 spec->shutup = alc_eapd_shutup;
17259 #ifdef CONFIG_SND_HDA_POWER_SAVE
17260 if (!spec->loopback.amplist)
17261 spec->loopback.amplist = alc861vd_loopbacks;
17270 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17271 * configuration. Each pin widget can choose any input DACs and a mixer.
17272 * Each ADC is connected from a mixer of all inputs. This makes possible
17273 * 6-channel independent captures.
17275 * In addition, an independent DAC for the multi-playback (not used in this
17278 #define ALC662_DIGOUT_NID 0x06
17279 #define ALC662_DIGIN_NID 0x0a
17281 static const hda_nid_t alc662_dac_nids[3] = {
17282 /* front, rear, clfe */
17286 static const hda_nid_t alc272_dac_nids[2] = {
17290 static const hda_nid_t alc662_adc_nids[2] = {
17295 static const hda_nid_t alc272_adc_nids[1] = {
17300 static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17301 static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17305 /* FIXME: should be a matrix-type input source selection */
17306 static const struct hda_input_mux alc662_capture_source = {
17310 { "Front Mic", 0x1 },
17316 static const struct hda_input_mux alc662_lenovo_101e_capture_source = {
17324 static const struct hda_input_mux alc663_capture_source = {
17328 { "Front Mic", 0x1 },
17333 #if 0 /* set to 1 for testing other input sources below */
17334 static const struct hda_input_mux alc272_nc10_capture_source = {
17337 { "Autoselect Mic", 0x0 },
17338 { "Internal Mic", 0x1 },
17339 { "In-0x02", 0x2 },
17340 { "In-0x03", 0x3 },
17341 { "In-0x04", 0x4 },
17342 { "In-0x05", 0x5 },
17343 { "In-0x06", 0x6 },
17344 { "In-0x07", 0x7 },
17345 { "In-0x08", 0x8 },
17346 { "In-0x09", 0x9 },
17347 { "In-0x0a", 0x0a },
17348 { "In-0x0b", 0x0b },
17349 { "In-0x0c", 0x0c },
17350 { "In-0x0d", 0x0d },
17351 { "In-0x0e", 0x0e },
17352 { "In-0x0f", 0x0f },
17360 static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17367 static const struct hda_verb alc662_3ST_ch2_init[] = {
17368 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17369 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17370 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17371 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17378 static const struct hda_verb alc662_3ST_ch6_init[] = {
17379 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17380 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17381 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17382 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17383 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17384 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17388 static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17389 { 2, alc662_3ST_ch2_init },
17390 { 6, alc662_3ST_ch6_init },
17396 static const struct hda_verb alc662_sixstack_ch6_init[] = {
17397 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17398 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17399 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17406 static const struct hda_verb alc662_sixstack_ch8_init[] = {
17407 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17408 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17409 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17413 static const struct hda_channel_mode alc662_5stack_modes[2] = {
17414 { 2, alc662_sixstack_ch6_init },
17415 { 6, alc662_sixstack_ch8_init },
17418 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17419 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17422 static const struct snd_kcontrol_new alc662_base_mixer[] = {
17423 /* output mixer control */
17424 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17425 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17426 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17427 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17428 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17429 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17430 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17431 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17434 /*Input mixer control */
17435 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17436 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17437 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17438 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17439 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17440 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17441 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17442 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17446 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17447 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17448 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17450 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17451 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17452 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17453 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17456 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17457 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17461 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17462 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17463 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17464 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17465 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17466 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17467 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17468 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17469 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17470 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17471 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17472 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17475 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17476 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17477 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17478 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17482 static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17483 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17484 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17485 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17486 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17487 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17495 static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17496 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17497 ALC262_HIPPO_MASTER_SWITCH,
17499 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
17500 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17501 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17503 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
17504 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17505 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17509 static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17510 ALC262_HIPPO_MASTER_SWITCH,
17511 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17512 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17513 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17514 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17515 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17516 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17517 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17523 static const struct hda_bind_ctls alc663_asus_bind_master_vol = {
17524 .ops = &snd_hda_bind_vol,
17526 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17527 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17532 static const struct hda_bind_ctls alc663_asus_one_bind_switch = {
17533 .ops = &snd_hda_bind_sw,
17535 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17536 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17541 static const struct snd_kcontrol_new alc663_m51va_mixer[] = {
17542 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17543 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17544 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17545 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17549 static const struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17550 .ops = &snd_hda_bind_sw,
17552 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17553 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17554 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17559 static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17560 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17561 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17562 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17563 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17564 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17565 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17570 static const struct hda_bind_ctls alc663_asus_four_bind_switch = {
17571 .ops = &snd_hda_bind_sw,
17573 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17574 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17575 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17580 static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17581 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17582 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17585 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17586 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17590 static const struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17591 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17592 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17596 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17597 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17601 static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17602 .ops = &snd_hda_bind_vol,
17604 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17605 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17610 static const struct hda_bind_ctls alc663_asus_two_bind_switch = {
17611 .ops = &snd_hda_bind_sw,
17613 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17614 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17619 static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17620 HDA_BIND_VOL("Master Playback Volume",
17621 &alc663_asus_two_bind_master_vol),
17622 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17623 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17624 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17625 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17626 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17630 static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17631 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17632 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17633 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17640 static const struct snd_kcontrol_new alc663_g71v_mixer[] = {
17641 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17642 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17643 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17644 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17645 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17648 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17649 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17650 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17654 static const struct snd_kcontrol_new alc663_g50v_mixer[] = {
17655 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17656 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17657 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17660 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17661 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17662 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17663 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17664 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17668 static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17669 .ops = &snd_hda_bind_sw,
17671 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17672 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17673 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17674 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17675 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17680 static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17681 .ops = &snd_hda_bind_sw,
17683 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17684 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17689 static const struct snd_kcontrol_new alc663_mode7_mixer[] = {
17690 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17691 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17692 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17693 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17694 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17695 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17696 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17698 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17702 static const struct snd_kcontrol_new alc663_mode8_mixer[] = {
17703 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17704 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17705 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17706 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17707 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17708 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17714 static const struct snd_kcontrol_new alc662_chmode_mixer[] = {
17716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17717 .name = "Channel Mode",
17718 .info = alc_ch_mode_info,
17719 .get = alc_ch_mode_get,
17720 .put = alc_ch_mode_put,
17725 static const struct hda_verb alc662_init_verbs[] = {
17726 /* ADC: mute amp left and right */
17727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17728 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17730 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17731 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17732 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17733 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17734 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17735 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17737 /* Front Pin: output 0 (0x0c) */
17738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17741 /* Rear Pin: output 1 (0x0d) */
17742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17745 /* CLFE Pin: output 2 (0x0e) */
17746 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17749 /* Mic (rear) pin: input vref at 80% */
17750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17752 /* Front Mic pin: input vref at 80% */
17753 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17754 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17755 /* Line In pin: input */
17756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17758 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17759 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17761 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17762 /* CD pin widget for input */
17763 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17765 /* FIXME: use matrix-type input source selection */
17766 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17769 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17774 static const struct hda_verb alc662_eapd_init_verbs[] = {
17775 /* always trun on EAPD */
17776 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17777 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17781 static const struct hda_verb alc662_sue_init_verbs[] = {
17782 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17783 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17787 static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17788 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17789 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17793 /* Set Unsolicited Event*/
17794 static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17795 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17800 static const struct hda_verb alc663_m51va_init_verbs[] = {
17801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17803 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17804 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17805 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17806 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17807 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17808 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17809 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17813 static const struct hda_verb alc663_21jd_amic_init_verbs[] = {
17814 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17815 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17816 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17819 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17820 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17824 static const struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17825 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17827 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17828 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17831 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17832 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17836 static const struct hda_verb alc663_15jd_amic_init_verbs[] = {
17837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17842 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17843 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17847 static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17848 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17849 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17850 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17851 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17854 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17858 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17859 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17863 static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17864 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17866 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17867 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17870 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17873 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17874 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17875 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17879 static const struct hda_verb alc663_g71v_init_verbs[] = {
17880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17881 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17882 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17884 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17885 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17886 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17888 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17889 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17890 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17894 static const struct hda_verb alc663_g50v_init_verbs[] = {
17895 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17896 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17897 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17899 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17900 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17904 static const struct hda_verb alc662_ecs_init_verbs[] = {
17905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17907 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17908 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17912 static const struct hda_verb alc272_dell_zm1_init_verbs[] = {
17913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17914 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17916 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17917 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17918 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17919 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17920 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17922 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17923 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17927 static const struct hda_verb alc272_dell_init_verbs[] = {
17928 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17929 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17932 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17933 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17934 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17935 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17937 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17938 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17942 static const struct hda_verb alc663_mode7_init_verbs[] = {
17943 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17946 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17947 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17949 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17950 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17951 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17952 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17955 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17956 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17957 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17961 static const struct hda_verb alc663_mode8_init_verbs[] = {
17962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17967 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17968 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17969 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17970 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17971 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17972 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17974 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17976 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17977 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17981 static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17982 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17983 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17987 static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17988 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17989 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17993 static void alc662_lenovo_101e_setup(struct hda_codec *codec)
17995 struct alc_spec *spec = codec->spec;
17997 spec->autocfg.hp_pins[0] = 0x1b;
17998 spec->autocfg.line_out_pins[0] = 0x14;
17999 spec->autocfg.speaker_pins[0] = 0x15;
18000 spec->automute = 1;
18001 spec->detect_line = 1;
18002 spec->automute_lines = 1;
18003 spec->automute_mode = ALC_AUTOMUTE_AMP;
18006 static void alc662_eeepc_setup(struct hda_codec *codec)
18008 struct alc_spec *spec = codec->spec;
18010 alc262_hippo1_setup(codec);
18011 spec->ext_mic.pin = 0x18;
18012 spec->ext_mic.mux_idx = 0;
18013 spec->int_mic.pin = 0x19;
18014 spec->int_mic.mux_idx = 1;
18015 spec->auto_mic = 1;
18018 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18020 struct alc_spec *spec = codec->spec;
18022 spec->autocfg.hp_pins[0] = 0x14;
18023 spec->autocfg.speaker_pins[0] = 0x1b;
18024 spec->automute = 1;
18025 spec->automute_mode = ALC_AUTOMUTE_AMP;
18028 static void alc663_m51va_setup(struct hda_codec *codec)
18030 struct alc_spec *spec = codec->spec;
18031 spec->autocfg.hp_pins[0] = 0x21;
18032 spec->autocfg.speaker_pins[0] = 0x14;
18033 spec->automute_mixer_nid[0] = 0x0c;
18034 spec->automute = 1;
18035 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18036 spec->ext_mic.pin = 0x18;
18037 spec->ext_mic.mux_idx = 0;
18038 spec->int_mic.pin = 0x12;
18039 spec->int_mic.mux_idx = 9;
18040 spec->auto_mic = 1;
18043 /* ***************** Mode1 ******************************/
18044 static void alc663_mode1_setup(struct hda_codec *codec)
18046 struct alc_spec *spec = codec->spec;
18047 spec->autocfg.hp_pins[0] = 0x21;
18048 spec->autocfg.speaker_pins[0] = 0x14;
18049 spec->automute_mixer_nid[0] = 0x0c;
18050 spec->automute = 1;
18051 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18052 spec->ext_mic.pin = 0x18;
18053 spec->ext_mic.mux_idx = 0;
18054 spec->int_mic.pin = 0x19;
18055 spec->int_mic.mux_idx = 1;
18056 spec->auto_mic = 1;
18059 /* ***************** Mode2 ******************************/
18060 static void alc662_mode2_setup(struct hda_codec *codec)
18062 struct alc_spec *spec = codec->spec;
18063 spec->autocfg.hp_pins[0] = 0x1b;
18064 spec->autocfg.speaker_pins[0] = 0x14;
18065 spec->automute = 1;
18066 spec->automute_mode = ALC_AUTOMUTE_PIN;
18067 spec->ext_mic.pin = 0x18;
18068 spec->ext_mic.mux_idx = 0;
18069 spec->int_mic.pin = 0x19;
18070 spec->int_mic.mux_idx = 1;
18071 spec->auto_mic = 1;
18074 /* ***************** Mode3 ******************************/
18075 static void alc663_mode3_setup(struct hda_codec *codec)
18077 struct alc_spec *spec = codec->spec;
18078 spec->autocfg.hp_pins[0] = 0x21;
18079 spec->autocfg.hp_pins[0] = 0x15;
18080 spec->autocfg.speaker_pins[0] = 0x14;
18081 spec->automute = 1;
18082 spec->automute_mode = ALC_AUTOMUTE_PIN;
18083 spec->ext_mic.pin = 0x18;
18084 spec->ext_mic.mux_idx = 0;
18085 spec->int_mic.pin = 0x19;
18086 spec->int_mic.mux_idx = 1;
18087 spec->auto_mic = 1;
18090 /* ***************** Mode4 ******************************/
18091 static void alc663_mode4_setup(struct hda_codec *codec)
18093 struct alc_spec *spec = codec->spec;
18094 spec->autocfg.hp_pins[0] = 0x21;
18095 spec->autocfg.speaker_pins[0] = 0x14;
18096 spec->autocfg.speaker_pins[1] = 0x16;
18097 spec->automute_mixer_nid[0] = 0x0c;
18098 spec->automute_mixer_nid[1] = 0x0e;
18099 spec->automute = 1;
18100 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18101 spec->ext_mic.pin = 0x18;
18102 spec->ext_mic.mux_idx = 0;
18103 spec->int_mic.pin = 0x19;
18104 spec->int_mic.mux_idx = 1;
18105 spec->auto_mic = 1;
18108 /* ***************** Mode5 ******************************/
18109 static void alc663_mode5_setup(struct hda_codec *codec)
18111 struct alc_spec *spec = codec->spec;
18112 spec->autocfg.hp_pins[0] = 0x15;
18113 spec->autocfg.speaker_pins[0] = 0x14;
18114 spec->autocfg.speaker_pins[1] = 0x16;
18115 spec->automute_mixer_nid[0] = 0x0c;
18116 spec->automute_mixer_nid[1] = 0x0e;
18117 spec->automute = 1;
18118 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18119 spec->ext_mic.pin = 0x18;
18120 spec->ext_mic.mux_idx = 0;
18121 spec->int_mic.pin = 0x19;
18122 spec->int_mic.mux_idx = 1;
18123 spec->auto_mic = 1;
18126 /* ***************** Mode6 ******************************/
18127 static void alc663_mode6_setup(struct hda_codec *codec)
18129 struct alc_spec *spec = codec->spec;
18130 spec->autocfg.hp_pins[0] = 0x1b;
18131 spec->autocfg.hp_pins[0] = 0x15;
18132 spec->autocfg.speaker_pins[0] = 0x14;
18133 spec->automute_mixer_nid[0] = 0x0c;
18134 spec->automute = 1;
18135 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18136 spec->ext_mic.pin = 0x18;
18137 spec->ext_mic.mux_idx = 0;
18138 spec->int_mic.pin = 0x19;
18139 spec->int_mic.mux_idx = 1;
18140 spec->auto_mic = 1;
18143 /* ***************** Mode7 ******************************/
18144 static void alc663_mode7_setup(struct hda_codec *codec)
18146 struct alc_spec *spec = codec->spec;
18147 spec->autocfg.hp_pins[0] = 0x1b;
18148 spec->autocfg.hp_pins[0] = 0x21;
18149 spec->autocfg.speaker_pins[0] = 0x14;
18150 spec->autocfg.speaker_pins[0] = 0x17;
18151 spec->automute = 1;
18152 spec->automute_mode = ALC_AUTOMUTE_PIN;
18153 spec->ext_mic.pin = 0x18;
18154 spec->ext_mic.mux_idx = 0;
18155 spec->int_mic.pin = 0x19;
18156 spec->int_mic.mux_idx = 1;
18157 spec->auto_mic = 1;
18160 /* ***************** Mode8 ******************************/
18161 static void alc663_mode8_setup(struct hda_codec *codec)
18163 struct alc_spec *spec = codec->spec;
18164 spec->autocfg.hp_pins[0] = 0x21;
18165 spec->autocfg.hp_pins[1] = 0x15;
18166 spec->autocfg.speaker_pins[0] = 0x14;
18167 spec->autocfg.speaker_pins[0] = 0x17;
18168 spec->automute = 1;
18169 spec->automute_mode = ALC_AUTOMUTE_PIN;
18170 spec->ext_mic.pin = 0x18;
18171 spec->ext_mic.mux_idx = 0;
18172 spec->int_mic.pin = 0x12;
18173 spec->int_mic.mux_idx = 9;
18174 spec->auto_mic = 1;
18177 static void alc663_g71v_setup(struct hda_codec *codec)
18179 struct alc_spec *spec = codec->spec;
18180 spec->autocfg.hp_pins[0] = 0x21;
18181 spec->autocfg.line_out_pins[0] = 0x15;
18182 spec->autocfg.speaker_pins[0] = 0x14;
18183 spec->automute = 1;
18184 spec->automute_mode = ALC_AUTOMUTE_AMP;
18185 spec->detect_line = 1;
18186 spec->automute_lines = 1;
18187 spec->ext_mic.pin = 0x18;
18188 spec->ext_mic.mux_idx = 0;
18189 spec->int_mic.pin = 0x12;
18190 spec->int_mic.mux_idx = 9;
18191 spec->auto_mic = 1;
18194 #define alc663_g50v_setup alc663_m51va_setup
18196 static const struct snd_kcontrol_new alc662_ecs_mixer[] = {
18197 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18198 ALC262_HIPPO_MASTER_SWITCH,
18200 HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT),
18201 HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18202 HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18204 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18205 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18206 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18210 static const struct snd_kcontrol_new alc272_nc10_mixer[] = {
18211 /* Master Playback automatically created from Speaker and Headphone */
18212 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18213 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18214 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18215 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18219 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
18221 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18222 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18223 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
18227 #ifdef CONFIG_SND_HDA_POWER_SAVE
18228 #define alc662_loopbacks alc880_loopbacks
18232 /* pcm configuration: identical with ALC880 */
18233 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18234 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18235 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18236 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18239 * configuration and preset
18241 static const char * const alc662_models[ALC662_MODEL_LAST] = {
18242 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18243 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18244 [ALC662_3ST_6ch] = "3stack-6ch",
18245 [ALC662_5ST_DIG] = "5stack-dig",
18246 [ALC662_LENOVO_101E] = "lenovo-101e",
18247 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18248 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18249 [ALC662_ECS] = "ecs",
18250 [ALC663_ASUS_M51VA] = "m51va",
18251 [ALC663_ASUS_G71V] = "g71v",
18252 [ALC663_ASUS_H13] = "h13",
18253 [ALC663_ASUS_G50V] = "g50v",
18254 [ALC663_ASUS_MODE1] = "asus-mode1",
18255 [ALC662_ASUS_MODE2] = "asus-mode2",
18256 [ALC663_ASUS_MODE3] = "asus-mode3",
18257 [ALC663_ASUS_MODE4] = "asus-mode4",
18258 [ALC663_ASUS_MODE5] = "asus-mode5",
18259 [ALC663_ASUS_MODE6] = "asus-mode6",
18260 [ALC663_ASUS_MODE7] = "asus-mode7",
18261 [ALC663_ASUS_MODE8] = "asus-mode8",
18262 [ALC272_DELL] = "dell",
18263 [ALC272_DELL_ZM1] = "dell-zm1",
18264 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18265 [ALC662_AUTO] = "auto",
18268 static const struct snd_pci_quirk alc662_cfg_tbl[] = {
18269 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18270 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18271 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18272 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18273 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18274 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18275 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18276 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18277 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18278 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18279 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18280 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18281 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18282 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18283 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18284 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18285 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18286 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18287 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18288 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18289 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18290 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18291 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18292 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18293 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18294 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18295 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18296 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18297 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18298 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18299 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18300 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18301 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18302 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18303 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18304 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18305 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18306 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18307 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18308 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18309 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18310 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18311 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18312 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18313 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18314 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18315 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18316 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18317 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18318 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18319 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18320 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18321 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18322 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18323 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18324 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18325 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18326 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18327 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18328 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18329 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18330 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18331 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18332 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18333 ALC662_3ST_6ch_DIG),
18334 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18335 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18336 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18337 ALC662_3ST_6ch_DIG),
18338 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18339 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18340 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18341 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18342 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18343 ALC662_3ST_6ch_DIG),
18344 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18346 SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E),
18350 static const struct alc_config_preset alc662_presets[] = {
18351 [ALC662_3ST_2ch_DIG] = {
18352 .mixers = { alc662_3ST_2ch_mixer },
18353 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18354 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18355 .dac_nids = alc662_dac_nids,
18356 .dig_out_nid = ALC662_DIGOUT_NID,
18357 .dig_in_nid = ALC662_DIGIN_NID,
18358 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18359 .channel_mode = alc662_3ST_2ch_modes,
18360 .input_mux = &alc662_capture_source,
18362 [ALC662_3ST_6ch_DIG] = {
18363 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18364 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18365 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18366 .dac_nids = alc662_dac_nids,
18367 .dig_out_nid = ALC662_DIGOUT_NID,
18368 .dig_in_nid = ALC662_DIGIN_NID,
18369 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18370 .channel_mode = alc662_3ST_6ch_modes,
18372 .input_mux = &alc662_capture_source,
18374 [ALC662_3ST_6ch] = {
18375 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18376 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18377 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18378 .dac_nids = alc662_dac_nids,
18379 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18380 .channel_mode = alc662_3ST_6ch_modes,
18382 .input_mux = &alc662_capture_source,
18384 [ALC662_5ST_DIG] = {
18385 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18386 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18387 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18388 .dac_nids = alc662_dac_nids,
18389 .dig_out_nid = ALC662_DIGOUT_NID,
18390 .dig_in_nid = ALC662_DIGIN_NID,
18391 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18392 .channel_mode = alc662_5stack_modes,
18393 .input_mux = &alc662_capture_source,
18395 [ALC662_LENOVO_101E] = {
18396 .mixers = { alc662_lenovo_101e_mixer },
18397 .init_verbs = { alc662_init_verbs,
18398 alc662_eapd_init_verbs,
18399 alc662_sue_init_verbs },
18400 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18401 .dac_nids = alc662_dac_nids,
18402 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18403 .channel_mode = alc662_3ST_2ch_modes,
18404 .input_mux = &alc662_lenovo_101e_capture_source,
18405 .unsol_event = alc_sku_unsol_event,
18406 .setup = alc662_lenovo_101e_setup,
18407 .init_hook = alc_inithook,
18409 [ALC662_ASUS_EEEPC_P701] = {
18410 .mixers = { alc662_eeepc_p701_mixer },
18411 .init_verbs = { alc662_init_verbs,
18412 alc662_eapd_init_verbs,
18413 alc662_eeepc_sue_init_verbs },
18414 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18415 .dac_nids = alc662_dac_nids,
18416 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18417 .channel_mode = alc662_3ST_2ch_modes,
18418 .unsol_event = alc_sku_unsol_event,
18419 .setup = alc662_eeepc_setup,
18420 .init_hook = alc_inithook,
18422 [ALC662_ASUS_EEEPC_EP20] = {
18423 .mixers = { alc662_eeepc_ep20_mixer,
18424 alc662_chmode_mixer },
18425 .init_verbs = { alc662_init_verbs,
18426 alc662_eapd_init_verbs,
18427 alc662_eeepc_ep20_sue_init_verbs },
18428 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18429 .dac_nids = alc662_dac_nids,
18430 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18431 .channel_mode = alc662_3ST_6ch_modes,
18432 .input_mux = &alc662_lenovo_101e_capture_source,
18433 .unsol_event = alc_sku_unsol_event,
18434 .setup = alc662_eeepc_ep20_setup,
18435 .init_hook = alc_inithook,
18438 .mixers = { alc662_ecs_mixer },
18439 .init_verbs = { alc662_init_verbs,
18440 alc662_eapd_init_verbs,
18441 alc662_ecs_init_verbs },
18442 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18443 .dac_nids = alc662_dac_nids,
18444 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18445 .channel_mode = alc662_3ST_2ch_modes,
18446 .unsol_event = alc_sku_unsol_event,
18447 .setup = alc662_eeepc_setup,
18448 .init_hook = alc_inithook,
18450 [ALC663_ASUS_M51VA] = {
18451 .mixers = { alc663_m51va_mixer },
18452 .init_verbs = { alc662_init_verbs,
18453 alc662_eapd_init_verbs,
18454 alc663_m51va_init_verbs },
18455 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18456 .dac_nids = alc662_dac_nids,
18457 .dig_out_nid = ALC662_DIGOUT_NID,
18458 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18459 .channel_mode = alc662_3ST_2ch_modes,
18460 .unsol_event = alc_sku_unsol_event,
18461 .setup = alc663_m51va_setup,
18462 .init_hook = alc_inithook,
18464 [ALC663_ASUS_G71V] = {
18465 .mixers = { alc663_g71v_mixer },
18466 .init_verbs = { alc662_init_verbs,
18467 alc662_eapd_init_verbs,
18468 alc663_g71v_init_verbs },
18469 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18470 .dac_nids = alc662_dac_nids,
18471 .dig_out_nid = ALC662_DIGOUT_NID,
18472 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18473 .channel_mode = alc662_3ST_2ch_modes,
18474 .unsol_event = alc_sku_unsol_event,
18475 .setup = alc663_g71v_setup,
18476 .init_hook = alc_inithook,
18478 [ALC663_ASUS_H13] = {
18479 .mixers = { alc663_m51va_mixer },
18480 .init_verbs = { alc662_init_verbs,
18481 alc662_eapd_init_verbs,
18482 alc663_m51va_init_verbs },
18483 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18484 .dac_nids = alc662_dac_nids,
18485 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18486 .channel_mode = alc662_3ST_2ch_modes,
18487 .setup = alc663_m51va_setup,
18488 .unsol_event = alc_sku_unsol_event,
18489 .init_hook = alc_inithook,
18491 [ALC663_ASUS_G50V] = {
18492 .mixers = { alc663_g50v_mixer },
18493 .init_verbs = { alc662_init_verbs,
18494 alc662_eapd_init_verbs,
18495 alc663_g50v_init_verbs },
18496 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18497 .dac_nids = alc662_dac_nids,
18498 .dig_out_nid = ALC662_DIGOUT_NID,
18499 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18500 .channel_mode = alc662_3ST_6ch_modes,
18501 .input_mux = &alc663_capture_source,
18502 .unsol_event = alc_sku_unsol_event,
18503 .setup = alc663_g50v_setup,
18504 .init_hook = alc_inithook,
18506 [ALC663_ASUS_MODE1] = {
18507 .mixers = { alc663_m51va_mixer },
18508 .cap_mixer = alc662_auto_capture_mixer,
18509 .init_verbs = { alc662_init_verbs,
18510 alc662_eapd_init_verbs,
18511 alc663_21jd_amic_init_verbs },
18512 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18514 .dac_nids = alc662_dac_nids,
18515 .dig_out_nid = ALC662_DIGOUT_NID,
18516 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18517 .channel_mode = alc662_3ST_2ch_modes,
18518 .unsol_event = alc_sku_unsol_event,
18519 .setup = alc663_mode1_setup,
18520 .init_hook = alc_inithook,
18522 [ALC662_ASUS_MODE2] = {
18523 .mixers = { alc662_1bjd_mixer },
18524 .cap_mixer = alc662_auto_capture_mixer,
18525 .init_verbs = { alc662_init_verbs,
18526 alc662_eapd_init_verbs,
18527 alc662_1bjd_amic_init_verbs },
18528 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18529 .dac_nids = alc662_dac_nids,
18530 .dig_out_nid = ALC662_DIGOUT_NID,
18531 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18532 .channel_mode = alc662_3ST_2ch_modes,
18533 .unsol_event = alc_sku_unsol_event,
18534 .setup = alc662_mode2_setup,
18535 .init_hook = alc_inithook,
18537 [ALC663_ASUS_MODE3] = {
18538 .mixers = { alc663_two_hp_m1_mixer },
18539 .cap_mixer = alc662_auto_capture_mixer,
18540 .init_verbs = { alc662_init_verbs,
18541 alc662_eapd_init_verbs,
18542 alc663_two_hp_amic_m1_init_verbs },
18543 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18545 .dac_nids = alc662_dac_nids,
18546 .dig_out_nid = ALC662_DIGOUT_NID,
18547 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18548 .channel_mode = alc662_3ST_2ch_modes,
18549 .unsol_event = alc_sku_unsol_event,
18550 .setup = alc663_mode3_setup,
18551 .init_hook = alc_inithook,
18553 [ALC663_ASUS_MODE4] = {
18554 .mixers = { alc663_asus_21jd_clfe_mixer },
18555 .cap_mixer = alc662_auto_capture_mixer,
18556 .init_verbs = { alc662_init_verbs,
18557 alc662_eapd_init_verbs,
18558 alc663_21jd_amic_init_verbs},
18559 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18561 .dac_nids = alc662_dac_nids,
18562 .dig_out_nid = ALC662_DIGOUT_NID,
18563 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18564 .channel_mode = alc662_3ST_2ch_modes,
18565 .unsol_event = alc_sku_unsol_event,
18566 .setup = alc663_mode4_setup,
18567 .init_hook = alc_inithook,
18569 [ALC663_ASUS_MODE5] = {
18570 .mixers = { alc663_asus_15jd_clfe_mixer },
18571 .cap_mixer = alc662_auto_capture_mixer,
18572 .init_verbs = { alc662_init_verbs,
18573 alc662_eapd_init_verbs,
18574 alc663_15jd_amic_init_verbs },
18575 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18577 .dac_nids = alc662_dac_nids,
18578 .dig_out_nid = ALC662_DIGOUT_NID,
18579 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18580 .channel_mode = alc662_3ST_2ch_modes,
18581 .unsol_event = alc_sku_unsol_event,
18582 .setup = alc663_mode5_setup,
18583 .init_hook = alc_inithook,
18585 [ALC663_ASUS_MODE6] = {
18586 .mixers = { alc663_two_hp_m2_mixer },
18587 .cap_mixer = alc662_auto_capture_mixer,
18588 .init_verbs = { alc662_init_verbs,
18589 alc662_eapd_init_verbs,
18590 alc663_two_hp_amic_m2_init_verbs },
18591 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18593 .dac_nids = alc662_dac_nids,
18594 .dig_out_nid = ALC662_DIGOUT_NID,
18595 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18596 .channel_mode = alc662_3ST_2ch_modes,
18597 .unsol_event = alc_sku_unsol_event,
18598 .setup = alc663_mode6_setup,
18599 .init_hook = alc_inithook,
18601 [ALC663_ASUS_MODE7] = {
18602 .mixers = { alc663_mode7_mixer },
18603 .cap_mixer = alc662_auto_capture_mixer,
18604 .init_verbs = { alc662_init_verbs,
18605 alc662_eapd_init_verbs,
18606 alc663_mode7_init_verbs },
18607 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18609 .dac_nids = alc662_dac_nids,
18610 .dig_out_nid = ALC662_DIGOUT_NID,
18611 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18612 .channel_mode = alc662_3ST_2ch_modes,
18613 .unsol_event = alc_sku_unsol_event,
18614 .setup = alc663_mode7_setup,
18615 .init_hook = alc_inithook,
18617 [ALC663_ASUS_MODE8] = {
18618 .mixers = { alc663_mode8_mixer },
18619 .cap_mixer = alc662_auto_capture_mixer,
18620 .init_verbs = { alc662_init_verbs,
18621 alc662_eapd_init_verbs,
18622 alc663_mode8_init_verbs },
18623 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18625 .dac_nids = alc662_dac_nids,
18626 .dig_out_nid = ALC662_DIGOUT_NID,
18627 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18628 .channel_mode = alc662_3ST_2ch_modes,
18629 .unsol_event = alc_sku_unsol_event,
18630 .setup = alc663_mode8_setup,
18631 .init_hook = alc_inithook,
18634 .mixers = { alc663_m51va_mixer },
18635 .cap_mixer = alc272_auto_capture_mixer,
18636 .init_verbs = { alc662_init_verbs,
18637 alc662_eapd_init_verbs,
18638 alc272_dell_init_verbs },
18639 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18640 .dac_nids = alc272_dac_nids,
18641 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18642 .adc_nids = alc272_adc_nids,
18643 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18644 .capsrc_nids = alc272_capsrc_nids,
18645 .channel_mode = alc662_3ST_2ch_modes,
18646 .unsol_event = alc_sku_unsol_event,
18647 .setup = alc663_m51va_setup,
18648 .init_hook = alc_inithook,
18650 [ALC272_DELL_ZM1] = {
18651 .mixers = { alc663_m51va_mixer },
18652 .cap_mixer = alc662_auto_capture_mixer,
18653 .init_verbs = { alc662_init_verbs,
18654 alc662_eapd_init_verbs,
18655 alc272_dell_zm1_init_verbs },
18656 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18657 .dac_nids = alc272_dac_nids,
18658 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18659 .adc_nids = alc662_adc_nids,
18661 .capsrc_nids = alc662_capsrc_nids,
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 [ALC272_SAMSUNG_NC10] = {
18668 .mixers = { alc272_nc10_mixer },
18669 .init_verbs = { alc662_init_verbs,
18670 alc662_eapd_init_verbs,
18671 alc663_21jd_amic_init_verbs },
18672 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18673 .dac_nids = alc272_dac_nids,
18674 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18675 .channel_mode = alc662_3ST_2ch_modes,
18676 /*.input_mux = &alc272_nc10_capture_source,*/
18677 .unsol_event = alc_sku_unsol_event,
18678 .setup = alc663_mode4_setup,
18679 .init_hook = alc_inithook,
18685 * BIOS auto configuration
18688 /* convert from MIX nid to DAC */
18689 static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
18694 num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
18695 for (i = 0; i < num; i++) {
18696 if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
18702 /* go down to the selector widget before the mixer */
18703 static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin)
18706 int num = snd_hda_get_connections(codec, pin, srcs,
18709 get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL)
18714 /* get MIX nid connected to the given pin targeted to DAC */
18715 static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18721 pin = alc_go_down_to_selector(codec, pin);
18722 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18723 for (i = 0; i < num; i++) {
18724 if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
18730 /* select the connection from pin to DAC if needed */
18731 static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin,
18737 pin = alc_go_down_to_selector(codec, pin);
18738 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18741 for (i = 0; i < num; i++) {
18742 if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
18743 snd_hda_codec_update_cache(codec, pin, 0,
18744 AC_VERB_SET_CONNECT_SEL, i);
18751 /* look for an empty DAC slot */
18752 static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18754 struct alc_spec *spec = codec->spec;
18758 pin = alc_go_down_to_selector(codec, pin);
18759 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18760 for (i = 0; i < num; i++) {
18761 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
18764 if (found_in_nid_list(nid, spec->multiout.dac_nids,
18765 spec->multiout.num_dacs))
18767 if (spec->multiout.hp_nid == nid)
18769 if (found_in_nid_list(nid, spec->multiout.extra_out_nid,
18770 ARRAY_SIZE(spec->multiout.extra_out_nid)))
18777 static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin)
18779 hda_nid_t sel = alc_go_down_to_selector(codec, pin);
18780 if (snd_hda_get_conn_list(codec, sel, NULL) == 1)
18781 return alc_auto_look_for_dac(codec, pin);
18785 /* fill in the dac_nids table from the parsed pin configuration */
18786 static int alc662_auto_fill_dac_nids(struct hda_codec *codec)
18788 struct alc_spec *spec = codec->spec;
18789 const struct auto_pin_cfg *cfg = &spec->autocfg;
18794 spec->multiout.num_dacs = 0;
18795 spec->multiout.hp_nid = 0;
18796 spec->multiout.extra_out_nid[0] = 0;
18797 memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
18798 spec->multiout.dac_nids = spec->private_dac_nids;
18800 /* fill hard-wired DACs first */
18802 for (i = 0; i < cfg->line_outs; i++)
18803 spec->private_dac_nids[i] =
18804 get_dac_if_single(codec, cfg->line_out_pins[i]);
18806 spec->multiout.hp_nid =
18807 get_dac_if_single(codec, cfg->hp_pins[0]);
18808 if (cfg->speaker_outs)
18809 spec->multiout.extra_out_nid[0] =
18810 get_dac_if_single(codec, cfg->speaker_pins[0]);
18813 for (i = 0; i < cfg->line_outs; i++) {
18814 hda_nid_t pin = cfg->line_out_pins[i];
18815 if (spec->private_dac_nids[i])
18817 spec->private_dac_nids[i] = alc_auto_look_for_dac(codec, pin);
18818 if (!spec->private_dac_nids[i] && !redone) {
18819 /* if we can't find primary DACs, re-probe without
18820 * checking the hard-wired DACs
18827 for (i = 0; i < cfg->line_outs; i++) {
18828 if (spec->private_dac_nids[i])
18829 spec->multiout.num_dacs++;
18831 memmove(spec->private_dac_nids + i,
18832 spec->private_dac_nids + i + 1,
18833 sizeof(hda_nid_t) * (cfg->line_outs - i - 1));
18839 static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
18840 hda_nid_t nid, int idx, unsigned int chs)
18842 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx,
18843 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
18846 static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
18847 hda_nid_t nid, int idx, unsigned int chs)
18849 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx,
18850 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
18853 #define alc662_add_vol_ctl(spec, pfx, nid, chs) \
18854 __alc662_add_vol_ctl(spec, pfx, nid, 0, chs)
18855 #define alc662_add_sw_ctl(spec, pfx, nid, chs) \
18856 __alc662_add_sw_ctl(spec, pfx, nid, 0, chs)
18857 #define alc662_add_stereo_vol(spec, pfx, nid) \
18858 alc662_add_vol_ctl(spec, pfx, nid, 3)
18859 #define alc662_add_stereo_sw(spec, pfx, nid) \
18860 alc662_add_sw_ctl(spec, pfx, nid, 3)
18862 /* add playback controls from the parsed DAC table */
18863 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
18864 const struct auto_pin_cfg *cfg)
18866 struct alc_spec *spec = codec->spec;
18867 hda_nid_t nid, mix, pin;
18868 int i, err, noutputs;
18870 noutputs = cfg->line_outs;
18871 if (spec->multi_ios > 0)
18872 noutputs += spec->multi_ios;
18874 for (i = 0; i < noutputs; i++) {
18877 nid = spec->multiout.dac_nids[i];
18880 if (i >= cfg->line_outs)
18881 pin = spec->multi_io[i - 1].pin;
18883 pin = cfg->line_out_pins[i];
18884 mix = alc_auto_dac_to_mix(codec, pin, nid);
18887 name = alc_get_line_out_pfx(spec, i, true, &index);
18890 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
18893 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
18896 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
18899 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
18903 err = __alc662_add_vol_ctl(spec, name, nid, index, 3);
18906 err = __alc662_add_sw_ctl(spec, name, mix, index, 3);
18914 /* add playback controls for speaker and HP outputs */
18915 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
18916 hda_nid_t dac, const char *pfx)
18918 struct alc_spec *spec = codec->spec;
18925 /* the corresponding DAC is already occupied */
18926 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
18927 return 0; /* no way */
18928 /* create a switch only */
18929 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
18930 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
18933 mix = alc_auto_dac_to_mix(codec, pin, dac);
18936 err = alc662_add_vol_ctl(spec, pfx, dac, 3);
18939 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
18945 /* create playback/capture controls for input pins */
18946 #define alc662_auto_create_input_ctls \
18947 alc882_auto_create_input_ctls
18949 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
18950 hda_nid_t nid, int pin_type,
18954 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
18956 alc_set_pin_output(codec, nid, pin_type);
18957 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
18958 for (i = 0; i < num; i++) {
18959 if (alc_auto_mix_to_dac(codec, srcs[i]) != dac)
18961 /* need the manual connection? */
18963 snd_hda_codec_write(codec, nid, 0,
18964 AC_VERB_SET_CONNECT_SEL, i);
18965 /* unmute mixer widget inputs */
18966 snd_hda_codec_write(codec, srcs[i], 0,
18967 AC_VERB_SET_AMP_GAIN_MUTE,
18969 snd_hda_codec_write(codec, srcs[i], 0,
18970 AC_VERB_SET_AMP_GAIN_MUTE,
18976 static void alc662_auto_init_multi_out(struct hda_codec *codec)
18978 struct alc_spec *spec = codec->spec;
18979 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18982 for (i = 0; i <= HDA_SIDE; i++) {
18983 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18985 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18986 spec->multiout.dac_nids[i]);
18990 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18992 struct alc_spec *spec = codec->spec;
18995 pin = spec->autocfg.hp_pins[0];
18997 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18998 spec->multiout.hp_nid);
18999 pin = spec->autocfg.speaker_pins[0];
19001 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19002 spec->multiout.extra_out_nid[0]);
19005 #define alc662_auto_init_analog_input alc882_auto_init_analog_input
19006 #define alc662_auto_init_input_src alc882_auto_init_input_src
19011 static int alc_auto_fill_multi_ios(struct hda_codec *codec,
19012 unsigned int location)
19014 struct alc_spec *spec = codec->spec;
19015 struct auto_pin_cfg *cfg = &spec->autocfg;
19016 int type, i, num_pins = 0;
19018 for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
19019 for (i = 0; i < cfg->num_inputs; i++) {
19020 hda_nid_t nid = cfg->inputs[i].pin;
19022 unsigned int defcfg, caps;
19023 if (cfg->inputs[i].type != type)
19025 defcfg = snd_hda_codec_get_pincfg(codec, nid);
19026 if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX)
19028 if (location && get_defcfg_location(defcfg) != location)
19030 caps = snd_hda_query_pin_caps(codec, nid);
19031 if (!(caps & AC_PINCAP_OUT))
19033 dac = alc_auto_look_for_dac(codec, nid);
19036 spec->multi_io[num_pins].pin = nid;
19037 spec->multi_io[num_pins].dac = dac;
19039 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19042 spec->multiout.num_dacs = 1;
19048 static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol,
19049 struct snd_ctl_elem_info *uinfo)
19051 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19052 struct alc_spec *spec = codec->spec;
19054 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
19056 uinfo->value.enumerated.items = spec->multi_ios + 1;
19057 if (uinfo->value.enumerated.item > spec->multi_ios)
19058 uinfo->value.enumerated.item = spec->multi_ios;
19059 sprintf(uinfo->value.enumerated.name, "%dch",
19060 (uinfo->value.enumerated.item + 1) * 2);
19064 static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol,
19065 struct snd_ctl_elem_value *ucontrol)
19067 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19068 struct alc_spec *spec = codec->spec;
19069 ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2;
19073 static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
19075 struct alc_spec *spec = codec->spec;
19076 hda_nid_t nid = spec->multi_io[idx].pin;
19078 if (!spec->multi_io[idx].ctl_in)
19079 spec->multi_io[idx].ctl_in =
19080 snd_hda_codec_read(codec, nid, 0,
19081 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19083 snd_hda_codec_update_cache(codec, nid, 0,
19084 AC_VERB_SET_PIN_WIDGET_CONTROL,
19086 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19087 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19089 alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
19091 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19092 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19093 HDA_AMP_MUTE, HDA_AMP_MUTE);
19094 snd_hda_codec_update_cache(codec, nid, 0,
19095 AC_VERB_SET_PIN_WIDGET_CONTROL,
19096 spec->multi_io[idx].ctl_in);
19101 static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
19102 struct snd_ctl_elem_value *ucontrol)
19104 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19105 struct alc_spec *spec = codec->spec;
19108 ch = ucontrol->value.enumerated.item[0];
19109 if (ch < 0 || ch > spec->multi_ios)
19111 if (ch == (spec->ext_channel_count - 1) / 2)
19113 spec->ext_channel_count = (ch + 1) * 2;
19114 for (i = 0; i < spec->multi_ios; i++)
19115 alc_set_multi_io(codec, i, i < ch);
19116 spec->multiout.max_channels = spec->ext_channel_count;
19120 static const struct snd_kcontrol_new alc_auto_channel_mode_enum = {
19121 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
19122 .name = "Channel Mode",
19123 .info = alc_auto_ch_mode_info,
19124 .get = alc_auto_ch_mode_get,
19125 .put = alc_auto_ch_mode_put,
19128 static int alc_auto_add_multi_channel_mode(struct hda_codec *codec,
19129 int (*fill_dac)(struct hda_codec *))
19131 struct alc_spec *spec = codec->spec;
19132 struct auto_pin_cfg *cfg = &spec->autocfg;
19133 unsigned int location, defcfg;
19136 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->hp_outs == 1) {
19137 /* use HP as primary out */
19138 cfg->speaker_outs = cfg->line_outs;
19139 memcpy(cfg->speaker_pins, cfg->line_out_pins,
19140 sizeof(cfg->speaker_pins));
19141 cfg->line_outs = cfg->hp_outs;
19142 memcpy(cfg->line_out_pins, cfg->hp_pins, sizeof(cfg->hp_pins));
19144 memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins));
19145 cfg->line_out_type = AUTO_PIN_HP_OUT;
19149 if (cfg->line_outs != 1 ||
19150 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19153 defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
19154 location = get_defcfg_location(defcfg);
19156 num_pins = alc_auto_fill_multi_ios(codec, location);
19157 if (num_pins > 0) {
19158 struct snd_kcontrol_new *knew;
19160 knew = alc_kcontrol_new(spec);
19163 *knew = alc_auto_channel_mode_enum;
19164 knew->name = kstrdup("Channel Mode", GFP_KERNEL);
19168 spec->multi_ios = num_pins;
19169 spec->ext_channel_count = 2;
19170 spec->multiout.num_dacs = num_pins + 1;
19175 static int alc662_parse_auto_config(struct hda_codec *codec)
19177 struct alc_spec *spec = codec->spec;
19179 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19181 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19185 if (!spec->autocfg.line_outs)
19186 return 0; /* can't find valid BIOS pin config */
19188 err = alc662_auto_fill_dac_nids(codec);
19191 err = alc_auto_add_multi_channel_mode(codec, alc662_auto_fill_dac_nids);
19194 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19197 err = alc662_auto_create_extra_out(codec,
19198 spec->autocfg.speaker_pins[0],
19199 spec->multiout.extra_out_nid[0],
19203 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19204 spec->multiout.hp_nid,
19208 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19212 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19214 alc_auto_parse_digital(codec);
19216 if (spec->kctls.list)
19217 add_mixer(spec, spec->kctls.list);
19219 spec->num_mux_defs = 1;
19220 spec->input_mux = &spec->private_imux[0];
19222 err = alc_auto_add_mic_boost(codec);
19226 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19227 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19228 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19230 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19235 /* additional initialization for auto-configuration model */
19236 static void alc662_auto_init(struct hda_codec *codec)
19238 struct alc_spec *spec = codec->spec;
19239 alc662_auto_init_multi_out(codec);
19240 alc662_auto_init_hp_out(codec);
19241 alc662_auto_init_analog_input(codec);
19242 alc662_auto_init_input_src(codec);
19243 alc_auto_init_digital(codec);
19244 if (spec->unsol_event)
19245 alc_inithook(codec);
19248 static void alc272_fixup_mario(struct hda_codec *codec,
19249 const struct alc_fixup *fix, int action)
19251 if (action != ALC_FIXUP_ACT_PROBE)
19253 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19254 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19255 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
19256 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
19257 (0 << AC_AMPCAP_MUTE_SHIFT)))
19258 printk(KERN_WARNING
19259 "hda_codec: failed to override amp caps for NID 0x2\n");
19263 ALC662_FIXUP_ASPIRE,
19264 ALC662_FIXUP_IDEAPAD,
19265 ALC272_FIXUP_MARIO,
19266 ALC662_FIXUP_CZC_P10T,
19267 ALC662_FIXUP_SKU_IGNORE,
19270 static const struct alc_fixup alc662_fixups[] = {
19271 [ALC662_FIXUP_ASPIRE] = {
19272 .type = ALC_FIXUP_PINS,
19273 .v.pins = (const struct alc_pincfg[]) {
19274 { 0x15, 0x99130112 }, /* subwoofer */
19278 [ALC662_FIXUP_IDEAPAD] = {
19279 .type = ALC_FIXUP_PINS,
19280 .v.pins = (const struct alc_pincfg[]) {
19281 { 0x17, 0x99130112 }, /* subwoofer */
19285 [ALC272_FIXUP_MARIO] = {
19286 .type = ALC_FIXUP_FUNC,
19287 .v.func = alc272_fixup_mario,
19289 [ALC662_FIXUP_CZC_P10T] = {
19290 .type = ALC_FIXUP_VERBS,
19291 .v.verbs = (const struct hda_verb[]) {
19292 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19296 [ALC662_FIXUP_SKU_IGNORE] = {
19297 .type = ALC_FIXUP_SKU,
19298 .v.sku = ALC_FIXUP_SKU_IGNORE,
19302 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
19303 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19304 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
19305 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19306 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19307 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19308 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19309 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19313 static const struct alc_model_fixup alc662_fixup_models[] = {
19314 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
19319 static int patch_alc662(struct hda_codec *codec)
19321 struct alc_spec *spec;
19322 int err, board_config;
19325 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19329 codec->spec = spec;
19331 spec->mixer_nid = 0x0b;
19333 alc_auto_parse_customize_define(codec);
19335 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19337 coef = alc_read_coef_idx(codec, 0);
19338 if (coef == 0x8020 || coef == 0x8011)
19339 alc_codec_rename(codec, "ALC661");
19340 else if (coef & (1 << 14) &&
19341 codec->bus->pci->subsystem_vendor == 0x1025 &&
19342 spec->cdefine.platform_type == 1)
19343 alc_codec_rename(codec, "ALC272X");
19344 else if (coef == 0x4011)
19345 alc_codec_rename(codec, "ALC656");
19347 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19350 if (board_config < 0) {
19351 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19353 board_config = ALC662_AUTO;
19356 if (board_config == ALC662_AUTO) {
19357 alc_pick_fixup(codec, alc662_fixup_models,
19358 alc662_fixup_tbl, alc662_fixups);
19359 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19360 /* automatic parse from the BIOS config */
19361 err = alc662_parse_auto_config(codec);
19367 "hda_codec: Cannot set up configuration "
19368 "from BIOS. Using base mode...\n");
19369 board_config = ALC662_3ST_2ch_DIG;
19373 if (has_cdefine_beep(codec)) {
19374 err = snd_hda_attach_beep_device(codec, 0x1);
19381 if (board_config != ALC662_AUTO)
19382 setup_preset(codec, &alc662_presets[board_config]);
19384 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19385 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19387 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19388 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19390 if (!spec->adc_nids) {
19391 spec->adc_nids = alc662_adc_nids;
19392 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19394 if (!spec->capsrc_nids)
19395 spec->capsrc_nids = alc662_capsrc_nids;
19397 if (!spec->cap_mixer)
19398 set_capture_mixer(codec);
19400 if (has_cdefine_beep(codec)) {
19401 switch (codec->vendor_id) {
19403 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19408 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19411 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19415 spec->vmaster_nid = 0x02;
19417 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19419 codec->patch_ops = alc_patch_ops;
19420 if (board_config == ALC662_AUTO)
19421 spec->init_hook = alc662_auto_init;
19422 spec->shutup = alc_eapd_shutup;
19424 alc_init_jacks(codec);
19426 #ifdef CONFIG_SND_HDA_POWER_SAVE
19427 if (!spec->loopback.amplist)
19428 spec->loopback.amplist = alc662_loopbacks;
19434 static int patch_alc888(struct hda_codec *codec)
19436 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19437 kfree(codec->chip_name);
19438 if (codec->vendor_id == 0x10ec0887)
19439 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19441 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19442 if (!codec->chip_name) {
19446 return patch_alc662(codec);
19448 return patch_alc882(codec);
19451 static int patch_alc899(struct hda_codec *codec)
19453 if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) {
19454 kfree(codec->chip_name);
19455 codec->chip_name = kstrdup("ALC898", GFP_KERNEL);
19457 return patch_alc882(codec);
19463 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19464 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19465 #define alc680_modes alc260_modes
19467 static const hda_nid_t alc680_dac_nids[3] = {
19468 /* Lout1, Lout2, hp */
19472 static const hda_nid_t alc680_adc_nids[3] = {
19474 /* DMIC, MIC, Line-in*/
19479 * Analog capture ADC cgange
19481 static void alc680_rec_autoswitch(struct hda_codec *codec)
19483 struct alc_spec *spec = codec->spec;
19484 struct auto_pin_cfg *cfg = &spec->autocfg;
19486 int type_found = AUTO_PIN_LAST;
19490 for (i = 0; i < cfg->num_inputs; i++) {
19491 nid = cfg->inputs[i].pin;
19492 if (!is_jack_detectable(codec, nid))
19494 if (snd_hda_jack_detect(codec, nid)) {
19495 if (cfg->inputs[i].type < type_found) {
19496 type_found = cfg->inputs[i].type;
19504 snd_hda_get_connections(codec, pin_found, &nid, 1);
19506 if (nid != spec->cur_adc)
19507 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19508 spec->cur_adc = nid;
19509 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19510 spec->cur_adc_format);
19513 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19514 struct hda_codec *codec,
19515 unsigned int stream_tag,
19516 unsigned int format,
19517 struct snd_pcm_substream *substream)
19519 struct alc_spec *spec = codec->spec;
19521 spec->cur_adc = 0x07;
19522 spec->cur_adc_stream_tag = stream_tag;
19523 spec->cur_adc_format = format;
19525 alc680_rec_autoswitch(codec);
19529 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19530 struct hda_codec *codec,
19531 struct snd_pcm_substream *substream)
19533 snd_hda_codec_cleanup_stream(codec, 0x07);
19534 snd_hda_codec_cleanup_stream(codec, 0x08);
19535 snd_hda_codec_cleanup_stream(codec, 0x09);
19539 static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19540 .substreams = 1, /* can be overridden */
19543 /* NID is set in alc_build_pcms */
19545 .prepare = alc680_capture_pcm_prepare,
19546 .cleanup = alc680_capture_pcm_cleanup
19550 static const struct snd_kcontrol_new alc680_base_mixer[] = {
19551 /* output mixer control */
19552 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19553 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19554 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19555 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19556 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT),
19557 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
19558 HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT),
19562 static const struct hda_bind_ctls alc680_bind_cap_vol = {
19563 .ops = &snd_hda_bind_vol,
19565 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19566 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19567 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19572 static const struct hda_bind_ctls alc680_bind_cap_switch = {
19573 .ops = &snd_hda_bind_sw,
19575 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19576 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19577 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19582 static const struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19583 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19584 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19589 * generic initialization of ADC, input mixers and output mixers
19591 static const struct hda_verb alc680_init_verbs[] = {
19592 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19593 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19594 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19596 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19597 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19598 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19599 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19600 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19601 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19605 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19606 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19607 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19609 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19610 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19611 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19616 /* toggle speaker-output according to the hp-jack state */
19617 static void alc680_base_setup(struct hda_codec *codec)
19619 struct alc_spec *spec = codec->spec;
19621 spec->autocfg.hp_pins[0] = 0x16;
19622 spec->autocfg.speaker_pins[0] = 0x14;
19623 spec->autocfg.speaker_pins[1] = 0x15;
19624 spec->autocfg.num_inputs = 2;
19625 spec->autocfg.inputs[0].pin = 0x18;
19626 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19627 spec->autocfg.inputs[1].pin = 0x19;
19628 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19629 spec->automute = 1;
19630 spec->automute_mode = ALC_AUTOMUTE_AMP;
19633 static void alc680_unsol_event(struct hda_codec *codec,
19636 if ((res >> 26) == ALC880_HP_EVENT)
19637 alc_hp_automute(codec);
19638 if ((res >> 26) == ALC880_MIC_EVENT)
19639 alc680_rec_autoswitch(codec);
19642 static void alc680_inithook(struct hda_codec *codec)
19644 alc_hp_automute(codec);
19645 alc680_rec_autoswitch(codec);
19648 /* create input playback/capture controls for the given pin */
19649 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19650 const char *ctlname, int idx)
19668 if (spec->multiout.dac_nids[0] != dac &&
19669 spec->multiout.dac_nids[1] != dac) {
19670 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19671 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19676 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19677 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19681 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19687 /* add playback controls from the parsed DAC table */
19688 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19689 const struct auto_pin_cfg *cfg)
19694 spec->multiout.dac_nids = spec->private_dac_nids;
19696 nid = cfg->line_out_pins[0];
19700 name = alc_get_line_out_pfx(spec, 0, true, &index);
19701 err = alc680_new_analog_output(spec, nid, name, 0);
19706 nid = cfg->speaker_pins[0];
19708 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19712 nid = cfg->hp_pins[0];
19714 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19722 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19723 hda_nid_t nid, int pin_type)
19725 alc_set_pin_output(codec, nid, pin_type);
19728 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19730 struct alc_spec *spec = codec->spec;
19731 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19733 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19734 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19738 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19740 struct alc_spec *spec = codec->spec;
19743 pin = spec->autocfg.hp_pins[0];
19745 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19746 pin = spec->autocfg.speaker_pins[0];
19748 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19751 /* pcm configuration: identical with ALC880 */
19752 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19753 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19754 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19755 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19756 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19759 * BIOS auto configuration
19761 static int alc680_parse_auto_config(struct hda_codec *codec)
19763 struct alc_spec *spec = codec->spec;
19765 static const hda_nid_t alc680_ignore[] = { 0 };
19767 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19772 if (!spec->autocfg.line_outs) {
19773 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19774 spec->multiout.max_channels = 2;
19775 spec->no_analog = 1;
19778 return 0; /* can't find valid BIOS pin config */
19780 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19784 spec->multiout.max_channels = 2;
19787 /* digital only support output */
19788 alc_auto_parse_digital(codec);
19789 if (spec->kctls.list)
19790 add_mixer(spec, spec->kctls.list);
19792 err = alc_auto_add_mic_boost(codec);
19799 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19801 /* init callback for auto-configuration model -- overriding the default init */
19802 static void alc680_auto_init(struct hda_codec *codec)
19804 struct alc_spec *spec = codec->spec;
19805 alc680_auto_init_multi_out(codec);
19806 alc680_auto_init_hp_out(codec);
19807 alc680_auto_init_analog_input(codec);
19808 alc_auto_init_digital(codec);
19809 if (spec->unsol_event)
19810 alc_inithook(codec);
19814 * configuration and preset
19816 static const char * const alc680_models[ALC680_MODEL_LAST] = {
19817 [ALC680_BASE] = "base",
19818 [ALC680_AUTO] = "auto",
19821 static const struct snd_pci_quirk alc680_cfg_tbl[] = {
19822 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19826 static const struct alc_config_preset alc680_presets[] = {
19828 .mixers = { alc680_base_mixer },
19829 .cap_mixer = alc680_master_capture_mixer,
19830 .init_verbs = { alc680_init_verbs },
19831 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19832 .dac_nids = alc680_dac_nids,
19833 .dig_out_nid = ALC680_DIGOUT_NID,
19834 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19835 .channel_mode = alc680_modes,
19836 .unsol_event = alc680_unsol_event,
19837 .setup = alc680_base_setup,
19838 .init_hook = alc680_inithook,
19843 static int patch_alc680(struct hda_codec *codec)
19845 struct alc_spec *spec;
19849 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19853 codec->spec = spec;
19855 /* ALC680 has no aa-loopback mixer */
19857 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19861 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19862 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19864 board_config = ALC680_AUTO;
19867 if (board_config == ALC680_AUTO) {
19868 /* automatic parse from the BIOS config */
19869 err = alc680_parse_auto_config(codec);
19875 "hda_codec: Cannot set up configuration "
19876 "from BIOS. Using base mode...\n");
19877 board_config = ALC680_BASE;
19881 if (board_config != ALC680_AUTO)
19882 setup_preset(codec, &alc680_presets[board_config]);
19884 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19885 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19886 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19887 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19889 if (!spec->adc_nids) {
19890 spec->adc_nids = alc680_adc_nids;
19891 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19894 if (!spec->cap_mixer)
19895 set_capture_mixer(codec);
19897 spec->vmaster_nid = 0x02;
19899 codec->patch_ops = alc_patch_ops;
19900 if (board_config == ALC680_AUTO)
19901 spec->init_hook = alc680_auto_init;
19909 static const struct hda_codec_preset snd_hda_preset_realtek[] = {
19910 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
19911 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19912 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19913 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19914 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19915 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19916 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19917 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19918 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19919 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
19920 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19921 .patch = patch_alc861 },
19922 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19923 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19924 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19925 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19926 .patch = patch_alc882 },
19927 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19928 .patch = patch_alc662 },
19929 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19930 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19931 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19932 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19933 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19934 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19935 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19936 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19937 .patch = patch_alc882 },
19938 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19939 .patch = patch_alc882 },
19940 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19941 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
19942 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19943 .patch = patch_alc882 },
19944 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19945 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19946 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19947 { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 },
19948 {} /* terminator */
19951 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19953 MODULE_LICENSE("GPL");
19954 MODULE_DESCRIPTION("Realtek HD-audio codec");
19956 static struct hda_codec_preset_list realtek_list = {
19957 .preset = snd_hda_preset_realtek,
19958 .owner = THIS_MODULE,
19961 static int __init patch_realtek_init(void)
19963 return snd_hda_add_codec_preset(&realtek_list);
19966 static void __exit patch_realtek_exit(void)
19968 snd_hda_delete_codec_preset(&realtek_list);
19971 module_init(patch_realtek_init)
19972 module_exit(patch_realtek_exit)